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 { namespace scripting { 00046 00051 class RTT_SCRIPTING_API StateDescription 00052 : public StateInterface 00053 { 00054 ProgramInterfacePtr mentry; 00055 ProgramInterfacePtr mexit; 00056 ProgramInterfacePtr mhandle; 00057 ProgramInterfacePtr mrun; 00058 std::string name; 00059 int entrypoint; 00060 bool inited; 00061 public: 00066 StateDescription(const std::string& _name, int linenr ) 00067 : mentry(), mexit(), mhandle(), mrun(), 00068 name(_name), entrypoint(linenr), 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 } 00112 00113 void setRunProgram( ProgramInterfacePtr run ) { 00114 mrun = run; 00115 } 00116 00117 void setHandleProgram( ProgramInterfacePtr handle ) { 00118 mhandle = handle; 00119 } 00120 00121 void setExitProgram( ProgramInterfacePtr exit ) { 00122 mexit = exit; 00123 } 00124 00125 bool isDefined() const 00126 { 00127 return inited; 00128 } 00129 00130 void setDefined( bool d ) { 00131 inited = d; 00132 } 00133 00134 StateDescription* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& replacementdss ) const; 00135 00136 }; 00137 }}; 00138 00139 #endif