本文整理汇总了C++中datasourcebase::shared_ptr::evaluate方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_ptr::evaluate方法的具体用法?C++ shared_ptr::evaluate怎么用?C++ shared_ptr::evaluate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datasourcebase::shared_ptr
的用法示例。
在下文中一共展示了shared_ptr::evaluate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: orig
::CORBA::Any * RTT_corba_COperationInterface_i::callOperation (
const char * operation,
::RTT::corba::CAnyArguments & args)
{
if ( mfact->hasMember( string( operation ) ) == false || mfact->isSynchronous(string(operation)) )
throw ::RTT::corba::CNoSuchNameException( operation );
// convert Corba args to C++ args.
try {
OperationCallerC orig(mfact->getPart(operation), operation, 0);
vector<DataSourceBase::shared_ptr> results;
for (size_t i =0; i != args.length(); ++i) {
const TypeInfo* ti = mfact->getPart(operation)->getArgumentType( i + 1);
CorbaTypeTransporter* ctt = dynamic_cast<CorbaTypeTransporter*> ( ti->getProtocol(ORO_CORBA_PROTOCOL_ID) );
// we need to store the results for returning them to caller (args is inout!) after the call()
results.push_back( ctt->createDataSource( &args[i] ) );
orig.arg( results[i] );
}
if ( orig.ready() ) {
DataSourceBase::shared_ptr ds = orig.getCallDataSource();
CORBA::Any* retany;
// Try to get the return result :
const TypeInfo* ti = ds->getTypeInfo();
CorbaTypeTransporter* ctt = dynamic_cast<CorbaTypeTransporter*> ( ti->getProtocol(ORO_CORBA_PROTOCOL_ID) );
if ( !ctt ) {
log(Warning) << "Could not return results of call to " << operation << ": unknown return type by CORBA transport."<<endlog();
ds->evaluate(); // equivalent to orig.call()
retany = new CORBA::Any();
} else {
retany = ctt->createAny( ds ); // call evaluate internally
}
// Return results into args:
for (size_t i =0; i != args.length(); ++i) {
const TypeInfo* ti = mfact->getPart(operation)->getArgumentType( i + 1);
CorbaTypeTransporter* ctta = dynamic_cast<CorbaTypeTransporter*> ( ti->getProtocol(ORO_CORBA_PROTOCOL_ID) );
ctta->updateAny(results[i], args[i]);
}
return retany;
} else {
orig.check(); // will throw
}
} catch (no_asynchronous_operation_exception& ) {
throw ::RTT::corba::CNoSuchNameException( operation );
} catch ( name_not_found_exception& ) {
throw ::RTT::corba::CNoSuchNameException( operation );
} catch ( wrong_number_of_args_exception& wna ) {
throw ::RTT::corba::CWrongNumbArgException( wna.wanted, wna.received );
} catch (wrong_types_of_args_exception& wta ) {
throw ::RTT::corba::CWrongTypeArgException( wta.whicharg, wta.expected_.c_str(), wta.received_.c_str() );
}
return new ::CORBA::Any();
}