Ejemplo n.º 1
0
void FSM_EVENTS_GENERATOR(){
	Event spec[]={"SUCCESS", "FAIL", "SUCCESS", "FAIL", "SUCCESS", "FAIL", "SUCCESS", "FAIL", "GO", "NOTHING"};
	int i=0;
	while(true){
		Event t = spec[i];
		if(t == "NOTHING"){ i=1; t=spec[0]; }else i++;
		cout << endl << t<<" -> ";
		mainEventQueue.riseEvent(t);
		boost::this_thread::sleep(boost::posix_time::seconds(1));
	}
}
Ejemplo n.º 2
0
void callTask(std::string task_address, const CallContext& call_ctx, EventQueue& queue){
	cout<<" TASK("<<task_address<<":CALL) ";
	while(true)
	{
		Event e = queue.waitEvent();
		if(not e){
			cout<<" TASK("<<task_address<<":TERMINATED) ";
			return;
		}
		if( e=="/SUCCESS" or e=="/FAIL" or e=="/GO" ){
			Event new_event ( Event(""+e.event_name(), call_ctx) );
			cout<<" TASK("<<task_address<<":"<<new_event<<") ";
			queue.riseEvent(new_event);
		}
	}
}
Ejemplo n.º 3
0
TaskResult tst_mytask(std::string task_address, const CallContext& call_ctx, EventQueue& queue) {
    cout<<" this this my task ";
    queue.riseEvent(Event("success", call_ctx));
    return TaskResult::SUCCESS();
}