Orocos Real-Time Toolkit  2.8.3
StateDescription.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Thu Apr 22 20:40:59 CEST 2004 StateDescription.hpp
3 
4  StateDescription.hpp - description
5  -------------------
6  begin : Thu April 22 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 #ifndef STATE_DESCRIPTION_HPP
39 #define STATE_DESCRIPTION_HPP
40 
41 #include "StateInterface.hpp"
42 #include "ProgramInterface.hpp"
43 
44 namespace RTT
45 { namespace scripting {
46 
52  : public StateInterface
53  {
54  ProgramInterfacePtr mentry;
55  ProgramInterfacePtr mexit;
56  ProgramInterfacePtr mhandle;
58  std::string name;
59  int entrypoint;
60  bool inited;
61  public:
66  StateDescription(const std::string& _name, int linenr )
67  : mentry(), mexit(), mhandle(), mrun(),
68  name(_name), entrypoint(linenr), inited(false)
69  {
70  }
71 
72  virtual ~StateDescription();
73 
74  const std::string& getName() const { return name; }
75  void setName(const std::string& newname) { name = newname; }
76 
77  void setEntryPoint(int line) { entrypoint = line; }
78  int getEntryPoint() const { return entrypoint; }
79 
91  StateDescription* postponeState();
92 
94  return mentry.get();
95  }
96 
98  return mrun.get();
99  }
100 
102  return mhandle.get();
103  }
104 
106  return mexit.get();
107  }
108 
110  mentry = entry;
111  }
112 
114  mrun = run;
115  }
116 
118  mhandle = handle;
119  }
120 
122  mexit = exit;
123  }
124 
125  bool isDefined() const
126  {
127  return inited;
128  }
129 
130  void setDefined( bool d ) {
131  inited = d;
132  }
133 
134  StateDescription* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& replacementdss ) const;
135 
136  };
137 }}
138 
139 #endif
ProgramInterface * getHandleProgram() const
Get the handle program of this State.
void setEntryProgram(ProgramInterfacePtr entry)
int getEntryPoint() const
Get the beginning definition of this State.
void setHandleProgram(ProgramInterfacePtr handle)
void setRunProgram(ProgramInterfacePtr run)
const std::string & getName() const
Get the name of this state.
This class represents a state with all actions stored in an external program.
#define RTT_SCRIPTING_API
boost::shared_ptr< ProgramInterface > ProgramInterfacePtr
StateDescription(const std::string &_name, int linenr)
Construct a new State with entry, exit and handle nodes.
ProgramInterface * getEntryProgram() const
Get the entry program of this State.
void setExitProgram(ProgramInterfacePtr exit)
void setName(const std::string &newname)
ProgramInterface * getRunProgram() const
Get the run program of this State.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:51
A State contains an entry, run, handle and exit program.
A Program represents a collection of instructions that can be stepwise executed.
ProgramInterface * getExitProgram() const
Get the exit program of this State.