Orocos Real-Time Toolkit  2.9.0
TryCommand.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Tue Dec 21 22:43:08 CET 2004 TryCommand.hpp
3 
4  TryCommand.hpp - description
5  -------------------
6  begin : Tue December 21 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 ORO_TRY_COMMAND_HPP
40 #define ORO_TRY_COMMAND_HPP
41 
42 #include "rtt-scripting-config.h"
43 #include "../base/ActionInterface.hpp"
44 #include "ConditionInterface.hpp"
45 #include "../Logger.hpp"
46 #include "../internal/DataSource.hpp"
47 
48 namespace RTT
49 { namespace scripting {
50 
51 
52 
53 
61  {
62  // we must use a internal::DataSource for correct
63  // copy sementics ...
66  public:
72 
73  ~TryCommand();
74 
75  bool execute();
76  void reset();
77 
78  bool valid() const;
79 
80  void readArguments();
81 
82  base::ActionInterface* theCommand() const;
83 
85 
86  TryCommand* clone() const;
87 
88  TryCommand* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const;
89  };
90 
97  public ConditionInterface
98  {
100  bool _invert;
101  public:
110 
111  ~TryCommandResult();
112 
113  bool evaluate();
114 
115  ConditionInterface* clone() const;
116 
117  ConditionInterface* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const;
118  };
119 
128  public base::ActionInterface
129  {
130  // the result
132  // the data to evaluate in the command.
134  public:
136 
137  ~EvalCommand();
138 
139  void readArguments();
140 
141  bool execute();
142 
143  void reset();
144 
146 
147  base::ActionInterface* clone() const;
148 
149  base::ActionInterface* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const;
150  };
151 
158  public ConditionInterface
159  {
161  public:
163 
165 
166  bool evaluate();
167 
168  ConditionInterface* clone() const;
169 
170  ConditionInterface* copy( std::map<const base::DataSourceBase*, base::DataSourceBase*>& alreadyCloned ) const;
171  };
172 }}
173 
174 #endif
This interface represents the concept of a condition which can be evaluated and return true or false...
Evaluates a internal::DataSource<bool> in a command.
Definition: TryCommand.hpp:127
#define RTT_SCRIPTING_API
A command which tries another command and stores the result in a internal::DataSource<bool>.
Definition: TryCommand.hpp:59
The result of a command which evaluates a boolean DataSource.
Definition: TryCommand.hpp:157
Based on the software pattern &#39;command&#39;, this interface allows execution of action objects...
boost::intrusive_ptr< DataSource< T > > shared_ptr
Definition: DataSource.hpp:115
boost::intrusive_ptr< AssignableDataSource< T > > shared_ptr
Use this type to store a pointer to an AssignableDataSource.
Definition: DataSource.hpp:198
Returns the (accept/reject) status of another command.
Definition: TryCommand.hpp:96
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:52