StateDescription.hpp

00001 /***************************************************************************
00002   tag: Peter Soetens  Thu Apr 22 20:40:59 CEST 2004  StateDescription.hpp
00003 
00004                         StateDescription.hpp -  description
00005                            -------------------
00006     begin                : Thu April 22 2004
00007     copyright            : (C) 2004 Peter Soetens
00008     email                : peter.soetens@mech.kuleuven.ac.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 #ifndef STATE_DESCRIPTION_HPP
00039 #define STATE_DESCRIPTION_HPP
00040 
00041 #include "StateInterface.hpp"
00042 #include "ProgramInterface.hpp"
00043 
00044 namespace RTT
00045 {
00050     class RTT_API StateDescription
00051         : public StateInterface
00052     {
00053         ProgramInterfacePtr mentry;
00054         ProgramInterfacePtr mexit;
00055         ProgramInterfacePtr mhandle;
00056         ProgramInterfacePtr mrun;
00057         std::string name;
00058         int entrypoint;
00059         ProgramProcessor* pp;
00060         bool inited;
00061     public:
00066         StateDescription(const std::string& _name, ProgramProcessor* pproc, int linenr )
00067             : mentry(), mexit(), mhandle(), mrun(),
00068               name(_name), entrypoint(linenr), pp(pproc), inited(false)
00069         {
00070         }
00071 
00072         virtual ~StateDescription();
00073 
00074         const std::string& getName() const { return name; }
00075         void setName(const std::string& newname) { name = newname; }
00076 
00077         void setEntryPoint(int line) { entrypoint = line; }
00078         int getEntryPoint() const { return entrypoint; }
00079 
00091         StateDescription* postponeState();
00092 
00093         ProgramInterface* getEntryProgram() const {
00094             return mentry.get();
00095         }
00096 
00097         ProgramInterface* getRunProgram() const {
00098             return mrun.get();
00099         }
00100 
00101         ProgramInterface* getHandleProgram() const {
00102             return mhandle.get();
00103         }
00104 
00105         ProgramInterface* getExitProgram() const {
00106             return mexit.get();
00107         }
00108 
00109         void setEntryProgram( ProgramInterfacePtr entry ) {
00110             mentry = entry;
00111             if (mentry)
00112                 mentry->setProgramProcessor( pp );
00113         }
00114 
00115         void setRunProgram( ProgramInterfacePtr run ) {
00116             mrun = run;
00117             if (mrun)
00118                 mrun->setProgramProcessor( pp );
00119         }
00120 
00121         void setHandleProgram( ProgramInterfacePtr handle ) {
00122             mhandle = handle;
00123             if (mhandle)
00124                 mhandle->setProgramProcessor( pp );
00125         }
00126 
00127         void setExitProgram( ProgramInterfacePtr exit ) {
00128             mexit = exit;
00129             if (mexit)
00130                 mexit->setProgramProcessor( pp );
00131         }
00132 
00133         bool isDefined() const
00134         {
00135             return inited;
00136         }
00137 
00138         void setDefined( bool d ) {
00139             inited = d;
00140         }
00141 
00142         StateDescription* copy( std::map<const DataSourceBase*, DataSourceBase*>& replacementdss ) const;
00143 
00144     };
00145 };
00146 
00147 #endif
Generated on Thu Dec 23 13:22:38 2010 for Orocos Real-Time Toolkit by  doxygen 1.6.3