Orocos Real-Time Toolkit  2.8.3
ProgramInterface.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Mon Jan 19 14:11:21 CET 2004 ProgramInterface.hpp
3 
4  ProgramInterface.hpp - description
5  -------------------
6  begin : Mon January 19 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 ORO_PROGRAMINTERFACE_HPP
39 #define ORO_PROGRAMINTERFACE_HPP
40 
41 #include <string>
42 #include <vector>
43 #include <boost/shared_ptr.hpp>
44 #include "../base/DataSourceBase.hpp"
45 #include "../base/AttributeBase.hpp"
46 #include "../base/ExecutableInterface.hpp"
47 #include "rtt-scripting-config.h"
48 #include "../rtt-fwd.hpp"
49 #include "rtt-scripting-fwd.hpp"
50 
51 namespace RTT
52 { namespace scripting {
53  typedef boost::shared_ptr<ProgramInterface> ProgramInterfacePtr;
54  typedef boost::weak_ptr<ProgramInterface> ProgramInterfaceWPtr;
55 
62  {
63  public:
72  unknown = 0,
76  error
77  };
78  };
79  protected:
81  public:
83 
84  virtual ~ProgramInterface();
85 
89  virtual bool start() = 0;
90 
94  virtual bool pause() = 0;
95 
99  virtual bool step() = 0;
100 
104  virtual bool stop() = 0;
105 
112  virtual bool execute()= 0;
113 
117  virtual void reset() = 0;
118 
122  inline bool isRunning() const { return pStatus == Status::running; }
123 
127  inline bool isPaused() const { return pStatus == Status::paused; }
128 
132  inline bool isStopped() const { return pStatus == Status::stopped; }
133 
137  inline bool inError() const { return pStatus == Status::error; }
138 
139  virtual bool stepDone() const = 0;
140 
144  virtual int getLineNumber() const = 0;
145 
149  Status::ProgramStatus getStatus() const { return pStatus; }
150 
155  virtual std::string getText() const = 0;
156 
160  virtual const std::string& getName() const = 0;
161 
165  virtual std::vector<base::AttributeBase*> getArguments() const = 0;
166 
170  virtual base::AttributeBase* getResult() const = 0;
171 
189  virtual ProgramInterface* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& replacementdss ) const = 0;
190 
191  virtual ProgramInterface* clone() const = 0;
192 
197  virtual bool needsStart() const = 0;
198 
199  };
200 
201 
202 }}
203 
204 
205 #endif
206 
207 
ProgramStatus
Enumerates the statuses of a ProgramInterface.
bool isStopped() const
Returns true if the program is not executing (stopped) or not loaded.
boost::weak_ptr< ProgramInterface > ProgramInterfaceWPtr
#define RTT_SCRIPTING_API
boost::shared_ptr< ProgramInterface > ProgramInterfacePtr
Placeholder of the ProgramStatus.
An attribute is a minimalistic, named placeholder for data.
The program was running but is now paused.
Status::ProgramStatus getStatus() const
Return the current status of the program.
bool isRunning() const
Returns true if the program is running.
This program is currently not loaded in an ExecutionEngine.
Objects that implement this interface are to be executed in the ExecutionEngine.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:51
A Program represents a collection of instructions that can be stepwise executed.
bool inError() const
Returns true if the program is in error.
bool isPaused() const
Returns true if the program is paused.