Orocos Real-Time Toolkit  2.8.3
ParsedStateMachine.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Tue Jul 20 17:33:09 CEST 2004 ParsedStateMachine.hpp
3 
4  ParsedStateMachine.hpp - description
5  -------------------
6  begin : Tue July 20 2004
7  copyright : (C) 2004 Peter Soetens
8  email : peter.soetens@mech.kuleuven.ac.be
9 
10  ***************************************************************************
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU General Public *
13  * License as published by the Free Software Foundation; *
14  * version 2 of the License. *
15  * *
16  * As a special exception, you may use this file as part of a free *
17  * software library without restriction. Specifically, if other files *
18  * instantiate templates or use macros or inline functions from this *
19  * file, or you compile this file and link it with other files to *
20  * produce an executable, this file does not by itself cause the *
21  * resulting executable to be covered by the GNU General Public *
22  * License. This exception does not however invalidate any other *
23  * reasons why the executable file might be covered by the GNU General *
24  * Public License. *
25  * *
26  * This library is distributed in the hope that it will be useful, *
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
29  * Lesser General Public License for more details. *
30  * *
31  * You should have received a copy of the GNU General Public *
32  * License along with this library; if not, write to the Free Software *
33  * Foundation, Inc., 59 Temple Place, *
34  * Suite 330, Boston, MA 02111-1307 USA *
35  * *
36  ***************************************************************************/
37 
38 
39 #ifndef CURRENT_INCLUDE_PARSEDSTATECONTEXT_HPP
40 #define CURRENT_INCLUDE_PARSEDSTATECONTEXT_HPP
41 
42 #include "StateMachine.hpp"
43 #include "../internal/DataSource.hpp"
44 #include <boost/shared_ptr.hpp>
45 
46 namespace RTT
47 { namespace scripting {
48  typedef boost::shared_ptr<ParsedStateMachine> ParsedStateMachinePtr;
49  typedef boost::weak_ptr<ParsedStateMachine> ParsedStateMachineWPtr;
50 
55  : public StateMachine
56  {
57  typedef std::map<std::string, base::AttributeBase*> VisibleWritableValuesMap;
58  protected:
59  virtual void unloading();
60  public:
62  virtual ~ParsedStateMachine();
63 
67  ParsedStateMachinePtr copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& replacements, bool instantiate = false ) const;
68 
69  void addParameter( const std::string& name, base::AttributeBase* var );
70 
71  base::AttributeBase* getParameter( const std::string& name ) const;
72  VisibleWritableValuesMap getParameters() const;
73  std::vector<std::string> getParameterNames() const;
74 
80  void setName( const std::string& name, bool recursive );
81 
82  std::string getText() const;
83 
84  void setText( std::string text);
85 
86  boost::shared_ptr<StateMachineService> getService() const;
87 
88  void setService(boost::shared_ptr<StateMachineService> tc);
89 
90  bool inState( const std::string& name );
94  void finish();
95  private:
96  VisibleWritableValuesMap parametervalues;
97 
98  boost::shared_ptr<std::string> _text;
99 
100  boost::shared_ptr<StateMachineService> object;
101  };
102 }}
103 
104 #endif
bool inState(const std::string &name)
A hierarchical StateMachine which is loaded in the Program Processor.
boost::shared_ptr< ParsedStateMachine > ParsedStateMachinePtr
void finish()
Call this function if the state machine is parsed.
std::string getText() const
Return the text to which getLineNumber() refers.
void setName(const std::string &name, bool recursive)
Set the name of this machine.
std::vector< std::string > getParameterNames() const
void addParameter(const std::string &name, base::AttributeBase *var)
void setService(boost::shared_ptr< StateMachineService > tc)
An attribute is a minimalistic, named placeholder for data.
boost::weak_ptr< ParsedStateMachine > ParsedStateMachineWPtr
boost::shared_ptr< StateMachineService > getService() const
ParsedStateMachinePtr copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &replacements, bool instantiate=false) const
Create a copy, set instantiate to &#39;true&#39; if instantiating a RootMachine.
base::AttributeBase * getParameter(const std::string &name) const
VisibleWritableValuesMap getParameters() const
virtual void unloading()
Informs this object that it got unloaded from an ExecutionEngine.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:51
State machine created by the scripting engine which represents a parsed state machine.