⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 operationinterfacei.cpp

📁 机器人开源项目orocos的源代码
💻 CPP
字号:
// -*- C++ -*-//// $Id$// ****  Code generated by the The ACE ORB (TAO) IDL Compiler ****// TAO and the TAO IDL Compiler have been developed by://       Center for Distributed Object Computing//       Washington University//       St. Louis, MO//       USA//       http://www.cs.wustl.edu/~schmidt/doc-center.html// and//       Distributed Object Computing Laboratory//       University of California at Irvine//       Irvine, CA//       USA//       http://doc.ece.uci.edu/// and//       Institute for Software Integrated Systems//       Vanderbilt University//       Nashville, TN//       USA//       http://www.isis.vanderbilt.edu///// Information about TAO is available at://     http://www.cs.wustl.edu/~schmidt/TAO.html// TAO_IDL - Generated from // be/be_codegen.cpp:910#include "OperationInterfaceI.h"#include "OperationsI.h"#include "OperationFactory.hpp"using namespace RTT;using namespace RTT::Corba;using namespace std;// Implementation skeleton constructorOrocos_MethodInterface_i::Orocos_MethodInterface_i (MethodFactory* gmf, PortableServer::POA_ptr the_poa)    :mfact(gmf), mpoa( PortableServer::POA::_duplicate(the_poa)){}// Implementation skeleton destructorOrocos_MethodInterface_i::~Orocos_MethodInterface_i (void){}::RTT::Corba::MethodList * Orocos_MethodInterface_i::getMethods (  )  ACE_THROW_SPEC ((    CORBA::SystemException  )){    MethodList_var rlist = new MethodList();    vector<string> flist = mfact->getNames();    rlist->length( flist.size() );    for (size_t i=0; i != flist.size(); ++i)        rlist[i] = CORBA::string_dup( flist[i].c_str() );    return rlist._retn();}::RTT::Corba::Descriptions * Orocos_MethodInterface_i::getArguments (      const char* method    )    ACE_THROW_SPEC ((      CORBA::SystemException      ,::RTT::Corba::NoSuchNameException      )){    Descriptions_var ret = new Descriptions();    if ( mfact->hasMember( string( method ) ) == false )        throw ::RTT::Corba::NoSuchNameException( method );    // method found, convert args:    MethodFactory::Descriptions args = mfact->getArgumentList( string(method) );    ret->length( args.size() );    for (size_t i =0; i != args.size(); ++i) {        ret[i].name = CORBA::string_dup( args[i].name.c_str() );        ret[i].description = CORBA::string_dup( args[i].description.c_str() );        ret[i].type = CORBA::string_dup( args[i].type.c_str() );    }    return ret._retn();}   char * Orocos_MethodInterface_i::getResultType (      const char* method    )    ACE_THROW_SPEC ((      CORBA::SystemException      ,::RTT::Corba::NoSuchNameException    )){    if ( mfact->hasMember( string( method ) ) == false )        throw ::RTT::Corba::NoSuchNameException( method );    return CORBA::string_dup( mfact->getResultType( string(method) ).c_str() );}   char * Orocos_MethodInterface_i::getDescription (      const char* method    )    ACE_THROW_SPEC ((      CORBA::SystemException      ,::RTT::Corba::NoSuchNameException    )){    if ( mfact->hasMember( string( method ) ) == false )        throw ::RTT::Corba::NoSuchNameException( method );    return CORBA::string_dup( mfact->getDescription( string(method) ).c_str() );}::RTT::Corba::Method_ptr Orocos_MethodInterface_i::createMethod (    const char * method,    const ::RTT::Corba::Arguments& args  )  ACE_THROW_SPEC ((    CORBA::SystemException    ,::RTT::Corba::NoSuchNameException    ,::RTT::Corba::WrongNumbArgException    ,::RTT::Corba::WrongTypeArgException  )){    if ( mfact->hasMember( string( method ) ) == false )        throw ::RTT::Corba::NoSuchNameException( method );    // convert Corba args to C++ args.    MethodFactory::Arguments nargs;    nargs.reserve( args.length() );    for (size_t i =0; i != args.length(); ++i)        nargs.push_back( ExpressionProxy::Create( Expression::_duplicate( args[i] ) ) );    // create a local data source and a new method servant to serve it.    try {        MethodC orig(mfact, method);        return mfact->produce(method, nargs )->method( &orig, mpoa.in() );    } catch ( name_not_found_exception& nnf ) {        throw ::RTT::Corba::NoSuchNameException( method );    } catch ( wrong_number_of_args_exception& wna ) {        throw ::RTT::Corba::WrongNumbArgException( wna.wanted, wna.received );    } catch (wrong_types_of_args_exception& wta ) {        throw ::RTT::Corba::WrongTypeArgException( wta.whicharg, wta.expected_.c_str(), wta.received_.c_str() );    }    return ::RTT::Corba::Method::_nil();}::RTT::Corba::Method_ptr Orocos_MethodInterface_i::createMethodAny (    const char * method,    const ::RTT::Corba::AnyArguments& args  )  ACE_THROW_SPEC ((    CORBA::SystemException    ,::RTT::Corba::NoSuchNameException    ,::RTT::Corba::WrongNumbArgException    ,::RTT::Corba::WrongTypeArgException  )){    if ( mfact->hasMember( string( method ) ) == false )        throw ::RTT::Corba::NoSuchNameException( method );    // convert Corba args to C++ args.    MethodFactory::Arguments nargs;    nargs.reserve( args.length() );    for (size_t i =0; i != args.length(); ++i)        nargs.push_back( new ValueDataSource<CORBA::Any_var>( new CORBA::Any( args[i] ) ) );    // create a local data source and a new method servant to serve it.    try {        MethodC orig(mfact, method);        return mfact->produce(method, nargs )->method( &orig, mpoa.in() );    } catch ( name_not_found_exception& nnf ) {        throw ::RTT::Corba::NoSuchNameException( method );    } catch ( wrong_number_of_args_exception& wna ) {        throw ::RTT::Corba::WrongNumbArgException( wna.wanted, wna.received );    } catch (wrong_types_of_args_exception& wta ) {        throw ::RTT::Corba::WrongTypeArgException( wta.whicharg, wta.expected_.c_str(), wta.received_.c_str() );    }    return ::RTT::Corba::Method::_nil();}// Implementation skeleton constructorOrocos_CommandInterface_i::Orocos_CommandInterface_i (CommandFactory* gcf, PortableServer::POA_ptr the_poa)    :mfact(gcf), mpoa( PortableServer::POA::_duplicate(the_poa) ){}// Implementation skeleton destructorOrocos_CommandInterface_i::~Orocos_CommandInterface_i (void){}::RTT::Corba::CommandList * Orocos_CommandInterface_i::getCommands (  )  ACE_THROW_SPEC ((    CORBA::SystemException  )){    CommandList_var rlist = new CommandList();    vector<string> flist = mfact->getNames();    rlist->length( flist.size() );    for (size_t i=0; i != flist.size(); ++i)        rlist[i] = CORBA::string_dup( flist[i].c_str() );    return rlist._retn();}::RTT::Corba::Descriptions * Orocos_CommandInterface_i::getArguments (      const char* command    )    ACE_THROW_SPEC ((      CORBA::SystemException    ,::RTT::Corba::NoSuchNameException    )){    Descriptions_var ret = new Descriptions();    if ( mfact->hasMember( string( command ) ) == false )        throw ::RTT::Corba::NoSuchNameException( command );    // method found, convert args:    CommandFactory::Descriptions args = mfact->getArgumentList( string(command) );    ret->length( args.size() );    for (size_t i =0; i != args.size(); ++i) {        ret[i].name = CORBA::string_dup( args[i].name.c_str() );        ret[i].description = CORBA::string_dup( args[i].description.c_str() );        ret[i].type = CORBA::string_dup( args[i].type.c_str() );    }    return ret._retn();}   char * Orocos_CommandInterface_i::getResultType (      const char* command    )    ACE_THROW_SPEC ((      CORBA::SystemException    ,::RTT::Corba::NoSuchNameException    )){    if ( mfact->hasMember( string( command ) ) == false )        throw ::RTT::Corba::NoSuchNameException( command );    return CORBA::string_dup( mfact->getResultType( string(command) ).c_str() );}   char * Orocos_CommandInterface_i::getDescription (      const char* command    )    ACE_THROW_SPEC ((      CORBA::SystemException    ,::RTT::Corba::NoSuchNameException    )){    if ( mfact->hasMember( string( command ) ) == false )        throw ::RTT::Corba::NoSuchNameException( command );    return CORBA::string_dup( mfact->getDescription( string(command) ).c_str() );}::RTT::Corba::Command_ptr Orocos_CommandInterface_i::createCommand (    const char * command,    const ::RTT::Corba::Arguments& args  )  ACE_THROW_SPEC ((    CORBA::SystemException    ,::RTT::Corba::NoSuchNameException    ,::RTT::Corba::WrongNumbArgException    ,::RTT::Corba::WrongTypeArgException  )){  // Add your implementation here    if ( mfact->hasMember( string( command ) ) == false )        throw ::RTT::Corba::NoSuchNameException( command );    // convert Corba args to C++ args.    // Use CommandC:    try {        CommandC comc(mfact, command);        CommandC orig(mfact, command);        for (size_t i =0; i != args.length(); ++i)            comc.arg( DataSourceBase::shared_ptr(ExpressionProxy::Create( Expression::_duplicate(args[i]) )) );        // servant uses that object:        Orocos_Command_i* com = new Orocos_Command_i( orig, comc, mpoa.in() );        return com->_this();    } catch ( name_not_found_exception& nnf ) {        throw ::RTT::Corba::NoSuchNameException( command );    } catch ( wrong_number_of_args_exception& wna ) {        throw ::RTT::Corba::WrongNumbArgException( wna.wanted, wna.received );    } catch (wrong_types_of_args_exception& wta ) {        throw ::RTT::Corba::WrongTypeArgException( wta.whicharg, wta.expected_.c_str(), wta.received_.c_str() );    }    return ::RTT::Corba::Command::_nil();}::RTT::Corba::Command_ptr Orocos_CommandInterface_i::createCommandAny (    const char * command,    const ::RTT::Corba::AnyArguments& args  )  ACE_THROW_SPEC ((    CORBA::SystemException    ,::RTT::Corba::NoSuchNameException    ,::RTT::Corba::WrongNumbArgException    ,::RTT::Corba::WrongTypeArgException  )){  // Add your implementation here    if ( mfact->hasMember( string( command ) ) == false )        throw ::RTT::Corba::NoSuchNameException( command );    // convert Corba args to C++ args.    // Use CommandC:    try {        CommandC comc(mfact, string( command ) );        CommandC orig(mfact, string( command ) );        for (size_t i =0; i != args.length(); ++i)            comc.arg( DataSourceBase::shared_ptr( new ValueDataSource<CORBA::Any_var>( new CORBA::Any( args[i] ) )));        // servant uses that object:        Orocos_Command_i* com = new Orocos_Command_i( orig, comc, mpoa.in() );        return com->_this();    } catch ( name_not_found_exception& nnf ) {        throw ::RTT::Corba::NoSuchNameException( command );    } catch ( wrong_number_of_args_exception& wna ) {        throw ::RTT::Corba::WrongNumbArgException( wna.wanted, wna.received );    } catch (wrong_types_of_args_exception& wta ) {        throw ::RTT::Corba::WrongTypeArgException( wta.whicharg, wta.expected_.c_str(), wta.received_.c_str() );    }    return ::RTT::Corba::Command::_nil();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -