Orocos Real-Time Toolkit
2.6.0
|
00001 /*************************************************************************** 00002 tag: Peter Soetens Tue Jul 20 17:33:09 CEST 2004 ParsedStateMachine.hpp 00003 00004 ParsedStateMachine.hpp - description 00005 ------------------- 00006 begin : Tue July 20 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 00039 #ifndef CURRENT_INCLUDE_PARSEDSTATECONTEXT_HPP 00040 #define CURRENT_INCLUDE_PARSEDSTATECONTEXT_HPP 00041 00042 #include "StateMachine.hpp" 00043 #include "../internal/DataSource.hpp" 00044 #include <boost/shared_ptr.hpp> 00045 00046 namespace RTT 00047 { namespace scripting { 00048 typedef boost::shared_ptr<ParsedStateMachine> ParsedStateMachinePtr; 00049 typedef boost::weak_ptr<ParsedStateMachine> ParsedStateMachineWPtr; 00050 00054 class ParsedStateMachine 00055 : public StateMachine 00056 { 00057 typedef std::map<std::string, base::AttributeBase*> VisibleWritableValuesMap; 00058 protected: 00059 virtual void unloading(); 00060 public: 00061 ParsedStateMachine(); 00062 virtual ~ParsedStateMachine(); 00063 00067 ParsedStateMachinePtr copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& replacements, bool instantiate = false ) const; 00068 00069 void addParameter( const std::string& name, base::AttributeBase* var ); 00070 00071 base::AttributeBase* getParameter( const std::string& name ) const; 00072 VisibleWritableValuesMap getParameters() const; 00073 std::vector<std::string> getParameterNames() const; 00074 00080 void setName( const std::string& name, bool recursive ); 00081 00082 std::string getText() const; 00083 00084 void setText( std::string text); 00085 00086 boost::shared_ptr<StateMachineService> getService() const; 00087 00088 void setService(boost::shared_ptr<StateMachineService> tc); 00089 00090 bool inState( const std::string& name ); 00094 void finish(); 00095 private: 00096 VisibleWritableValuesMap parametervalues; 00097 00098 boost::shared_ptr<std::string> _text; 00099 00100 boost::shared_ptr<StateMachineService> object; 00101 }; 00102 }} 00103 00104 #endif