73 #include "../../rtt-detail-fwd.hpp" 74 #include "../../internal/OperationCallerC.hpp" 75 #include "../../internal/SendHandleC.hpp" 76 #include "../../Logger.hpp" 77 #include "../../internal/GlobalEngine.hpp" 78 #include "../../plugin/PluginLoader.hpp" 85 : mhandle(sh), morig(sh), mofp(ofp)
119 anys.length( sources.size() );
120 for(
unsigned int i = 0; i != sources.size(); ++i) {
121 const TypeInfo* ti = sources[i]->getTypeInfo();
129 ::RTT::corba::CAnyArguments_out args)
133 args =
new CAnyArguments();
137 return CSendStatus(static_cast<int>(ss) + 2);
138 }
catch(std::runtime_error& e) {
139 throw ::RTT::corba::CCallError(e.what());
144 ::RTT::corba::CAnyArguments_out args)
148 args =
new CAnyArguments();
152 return CSendStatus(static_cast<int>(ss) + 2);
153 }
catch(std::runtime_error& e) {
154 throw ::RTT::corba::CCallError(e.what());
173 if (
cargs.size() > 0) {
178 return new CORBA::Any();
179 }
catch(std::runtime_error& e) {
180 throw ::RTT::corba::CCallError(e.what());
185 const ::RTT::corba::CAnyArguments & args)
188 SendHandleC shc(
morig);
196 shc.setAutoCollect(
false);
199 throw ::RTT::corba::CNoSuchNameException(nnf.
name.c_str());
201 throw ::RTT::corba::CWrongNumbArgException(wna.
wanted, wna.
received);
210 PortableServer::POA_var mPOA = _default_POA();
211 PortableServer::ObjectId_var oid = mPOA->servant_to_id(
this);
212 mPOA->deactivate_object( oid.in() );
218 : mfact(gmf), mpoa( PortableServer::POA::_duplicate(the_poa)),
220 loadPluginOperationPart(&loadPluginOperation)
222 loadPluginOperation.
doc(
"Loads a RTT plugin.").
arg(
"plugin_path",
"The path to the shared library containing the plugin.");
227 return PortableServer::POA::_duplicate(
mpoa);
239 RTT::corba::COperationInterface::COperationDescriptions_var rlist =
new RTT::corba::COperationInterface::COperationDescriptions();
243 rlist->length( flist.size() );
245 for (
size_t i=0; i != flist.size(); ++i)
248 rlist[i - drops].name = CORBA::string_dup( flist[i].c_str() );
249 rlist[i - drops].description = CORBA::string_dup( op->
description().c_str() );
250 ::RTT::corba::CArgumentDescriptions_var arguments =
getArguments( flist[i].c_str() );
251 rlist[i - drops].arguments = arguments;
252 ::RTT::corba::CTypeList_var collect_types =
getCollectTypes( flist[i].c_str() );
253 rlist[i - drops].collect_types = collect_types;
254 rlist[i - drops].result_type = CORBA::string_dup( op->
resultType().c_str() );
255 rlist[i - drops].send_oneway = (op->
collectArity() == 0);
260 rlist->length( flist.size() - drops);
261 return rlist._retn();
265 const char * operation)
267 CArgumentDescriptions_var ret =
new CArgumentDescriptions();
271 ret->length( args.size() );
272 for (
size_t i =0; i != args.size(); ++i) {
273 ret[i].name = CORBA::string_dup( args[i].name.c_str() );
274 ret[i].description = CORBA::string_dup( args[i].description.c_str() );
275 ret[i].type = CORBA::string_dup( args[i].type.c_str() );
281 const char * operation)
283 ::RTT::corba::CTypeList_var ret = new ::RTT::corba::CTypeList();
295 const char * operation)
298 return CORBA::string_dup( mofp->
resultType().c_str() );
302 const char* operation,
306 if ( nbr > mofp->
arity() )
307 throw ::RTT::corba::CWrongArgumentException( nbr, mofp->
arity() );
312 const char* operation,
317 throw ::RTT::corba::CWrongArgumentException( nbr, mofp->
collectArity() );
323 const char * operation)
326 return mofp->
arity();
330 const char * operation)
337 const char * operation)
340 return CORBA::string_dup( mofp->
description().c_str() );
344 const char * operation,
345 const ::RTT::corba::CAnyArguments & args)
351 for (
unsigned int i = 0; i < mofp->
arity() && i < args.length(); ++i) {
361 <<
" could not create data source from Any (argument "<< i+1
362 <<
"): calling operation '"<< operation <<
"' will fail." <<
endlog();
370 throw ::RTT::corba::CNoSuchNameException(operation);
372 throw ::RTT::corba::CNoSuchNameException(nnf.
name.c_str());
374 throw ::RTT::corba::CWrongNumbArgException(wna.
wanted, wna.
received);
381 const char * operation,
382 ::RTT::corba::CAnyArguments & args)
389 vector<DataSourceBase::shared_ptr> results;
390 for (
size_t i =0; i != args.length(); ++i) {
395 orig.
arg( results[i] );
397 if ( orig.
ready() ) {
402 const TypeInfo* ti = ds->getTypeInfo();
405 log(
Warning) <<
"Could not return results of call to " << operation <<
": unknown return type by CORBA transport."<<
endlog();
407 retany =
new CORBA::Any();
413 for (
size_t i =0; i != args.length(); ++i) {
423 throw ::RTT::corba::CNoSuchNameException( operation );
425 throw ::RTT::corba::CNoSuchNameException( operation );
427 throw ::RTT::corba::CWrongNumbArgException( wna.
wanted, wna.
received );
430 }
catch (std::runtime_error& e){
431 throw ::RTT::corba::CCallError(e.what());
433 return new ::CORBA::Any();
437 const char * operation,
438 const ::RTT::corba::CAnyArguments & args)
446 for (
size_t i =0; i != args.length(); ++i) {
451 if ( orig.
ready() ) {
461 throw ::RTT::corba::CNoSuchNameException( operation );
463 throw ::RTT::corba::CNoSuchNameException( operation );
465 throw ::RTT::corba::CWrongNumbArgException( wna.
wanted, wna.
received );
473 const char * operation,
474 const ::RTT::corba::CAnyArguments & args)
479 CSendHandle_var ret = ret_i->_this();
480 ret_i->_remove_ref();
483 return CSendHandle::_nil();
488 const char * operation,
489 const ::RTT::corba::CAnyArguments & args)
496 if (!ret_i || ret_i->
checkStatus() == CSendFailure) {
497 log(
Error) <<
"Sending the '" << operation <<
"'' operation failed (SendFailure)." <<
endlog();
499 }
catch(std::exception &e) {
500 log(
Error) <<
"Sending the '" << operation <<
"'' operation failed:" << e.what() <<
endlog();
503 if (ret_i) ret_i->_remove_ref();
508 string operation_str(operation);
510 if ( !mofp && (operation_str ==
"loadPlugin") )
513 throw ::RTT::corba::CNoSuchNameException( operation );
virtual ::RTT::corba::CSendStatus collect(::RTT::corba::CAnyArguments_out args)
RTT::internal::SendHandleC mhandle
OperationCallerC & arg(base::DataSourceBase::shared_ptr a)
base::DataSourceBase::shared_ptr getCallDataSource()
virtual ::RTT::corba::CSendStatus collectIfDone(::RTT::corba::CAnyArguments_out args)
Operation< Signature > & doc(const std::string &description)
RTT_corba_CSendHandle_i * sendOperationInternal(const char *operation, const ::RTT::corba::CAnyArguments &args)
virtual char * getDescription(const char *operation)
virtual char * getResultType(const char *operation)
virtual const types::TypeInfo * getArgumentType(unsigned int arg) const =0
const std::string & getTypeName() const
virtual char * getArgumentType(const char *, CORBA::UShort)
RTT::Operation< bool(std::string)> loadPluginOperation
virtual ~RTT_corba_CSendHandle_i(void)
virtual ::RTT::corba::CSendStatus checkStatus(void)
std::vector< RTT::base::DataSourceBase::shared_ptr > cargs
bool loadPlugin(const std::string &pluginPath)
virtual CORBA::Any_ptr createAny(base::DataSourceBase::shared_ptr source) const =0
virtual const types::TypeInfo * getCollectType(unsigned int arg) const =0
void setAutoCollect(bool on_off)
virtual ::CORBA::Any * callOperation(const char *operation,::RTT::corba::CAnyArguments &args)
virtual std::string description() const =0
bool isSynchronous(const std::string &name) const
virtual char * getCollectType(const char *, CORBA::UShort)
RTT::OperationInterface * mfact
virtual ::CORBA::Any * ret(void)
virtual ::CORBA::UShort getCollectArity(const char *operation)
virtual ::CORBA::UShort getArity(const char *operation)
virtual unsigned int arity() const =0
virtual RTT::corba::COperationInterface::COperationDescriptions * getOperations(void)
OperationInterfacePart * getPart(const std::string &name)
RTT::OperationInterfacePart * findOperation(const char *operation)
SendHandleC & arg(base::DataSourceBase::shared_ptr a)
std::vector< ArgumentDescription > Descriptions
PortableServer::POA_var mpoa
virtual void sendOperationOneway(const char *operation, const ::RTT::corba::CAnyArguments &args)
bool anysequence_to_sourcevector(CAnyArguments const &anys, vector< DataSourceBase::shared_ptr > &sources)
SendStatus collectIfDone()
virtual void checkOperation(const char *operation, const ::RTT::corba::CAnyArguments &args)
Operation< Signature > & arg(const std::string &name, const std::string &description)
virtual std::string resultType() const =0
PortableServer::POA_ptr _default_POA()
virtual std::string getName() const
virtual std::vector< ArgumentDescription > getArgumentList() const =0
TypeTransporter * getProtocol(int protocol_id) const
RTT::internal::OperationInterfacePartFused< bool(std::string)> loadPluginOperationPart
std::vector< std::string > getNames() const
RTT_corba_COperationInterface_i(RTT::OperationInterface *mfact, PortableServer::POA_ptr the_poa)
virtual unsigned int collectArity() const =0
#define ORO_CORBA_PROTOCOL_ID
virtual base::DataSourceBase::shared_ptr createDataSource(const CORBA::Any *any) const =0
base::DataSourceBase::shared_ptr buildValue() const
virtual ::RTT::corba::CTypeList * getCollectTypes(const char *operation)
bool sourcevector_to_anysequence(vector< DataSourceBase::shared_ptr > const &sources, CAnyArguments &anys)
static boost::shared_ptr< PluginLoader > Instance()
boost::intrusive_ptr< DataSourceBase > shared_ptr
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
virtual ~RTT_corba_COperationInterface_i(void)
virtual ::RTT::corba::CArgumentDescriptions * getArguments(const char *operation)
virtual void checkArguments(const ::RTT::corba::CAnyArguments &args)
RTT_corba_CSendHandle_i(RTT::internal::SendHandleC const &sh, RTT::OperationInterfacePart *ofp)
RTT::OperationInterfacePart * mofp
Holds all exported operations of a component and is able to produce callers for these operations...
virtual ::RTT::corba::CSendHandle_ptr sendOperation(const char *operation, const ::RTT::corba::CAnyArguments &args)
virtual bool updateAny(base::DataSourceBase::shared_ptr source, CORBA::Any &any) const =0
static Logger::LogFunction endlog()
RTT::internal::SendHandleC morig