Orocos Real-Time Toolkit  2.9.0
OperationCallerC.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Wed Jan 18 14:11:40 CET 2006 OperationCallerC.hpp
3 
4  OperationCallerC.hpp - description
5  -------------------
6  begin : Wed January 18 2006
7  copyright : (C) 2006 Peter Soetens
8  email : peter.soetens@mech.kuleuven.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_EXECUTION_METHODC_HPP
40 #define ORO_EXECUTION_METHODC_HPP
41 
42 #include <string>
43 #include "DataSources.hpp"
44 #include "../Attribute.hpp"
45 #include "../rtt-fwd.hpp"
46 #include "../SendStatus.hpp"
47 #include "SendHandleC.hpp"
48 
49 namespace RTT
50 { namespace internal {
51 
56  {
60  class D;
61  D* d;
65  std::string mname;
66 
67  public:
74 
79  OperationCallerC( OperationInterfacePart* mr, const std::string& name, ExecutionEngine* caller);
80 
84  OperationCallerC(const OperationCallerC& other);
85 
89  OperationCallerC(const OperationCallerC& other, ExecutionEngine* caller);
90 
94  OperationCallerC& operator=(const OperationCallerC& other);
95 
97 
104 
110  template< class ArgT >
111  OperationCallerC& argC( const ArgT a )
112  {
113  return this->arg(base::DataSourceBase::shared_ptr( new ConstantDataSource<ArgT>( a ) ) );
114  }
115 
122  template< class ArgT >
123  OperationCallerC& arg( ArgT& a )
124  {
125  return this->arg(base::DataSourceBase::shared_ptr( new ReferenceDataSource<ArgT>( a ) ) );
126  }
127 
133 
139 
144  template< class RetT >
145  OperationCallerC& ret( RetT& r )
146  {
147  // this is semantically valid wrt Attribute::copy().
149  this->ret( ta );
150  delete ta;
151  return *this;
152  }
153 
157  bool call();
158 
166  SendHandleC send();
167 
175  void check();
176 
180  bool ready() const;
181 
185  OperationInterfacePart* getOrp() const;
186 
190  std::string const& getName() const;
191 
195  base::DataSourceBase::shared_ptr getCallDataSource();
199  base::DataSourceBase::shared_ptr getSendDataSource();
203  base::DataSourceBase::shared_ptr getSendHandleDataSource();
204  };
205 }}
206 
207 #endif
#define RTT_API
Definition: rtt-config.h:97
A DataSource which is used to manipulate a reference to an external value.
An execution engine serialises (executes one after the other) the execution of all commands...
A template-less SendHandle manager.
Definition: SendHandleC.hpp:61
An attribute is a minimalistic, named placeholder for data.
A template-less manager for OperationCaller calls.
This class defines the interface for creating operation objects without using C++ templates...
OperationCallerC & ret(RetT &r)
Store the result of the method in variable.
OperationCallerC & arg(ArgT &a)
Add an argument by reference to the OperationCaller.
A DataSource which holds a constant value and returns it in its get() method.
OperationCallerC & argC(const ArgT a)
Add a constant argument to the OperationCaller.
boost::intrusive_ptr< DataSourceBase > shared_ptr
Use this type to store a pointer to a DataSourceBase.
An Attribute has a name and contains data which can be set and get.
Definition: Attribute.hpp:56
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:52