ExecutionEngine.hpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef ORO_EXECUTION_ENGINE_HPP
00040 #define ORO_EXECUTION_ENGINE_HPP
00041
00042 #include "RunnableInterface.hpp"
00043 #include "ActivityInterface.hpp"
00044 #include <vector>
00045
00046 #include "rtt-config.h"
00047 #ifdef OROPKG_EXECUTION_ENGINE_EVENTS
00048 #include "EventProcessor.hpp"
00049 #endif
00050 #ifdef OROPKG_EXECUTION_ENGINE_COMMANDS
00051 #include "CommandProcessor.hpp"
00052 #endif
00053 #ifdef OROPKG_EXECUTION_ENGINE_PROGRAMS
00054 #include "ProgramProcessor.hpp"
00055 #endif
00056 #ifdef OROPKG_EXECUTION_ENGINE_STATEMACHINES
00057 #include "StateMachineProcessor.hpp"
00058 #endif
00059
00060 namespace RTT
00061 {
00062 class TaskCore;
00063 class CommandProcessor;
00064 class EventProcessor;
00065 class ProgramProcessor;
00066 class StateMachineProcessor;
00067
00086 class RTT_API ExecutionEngine
00087 : public RunnableInterface
00088 {
00089 protected:
00090 enum EngineState { Stopped, Activating, Active, Running };
00094 TaskCore* taskc;
00095
00100 EngineState estate;
00101
00106 RunnableInterface* cproc;
00107 RunnableInterface* pproc;
00108 RunnableInterface* smproc;
00109 RunnableInterface* eproc;
00110
00114 std::vector<TaskCore*> children;
00115
00119 void setup();
00120
00125 bool startContexts();
00126 public:
00133 ExecutionEngine( TaskCore* owner = 0);
00134
00135 ~ExecutionEngine();
00136
00141 bool activate();
00142
00147 bool start();
00148
00152 bool stop();
00153
00154 virtual bool initialize();
00155
00160 virtual void step();
00161
00162 virtual bool breakLoop();
00163
00164 virtual void finalize();
00165
00166 virtual void setActivity(ActivityInterface* t);
00167
00168 virtual bool hasWork();
00169
00173 TaskCore* getParent();
00174
00178 virtual void addChild(TaskCore* tc);
00179
00183 virtual void removeChild(TaskCore* tc);
00184
00188 TaskCore* getTaskCore() const { return taskc; }
00189
00193 CommandProcessor* commands() const;
00194
00198 ProgramProcessor* programs() const;
00199
00203 StateMachineProcessor* states() const;
00204
00208 EventProcessor* events() const;
00209
00214 virtual void setCommandProcessor(CommandProcessor* c);
00215
00220 virtual void setProgramProcessor(ProgramProcessor* p);
00221
00226 virtual void setStateMachineProcessor(StateMachineProcessor* s);
00227
00232 virtual void setEventProcessor(EventProcessor* e);
00233
00234 };
00235
00236 }
00237 #endif