43 #include "../../types/Types.hpp"    44 #include "../../internal/DataSources.hpp"    45 #include "../../internal/DataSourceCommand.hpp"    46 #include "../../SendStatus.hpp"    47 #include "../../Handle.hpp"    53 CorbaOperationCallerFactory::CorbaOperationCallerFactory( 
const std::string& method_name, corba::CService_ptr fact, PortableServer::POA_ptr the_poa )
    55       mfact(corba::
CService::_duplicate(fact) ),
    56       mpoa(PortableServer::POA::_duplicate(the_poa)),
    63     return mfact->getArity( method.c_str() );
    67     return mfact->getCollectArity( method.c_str() );
    72         CORBA::String_var tname = mfact->getArgumentType( method.c_str(), i);
    73         if ( 
Types()->type( tname.in() ) != 0 )
    74             return Types()->type( tname.in() );
    77             log(
Warning) << 
"CorbaOperationCallerFactory: remote operation's "<< method <<
" return type " << tname.in() << 
" is unknown in this process." << endlog();
    79             log(
Warning) << 
"CorbaOperationCallerFactory: remote operation's "<< method <<
" argument "<< i <<
" of type " << tname.in() << 
" is unknown in this process." << endlog();
    84         log(
Error) << 
"CorbaOperationCallerFactory::getArgumentType: Wrong arg nbr: " << wae.
which_arg <<
" max is " << wae.
max_arg <<endlog();
    91         CORBA::String_var tname = mfact->getCollectType( method.c_str(), i);
    92         return Types()->type( tname.in() );
   101         CORBA::String_var result = mfact->getResultType( method.c_str() );
   102         return std::string( result.in() );
   106     return std::string();
   115         CORBA::String_var result = mfact->getDescription( method.c_str() );
   116         return std::string( result.in() );
   120     return std::string();
   126         corba::CDescriptions_var result = mfact->getArguments( method.c_str() );
   127         ret.reserve( result->length() );
   128         for (
size_t i=0; i!= result->length(); ++i)
   131                                                           std::string( result[i].type.in() ) ));
   150     std::vector<base::DataSourceBase::shared_ptr> margs;
   153     corba::CAnyArguments_var nargs;
   155     CorbaTypeTransporter* mctt;
   160                     std::vector<base::DataSourceBase::shared_ptr> 
