39 #ifndef ORO_TASK_OPERATION_CALLER_HPP 40 #define ORO_TASK_OPERATION_CALLER_HPP 43 #include <boost/function.hpp> 45 #ifdef ORO_TEST_OPERATION_CALLER 81 template<
class SignatureT>
85 boost::shared_ptr< base::OperationCallerBase<SignatureT> > >,
94 boost::shared_ptr< base::OperationCallerBase<Signature> > >
Base;
95 typedef typename boost::function_traits<Signature>::result_type
result_type;
96 typedef boost::function_traits<Signature>
traits;
104 : Base(), mname(), mcaller(0)
113 : Base(), mname(name), mcaller(caller)
125 mname(m.mname), mcaller(m.mcaller)
144 this->impl.reset( m.impl->cloneI(mcaller) );
161 mname(), mcaller(caller)
163 if ( !this->impl && implementation ) {
164 log(
Error) <<
"Tried to construct OperationCaller from incompatible local operation."<< endlog();
167 this->impl.reset( this->impl->cloneI(mcaller) );
182 mname(), mcaller(caller)
201 mname(name), mcaller(caller)
205 if (service->hasMember(name))
220 if (this->impl && this->impl == implementation)
239 log(
Warning) <<
"Assigning OperationCaller from null part."<<endlog();
259 log(
Warning) <<
"Assigning OperationCaller from null service."<<endlog();
262 if (this->mname.empty()) {
263 log(
Error) <<
"Can't initialise unnamed OperationCaller from service '"<<service->getName() <<
"'."<<endlog();
271 #ifdef ORO_TEST_OPERATION_CALLER 281 template<
class M,
class ObjectType>
284 mname(name), mcaller(caller)
297 mname(name), mcaller(caller)
327 return this->impl && this->impl->ready();
333 std::string
const&
getName()
const {
return mname;}
336 *
this = implementation;
338 this->mcaller = caller;
339 this->impl->setCaller(caller);
364 this->impl = new_impl;
368 this->mcaller = caller;
370 this->impl->setCaller(caller);
389 }
catch( std::exception& e ) {
390 log(
Error) <<
"Constructing RemoteOperationCaller for "<< mname <<
" was not possible."<<endlog();
391 log(
Error) <<
"Probable cause: " << e.what() <<endlog();
394 if (this->impl->ready()) {
395 log(
Debug) <<
"Constructed OperationCaller from remote implementation '"<< mname<<
"'."<< endlog();
398 log(
Error) <<
"Tried to construct OperationCaller from incompatible operation '"<< mname<<
"'."<< endlog();
401 log(
Error) <<
"Tried to construct remote OperationCaller but ORO_REMOTING was disabled."<< endlog();
405 this->impl.reset( this->impl->cloneI(mcaller) );
411 #ifdef ORO_TEST_OPERATION_CALLER 420 template<
class F,
class O>
OperationCaller(std::string name, ExecutionEngine *caller=0)
Create an OperationCaller object with a name and optional caller.
std::string const & getName() const
Get the name of this OperationCaller.
An invoker can be given an implementation and is identified by a name.
OperationCaller & operator=(OperationInterfacePart *part)
OperationCaller objects may be assigned to a part responsible for production of an implementation...
OperationCaller & operator=(ServicePtr service)
Named OperationCaller objects may be looked up in a Service.
OperationCaller & operator=(const OperationCaller &m)
OperationCaller objects may be assigned.
const OperationCallerBasePtr getOperationCallerImpl() const
Returns the internal implementation of the OperationCaller object.
bool ready() const
Check if this OperationCaller is ready for execution.
internal::InvokerSignature< boost::function_traits< Signature >::arity, Signature, boost::shared_ptr< base::OperationCallerBase< Signature > > > Base
void setCaller(ExecutionEngine *caller)
Sets the caller of this method after the implementation was set.
virtual std::string getName() const =0
Returns the name of this operation.
boost::shared_ptr< base::OperationCallerBase< Signature > > OperationCallerBasePtr
boost::function_traits< Signature >::result_type result_type
OperationCaller & operator=(boost::shared_ptr< base::DisposableInterface > implementation)
OperationCaller objects may be assigned to an implementation.
The base class for all method implementations.
An execution engine serialises (executes one after the other) the execution of all commands...
OperationCaller(OperationInterfacePart *part, ExecutionEngine *caller=0)
Initialise a nameless OperationCaller object from an operation factory.
A OperationCaller serves as a placeholder (aka 'proxy') for a remote Operation.
A OperationCaller implementation which delegates C++ to datasource conversions when C++ code tries to...
boost::shared_ptr< Service > ServicePtr
Used by various classes to define operator(), given a Signature.
bool setImplementationPart(OperationInterfacePart *orp, ExecutionEngine *caller=0)
Sets a new implementation for this method by using a service part.
void setOperationCallerImpl(OperationCallerBasePtr new_impl)
Sets the internal implementation of the OperationCaller object.
OperationCaller(const std::string &name, ServicePtr service, ExecutionEngine *caller=0)
Initialise a named OperationCaller object from a Service.
This class defines the interface for creating operation objects without using C++ templates...
bool setImplementation(boost::shared_ptr< base::DisposableInterface > implementation, ExecutionEngine *caller=0)
Sets a new implementation for this method.
boost::function_traits< Signature > traits
virtual RTT_API boost::shared_ptr< base::DisposableInterface > getLocalOperation() const
Returns any local operation associated with this operation.
OperationCaller(const OperationCaller &m)
OperationCaller objects may be copied.
~OperationCaller()
Clean up the OperationCaller object.
void disconnect()
Disconnects this caller from the operation it was connected to.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
OperationCaller(boost::shared_ptr< base::DisposableInterface > implementation, ExecutionEngine *caller=0)
Initialise a nameless OperationCaller object from a local Operation.
void setupOperationCaller(OperationInterfacePart *part)
If no local implementation of an operation could be found, this method tries it using the operationre...
ExecutionThread
Users can choose if an operation's function is executed in the component's thread (OwnThread) or in t...
OperationCaller()
Create an empty OperationCaller object.