custom_task.h
Go to the documentation of this file.
00001 /*
00002  * custom_task.h
00003  *
00004  *  Created on: Nov 26, 2013
00005  *      Author: dan
00006  */
00007 
00008 #ifndef CUSTOM_TASK_H_
00009 #define CUSTOM_TASK_H_
00010 
00011 #include "main_include.h"
00012 
00013 TaskResult callTask(std::string task_address, const CallContext& call_ctx, EventQueue& queue){
00014         DMDEBUG( cout<<" TASK("<<task_address<<":CALL) " ;)
00015         while(true)
00016         {
00017                 Event e = queue.waitEvent();
00018                 if(not e){
00019                         DMDEBUG( cout<<" TASK("<<task_address<<":TERMINATED) " ; )
00020                         return TaskResult::TERMINATED();
00021                 }
00022                 if( e=="/SUCCESS" or e=="/FAIL" or e=="/GO" ){
00023                         Event new_event ( Event(""+e.event_name(), call_ctx) );
00024                         DMDEBUG( cout<<" TASK("<<task_address<<":"<<new_event<<") "; )
00025                         queue.riseEvent(new_event);
00026                 }
00027 
00028                 if(e=="/GO" and task_address=="T3") return TaskResult::SUCCESS();
00029                 //return TaskResult::FAIL();
00030         }
00031         return TaskResult::FAIL();
00032 }
00033 
00034 #define CALL_REMOTE(NAME, CALLS, EVENTS) boost::bind(&callTask, #NAME, CALLS, EVENTS)
00035 
00036 
00037 
00038 #endif /* CUSTOM_TASK_H_ */


decision_making
Author(s):
autogenerated on Wed Aug 26 2015 11:16:53