40 #include "../FactoryExceptions.hpp" 42 #include "../Service.hpp" 43 #include "../Logger.hpp" 50 using namespace detail;
59 std::vector<DataSourceBase::shared_ptr>
args;
66 size_t sz = ofp->
arity();
67 if ( sz == args.size() ) {
69 m = ofp->
produce(args, caller );
83 log(
Error) <<
"Error in OperationCallerC::ret : can not convert return value of type "<< m->getType() <<
" to given type "<< rta->getType()<<endlog();
92 this->args.push_back( na );
93 this->checkAndCreate();
107 : ofp(mr), caller(caller), mname(name), rta(), m(), s()
109 this->checkAndCreate();
113 : ofp(other.ofp), caller(other.caller), mname(other.mname),
114 args( other.args ), rta( other.rta ), m( other.m ), s(other.s)
130 : d( mr ? new
D( mr, name, caller) : 0 ), ofp(mr), mname(name)
139 log(
Error) <<
"Can not construct OperationCallerC for '"<<name<<
"' from null OperationInterfacePart."<<endlog();
144 : d( other.d ? new
D(*other.d) : 0 ), m( other.m ? other.m : 0), s( other.s ? other.s : 0), ofp(other.ofp), mname(other.mname)
149 : d( other.d ? new
D(*other.d) : 0 ), ofp(other.ofp), mname(other.mname)
154 d =
new D(other.ofp, other.mname, caller);
160 if ( &other ==
this )
163 d = ( other.d ?
new D(*other.d) : 0 );
201 log(
Error) <<
"Error in OperationCallerC::ret : can not convert return value of type "<< m->getType() <<
" to given type "<< r->
getDataSource()->getType()<<endlog();
204 log(
Error) <<
"Can not add return argument to invalid OperationCallerC."<<endlog();
218 log(
Error) <<
"Can not add return argument to invalid OperationCallerC."<<endlog();
225 return m->evaluate();
253 log(
Error) <<
"OperationCallerC::send(): Can not send the '" << ofp->
getName() <<
"' operation:" << nao.
what() << endlog();
261 h->update( s.get() );
OperationCallerC & arg(base::DataSourceBase::shared_ptr a)
Add a datasource argument to the OperationCaller.
base::DataSourceBase::shared_ptr getCallDataSource()
Get the contained data source for 'call'.
virtual base::DataSourceBase::shared_ptr produceSend(const std::vector< base::DataSourceBase::shared_ptr > &args, ExecutionEngine *caller) const =0
Create a DataSource for a given send operation.
OperationCallerC & operator=(const OperationCallerC &other)
A OperationCallerC is assignable.
void newarg(DataSourceBase::shared_ptr na)
bool ready() const
Returns true if this method is ready for execution.
void check()
Checks if this method is ready for calling, will throw if not so.
SendHandleC send()
Send the contained method.
void ret(AttributeBase *r)
Exception thrown when a factory is requested to create an object with an unknown name.
static std::ostream & nl(std::ostream &__os)
Insert a newline ' ' in the ostream.
When Orocos is compiled without exceptions (define ORO_EMBEDDED), the functions which would throw an ...
virtual std::string getName() const =0
Returns the name of this operation.
virtual DataSourceBase::shared_ptr getDataSource() const =0
Return a internal::DataSource which contains the same contents.
DataSourceBase::shared_ptr rta
This exception is thrown if the target and source type of an assignment of a DataSource with a base::...
D(OperationInterfacePart *mr, const std::string &name, ExecutionEngine *caller)
An execution engine serialises (executes one after the other) the execution of all commands...
virtual unsigned int arity() const =0
Returns the arity (number of arguments) of this operation.
A template-less SendHandle manager.
virtual base::DataSourceBase::shared_ptr produceHandle() const =0
Create an empty SendHandle object for this operation.
An attribute is a minimalistic, named placeholder for data.
base::DataSourceBase::shared_ptr getSendDataSource()
Get the contained data source for 'send'.
static std::ostream & endl(std::ostream &__os)
A template-less manager for OperationCaller calls.
virtual base::DataSourceBase::shared_ptr produce(const std::vector< base::DataSourceBase::shared_ptr > &args, ExecutionEngine *caller) const =0
Create a DataSource for a given callable operation.
This class defines the interface for creating operation objects without using C++ templates...
bool call()
Call the contained method.
OperationCallerC & ret(base::AttributeBase *r)
Store the result of the method in a task's attribute.
void ret(DataSourceBase::shared_ptr d)
OperationCallerC()
The default constructor.
A class that wraps a Command in a internal::DataSource<bool> interface.
DataSourceBase::shared_ptr s
std::vector< DataSourceBase::shared_ptr > args
Notify the Logger in which 'module' the message occured.
static Logger & log()
As Instance(), but more userfriendly.
DataSourceBase::shared_ptr m
boost::intrusive_ptr< DataSourceBase > shared_ptr
Use this type to store a pointer to a DataSourceBase.
std::string const & getName() const
Returns the name of the operation that will be called.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
OperationInterfacePart * ofp
OperationInterfacePart * getOrp() const
Returns the factory which we use to produce the operation call.
virtual const char * what() const
Exception thrown when a factory is requested to produce an asynchronous object while it is not availa...