40 #include "../FactoryExceptions.hpp" 42 #include "../Service.hpp" 43 #include "../Logger.hpp" 48 using namespace detail;
57 std::vector<DataSourceBase::shared_ptr>
args;
64 size_t sz = ofp->
arity();
65 if ( sz == args.size() ) {
67 m = ofp->
produce(args, caller );
81 log(
Error) <<
"Error in OperationCallerC::ret : can not convert return value of type "<< m->getType() <<
" to given type "<< rta->getType()<<endlog();
90 this->args.push_back( na );
91 this->checkAndCreate();
105 : ofp(mr), caller(caller), mname(name), rta(), m(), s()
107 this->checkAndCreate();
111 : ofp(other.ofp), caller(other.caller), mname(other.mname),
112 args( other.args ), rta( other.rta ), m( other.m ), s(other.s)
128 : d( mr ?
new D( mr, name, caller) : 0 ), ofp(mr), mname(name)
137 log(
Error) <<
"Can not construct OperationCallerC for '"<<name<<
"' from null OperationInterfacePart."<<endlog();
142 : 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)
147 : d( other.d ?
new D(*other.d) : 0 ), ofp(other.ofp), mname(other.mname)
152 d =
new D(other.ofp, other.mname, caller);
158 if ( &other ==
this )
161 d = ( other.d ?
new D(*other.d) : 0 );
199 log(
Error) <<
"Error in OperationCallerC::ret : can not convert return value of type "<< m->getType() <<
" to given type "<< r->
getDataSource()->getType()<<endlog();
202 log(
Error) <<
"Can not add return argument to invalid OperationCallerC."<<endlog();
216 log(
Error) <<
"Can not add return argument to invalid OperationCallerC."<<endlog();
224 return m->evaluate();
229 sz = d->ofp->arity();
250 h = ofp->produceHandle();
252 log(
Error) <<
"OperationCallerC::send(): Can not send the '" << ofp->getName() <<
"' operation:" << nao.
what() << endlog();
261 h->update( s.get() );
269 sz = d->ofp->arity();
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.
void ret(DataSourceBase::shared_ptr d)
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.
std::string const & getName() const
Returns the name of the operation that will be called.
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 ...
base::DataSourceBase::shared_ptr getSendDataSource()
Get the contained data source for 'send'.
std::vector< DataSourceBase::shared_ptr > args
OperationCallerC & ret(base::AttributeBase *r)
Store the result of the method in a task's attribute.
virtual DataSourceBase::shared_ptr getDataSource() const =0
Return a internal::DataSource which contains the same contents.
D(OperationInterfacePart *mr, const std::string &name, ExecutionEngine *caller)
DataSourceBase::shared_ptr m
OperationCallerC & operator=(const OperationCallerC &other)
A OperationCallerC is assignable.
DataSourceBase::shared_ptr s
This exception is thrown if the target and source type of an assignment of a DataSource with a base::...
void ret(AttributeBase *r)
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.
base::DataSourceBase::shared_ptr getCallDataSource()
Get the contained data source for 'call'.
OperationInterfacePart * getOrp() const
Returns the factory which we use to produce the operation call.
A template-less SendHandle manager.
An attribute is a minimalistic, named placeholder for data.
void newarg(DataSourceBase::shared_ptr na)
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.
DataSourceBase::shared_ptr rta
This class defines the interface for creating operation objects without using C++ templates...
bool call()
Call the contained method.
OperationCallerC()
The default constructor.
A class that wraps a Command in a internal::DataSource<bool> interface.
Notify the Logger in which 'module' the message occured.
static Logger & log()
As Instance(), but more userfriendly.
OperationInterfacePart * ofp
OperationCallerC & arg(base::DataSourceBase::shared_ptr a)
Add a datasource argument to the OperationCaller.
boost::intrusive_ptr< DataSourceBase > shared_ptr
Use this type to store a pointer to a DataSourceBase.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
virtual const char * what() const
Exception thrown when a factory is requested to produce an asynchronous object while it is not availa...