ExecutionEngine.hpp

00001 /***************************************************************************
00002   tag: Peter Soetens  Wed Jan 18 14:11:40 CET 2006  ExecutionEngine.hpp
00003 
00004                         ExecutionEngine.hpp -  description
00005                            -------------------
00006     begin                : Wed January 18 2006
00007     copyright            : (C) 2006 Peter Soetens
00008     email                : peter.soetens@mech.kuleuven.be
00009 
00010  ***************************************************************************
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU General Public                   *
00013  *   License as published by the Free Software Foundation;                 *
00014  *   version 2 of the License.                                             *
00015  *                                                                         *
00016  *   As a special exception, you may use this file as part of a free       *
00017  *   software library without restriction.  Specifically, if other files   *
00018  *   instantiate templates or use macros or inline functions from this     *
00019  *   file, or you compile this file and link it with other files to        *
00020  *   produce an executable, this file does not by itself cause the         *
00021  *   resulting executable to be covered by the GNU General Public          *
00022  *   License.  This exception does not however invalidate any other        *
00023  *   reasons why the executable file might be covered by the GNU General   *
00024  *   Public License.                                                       *
00025  *                                                                         *
00026  *   This library is distributed in the hope that it will be useful,       *
00027  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00028  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00029  *   Lesser General Public License for more details.                       *
00030  *                                                                         *
00031  *   You should have received a copy of the GNU General Public             *
00032  *   License along with this library; if not, write to the Free Software   *
00033  *   Foundation, Inc., 59 Temple Place,                                    *
00034  *   Suite 330, Boston, MA  02111-1307  USA                                *
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
Generated on Thu Dec 23 13:22:37 2010 for Orocos Real-Time Toolkit by  doxygen 1.6.3