예제 #1
0
bool stateful_sequence::evaluate_true(cep_state* source, cep_state* target, tuple_ptr match) {
        universal_state* target2 = (universal_state*)target;
        if(is_left_child(source)) {
                // start a right-hand expression with match as context
		cep_state_ptr next = get_right_child()->create_state(match, target2);
		boost::any_cast<state_type_ptr>(target2->get_property("right_states"))->insert(next);
                return false;
        } else { 
                if(selection == selection::FIRST) {
                        if(boost::any_cast<bool>(target2->get_property("block"))) {
                                // return first result and no more (block=false)
                                target2->set_property("block", bool(false));
                                send_true(target, match);
                                
                                // selection = FIRST and consumption = ALL is faster
                                // when we stop all child nodes immediately
                                if(consumption == consumption::ALL) {
                                        boost::any_cast<state_type_ptr>(target2->get_property("right_states"))->clear();
                                }
                        }
                } else { /* selection == selection::ALL */
                        send_true(target, match);
                }
                
                if(consumption == consumption::MATCHING) {
                        boost::any_cast<state_type_ptr>(target2->get_property("right_states"))->erase(cep_state_ptr(target));
                }
	}
}
예제 #2
0
void check_for_request(){
  if(EINGABE == "VENTILAUF" && ZENTRALVENTIL_ZU) {
    set.valve(ip, on)  
  }
  if(EINGABE == "VENTILZU" && ZENTRALVENTIL_AUF) {
    set.valve(ip, off)
  }
  if(EINGABE == "NOWATER" && ZENTRALVENTIL_ZU){
    requested_ID = 0;
    send_request();
  }
  if(EINGABE == "DELIVERPOSSIBLE?"){
    if(requested_ID == 0){
      send_true();
    }
    else{
      send_false();
    }
  }
  if(EINGABE == "ABORTREQUEST"){
    requested_ID = 0;
    set.valve(ip, off);
  }
}
예제 #3
0
bool stateful_within::evaluate_true(cep_state* source, cep_state* target, tuple_ptr match) {
        return send_true(target, match);
}