40 #include "../FactoryExceptions.hpp" 42 #include "../Service.hpp" 43 #include "../Logger.hpp" 48 using namespace detail;
88 if (ms && autocollect) {
92 }
catch (std::exception&) {
113 std::vector<DataSourceBase::shared_ptr>
args;
122 if ( sz == args.size() ) {
124 args.insert( args.begin(), msh );
129 log(
Error) <<
"Failed to produce collector for "<< mname <<
" with " << sz <<
" arguments." << endlog();
138 this->args.push_back( na );
139 this->checkAndCreate();
143 : mofp(ofp), mname(name), s(), msh(sh), blocking( new
ValueDataSource<bool>(false) )
145 this->checkAndCreate();
149 : mofp(other.mofp), mname(other.mname),
150 args( other.args ), s( other.s ), msh(other.msh), blocking(new
ValueDataSource<bool>(false))
161 : d(0), e(
new E(0) )
166 : d( ofp ?
new D( sh, ofp, name ) : 0 ), e(
new E(op) )
179 : d( other.d ?
new D(*other.d) : 0 ), e(
new E(*other.e) )
185 if ( &other ==
this )
188 d = ( other.d ?
new D(*other.d) : 0 );
191 e->mop = other.e->mop;
192 e->mopkeeper = other.e->mopkeeper;
193 e->orp = other.e->orp;
225 return e->s->value();
231 sz = d->mofp->collectArity();
245 return e->s->value();
251 sz = d->mofp->collectArity();
266 e->mopkeeper->autocollect = on_off;
D(base::DataSourceBase::shared_ptr sh, OperationInterfacePart *ofp, const std::string &name)
DataSource is a base class representing a generic way to read data of type T.
void newarg(DataSourceBase::shared_ptr na)
SendHandleC()
The default constructor.
internal::DataSource< SendStatus >::shared_ptr s
This data source will do a collect/collectIfDone when being evaluated().
OperationKeeper(DataSource< SendStatus >::shared_ptr s, AssignableDataSource< bool >::shared_ptr b)
base::DataSourceBase::shared_ptr getSendHandleDataSource()
Get the contained data source for send handle.
DataSourceBase::shared_ptr msh
SendHandleC & operator=(const SendHandleC &other)
A SendHandleC is assignable.
virtual void set(param_t t)=0
Set this DataSource with a value.
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 ...
internal::AssignableDataSource< bool >::shared_ptr b
Stores the blocking/non blocking flag for collect/collectIfDone.
OperationInterfacePart * orp
Stores the OperationInterfacePart pointer contained in this SendHandle.
void setAutoCollect(bool on_off)
When set to 'on', the destruction of this SendHandleC will cause a call to collect() before all data ...
SendHandleC & arg(base::DataSourceBase::shared_ptr a)
Add a datasource argument to the SendHandle.
E(base::DataSourceBase::shared_ptr op)
SendStatus collect()
Collect the contained method.
Exception thrown when a factory is requested to create an object with an invalid SendHandle.
SendStatus
Returns the status of a send() or collect() invocation.
A template-less SendHandle manager.
base::DataSourceBase::shared_ptr mop
Stores the operation in order to avoid its premature destruction.
Returned when the result of the send() could not be collected.
static std::ostream & endl(std::ostream &__os)
OperationInterfacePart * mofp
SendStatus collectIfDone()
Collect the contained method.
bool ready() const
Returns true if this handle is ready for execution.
This class defines the interface for creating operation objects without using C++ templates...
AssignableDataSource< bool >::shared_ptr blocking
boost::intrusive_ptr< DataSource< T > > shared_ptr
boost::intrusive_ptr< AssignableDataSource< T > > shared_ptr
Use this type to store a pointer to an AssignableDataSource.
boost::shared_ptr< OperationKeeper > mopkeeper
virtual base::DataSourceBase::shared_ptr produceCollect(const std::vector< base::DataSourceBase::shared_ptr > &args, internal::DataSource< bool >::shared_ptr blocking) const =0
Create a DataSource for collecting the results of a Send.
AssignableDataSource< bool >::shared_ptr mb
This is a custom deleter that blocks on an asynchronous operation.
A DataSource which has set() methods.
virtual unsigned int collectArity() const =0
Returns the number of collectable arguments of this operation's function.
DataSource< SendStatus >::shared_ptr ms
Notify the Logger in which 'module' the message occured.
static Logger & log()
As Instance(), but more userfriendly.
void check()
Checks if this handle is ready for collecting, will throw if not so.
std::vector< DataSourceBase::shared_ptr > args
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 bool evaluate() const
Force an evaluation of the DataSourceBase.
OperationInterfacePart * getOrp()
Get the contained OperationInterfacePart for SendHandle.
A simple, yet very useful DataSource, which keeps a value, and returns it in its get() method...
DataSource< SendStatus >::shared_ptr s