const& args,
   162                     CorbaTypeTransporter* ctt,
   164     : mfact(
CService::_duplicate(fact)), mop(op), margs(args), mcaller(caller), mresult(result), mctt(ctt), mdocall(docall)
   172         nargs->length( margs.size() );
   173         for (
size_t i=0; i < margs.size(); ++i ) {
   177             ctt->updateAny(margs[i], nargs[i]);
   184                 CORBA::Any_var any = mfact->callOperation( mop.c_str(), nargs.inout() );
   185                 for (
size_t i=0; i < margs.size(); ++i ) {
   189                     ctt->updateFromAny( &nargs[i], margs[i] );
   193                     return mctt->updateFromAny(&any.in(), mresult);
   195                 CSendHandle_var sh = mfact->sendOperation( mop.c_str(), nargs.in() );
   209             throw std::runtime_error(std::string(e.
what.in()));
   215     virtual ActionInterface* 
copy( std::map<const DataSourceBase*, DataSourceBase*>& alreadyCloned )
 const {
   216         vector<DataSourceBase::shared_ptr> argcopy( margs.size() );
   218         for (vector<DataSourceBase::shared_ptr>::iterator it = argcopy.begin(); it != argcopy.end(); ++it, ++v)
   219             argcopy[v] = (*it)->copy(alreadyCloned);
   220         return new CorbaOperationCallerCall(CService::_duplicate( mfact.in() ), mop, argcopy, mcaller, mctt, mresult->copy(alreadyCloned), mdocall);
   226     nargs->length( args.size() );
   230     for (
size_t i=0; i < args.size(); ++i ) {
   241         mfact->checkOperation(method.c_str(), nargs.in() );
   245             if ( ti != 
Types()->type(
"void") ) {
   273     nargs->length( args.size() );
   274     for (
size_t i=0; i < args.size(); ++i ) {
   284         mfact->checkOperation(method.c_str(), nargs.inout() );
   314     std::vector<base::DataSourceBase::shared_ptr> margs;
   319                        std::vector<base::DataSourceBase::shared_ptr> 
const& args,
   339                 corba::CAnyArguments_var nargs;
   340                 if ( misblocking->get() ) {
   341                     mss = 
SendStatus( static_cast<int>(msh->collect( nargs.out() ) ) - 2 );
   343                     mss = 
SendStatus( static_cast<int>(msh->collectIfDone( nargs.out() ) ) - 2 );
   347                     assert( nargs->length() ==  margs.size() );
   348                     for (
size_t i=0; i < margs.size(); ++i ) {
   362             throw std::runtime_error(std::string(e.
what.in()));
   368     virtual DataSource<SendStatus>* 
copy( std::map<const DataSourceBase*, DataSourceBase*>& alreadyCloned )
 const {
   369         vector<DataSourceBase::shared_ptr> argcopy( margs.size() );
   371         for (vector<DataSourceBase::shared_ptr>::iterator it = argcopy.begin(); it != argcopy.end(); ++it, ++v)
   372             argcopy[v] = (*it)->
copy(alreadyCloned);
   379     unsigned int expected = mfact->getCollectArity(method.c_str());
   380     if (args.size() !=  expected + 1) {
   384     std::vector<base::DataSourceBase::shared_ptr> cargs( ++args.begin(), args.end() );
   392         nargs->length( cargs.size() );
   393         for (
size_t i=0; i < cargs.size(); ++i ) {
   400         ds->get()->checkArguments( nargs.in() );
   410 #ifdef ORO_SIGNALLING_OPERATIONS   412     log(
Error) << 
"Can not attach Signal to remote Corba Operation '"<<method <<
"'" <<endlog();
 
DataSource is a base class representing a generic way to read data of type T. 
SendStatus const & rvalue() const 
Get a const reference to the value of this DataSource. 
Is thrown when an operation does not exist. 
Is thrown when a wrong type of arguments is provided. 
virtual const types::TypeInfo * getCollectType(unsigned int i) const 
Returns the type information of the n'th collectable argument. 
virtual base::DataSourceBase::shared_ptr produceHandle() const 
Create an empty SendHandle object for this operation. 
virtual unsigned int collectArity() const 
Returns the number of collectable arguments of this operation's function. 
Is thrown when a wrong argument number is queried. 
const std::string & getTypeName() const 
Return the type name which was first registered. 
sequence< any > CAnyArguments
virtual void set(param_t t)=0
Set this DataSource with a value. 
Exception thrown when a factory is requested to create an object with an unknown name. 
virtual std::string getName() const 
Returns the name of this operation. 
std::vector< ArgumentDescription > CDescriptions
virtual unsigned int arity() const 
Returns the arity (number of arguments) of this operation. 
virtual ActionInterface * copy(std::map< const DataSourceBase *, DataSourceBase * > &alreadyCloned) const 
virtual base::DataSourceBase::shared_ptr produceCollect(const std::vector< base::DataSourceBase::shared_ptr > &args, internal::DataSource< bool >::shared_ptr blocking) const 
Create a DataSource for collecting the results of a Send. 
base::DataSourceBase::shared_ptr buildActionAlias(base::ActionInterface *action, base::DataSourceBase::shared_ptr source) const 
Returns a DataSource that first executes an action and returns the result of another data source...
An Orocos Service which hosts operations, attributes and properties. 
An execution engine serialises (executes one after the other) the execution of all commands...
SendStatus
Returns the status of a send() or collect() invocation. 
virtual DataSource< T > * copy(std::map< const base::DataSourceBase *, base::DataSourceBase * > &alreadyCloned) const =0
Create a deep copy of this internal::DataSource, unless it is already cloned. 
virtual std::string description() const 
Returns the description of this operation. 
virtual std::vector< ArgumentDescription > getArgumentList() const 
Get a description of the desired arguments in the ArgumentDescription format. 
DataSource< SendStatus > * clone() const 
Return a shallow clone of this DataSource. 
virtual ~CorbaOperationCallerFactory()
Convenient short notation for every sub-namespace of RTT. 
SendStatus value() const 
Return the result of the last evaluate() function. 
CorbaOperationCallerCollect(CSendHandle_ptr sh, std::vector< base::DataSourceBase::shared_ptr > const &args, DataSource< bool >::shared_ptr isblocking)
A DataSource which is used to execute an action and then return the value of another DataSource...
Description of one Argument of a Command. 
Returned when the result of the send() could not be collected. 
A handler object that allows us to collect the results of a send. 
Based on the software pattern 'command', this interface allows execution of action objects...
A class for representing a user type, and which can build instances of that type. ...
This class defines the interface for creating operation objects without using C++ templates...
TypeInfoRepository::shared_ptr Types()
Obtain a pointer to the global type system. 
ActionInterface * clone() const 
virtual std::string resultType() const 
Return the result (return) type of this operation. 
virtual base::DataSourceBase::shared_ptr produceSend(const std::vector< base::DataSourceBase::shared_ptr > &args, ExecutionEngine *caller) const 
Create a DataSource for a given send operation. 
boost::intrusive_ptr< DataSource< T > > shared_ptr
boost::intrusive_ptr< AssignableDataSource< T > > shared_ptr
Use this type to store a pointer to an AssignableDataSource. 
Returned when the send() succeeded, but the operation has not yet been executed by the receiving comp...
A internal::DataSource which holds an any value and returns it in its get() method. 
Is thrown when a wrong number of arguments is provided. 
static AssignableDataSource< T > * narrow(base::DataSourceBase *db)
This method narrows a base::DataSourceBase to a typeded AssignableDataSource, possibly returning a ne...
TypeTransporter * getProtocol(int protocol_id) const 
Returns this type's transport for a given protocol. 
A class that wraps a Command in a internal::DataSource<bool> interface. 
#define ORO_CORBA_PROTOCOL_ID
base::DataSourceBase::shared_ptr buildValue() const 
Build a internal::ValueDataSource of this type. 
static DataSource< T > * narrow(base::DataSourceBase *db)
This method narrows a base::DataSourceBase to a typeded DataSource, possibly returning a new object...
Exception thrown when a factory is requested to create an object, but a wrong argument type was given...
virtual bool updateFromAny(const CORBA::Any *blob, base::DataSourceBase::shared_ptr target) const =0
Update an assignable datasource target with the contents of blob. 
Exception thrown when a factory is requested to create an object but the wrong number of arguments wa...
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. 
CorbaOperationCallerCall(CService_ptr fact, std::string op, std::vector< base::DataSourceBase::shared_ptr > const &args, ExecutionEngine *caller, CorbaTypeTransporter *ctt, base::DataSourceBase::shared_ptr result, bool docall)
A simple, yet very useful DataSource, which keeps a value, and returns it in its get() method...
The Handle holds the information, and allows manipulation, of a connection between a internal::Signal...
~CorbaOperationCallerCollect()
virtual DataSource< SendStatus > * copy(std::map< const DataSourceBase *, DataSourceBase * > &alreadyCloned) const 
virtual bool updateAny(base::DataSourceBase::shared_ptr source, CORBA::Any &any) const =0
Evaluate source and update an any which contains the value of source. 
virtual const types::TypeInfo * getArgumentType(unsigned int i) const 
Returns the type information of the n'th argument, with argument zero being the return value...
Extends the TypeTransporter in order to allow the creation of channel elements or output halves for a...
virtual base::DataSourceBase::shared_ptr produce(const std::vector< base::DataSourceBase::shared_ptr > &args, ExecutionEngine *caller) const 
Create a DataSource for a given callable operation.