当前位置: 首页>>代码示例>>C++>>正文


C++ ICommand::getNode方法代码示例

本文整理汇总了C++中co::ICommand::getNode方法的典型用法代码示例。如果您正苦于以下问题:C++ ICommand::getNode方法的具体用法?C++ ICommand::getNode怎么用?C++ ICommand::getNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在co::ICommand的用法示例。


在下文中一共展示了ICommand::getNode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _cmdData

 bool _cmdData( co::ICommand& command )
 {
     TEST( _gotAsync );
     command.getNode()->send( CMD_DATA_REPLY )
         << command.get< uint32_t >() << ++_counter;
     TEST( command.get< std::string >() == payload );
     return true;
 }
开发者ID:qqdiguo,项目名称:Collage,代码行数:8,代码来源:command.cpp

示例2: _cmdReleaseConfig

bool Server::_cmdReleaseConfig( co::ICommand& command )
{
    UUID configID = command.get< UUID >();
    uint32_t requestID = command.get< uint32_t >();

    LBVERB << "Handle release config " << command << " config " << configID
           << std::endl;

    co::NodePtr node = command.getNode();

    Config* config = 0;
    const Configs& configs = getConfigs();
    for( Configs::const_iterator i = configs.begin();
         i != configs.end() && !config; ++i )
    {
        Config* candidate = *i;
        if( candidate->getID() == configID )
            config = candidate;
    }

    if( !config )
    {
        LBWARN << "Release request for unknown config" << std::endl;
        node->send( fabric::CMD_SERVER_RELEASE_CONFIG_REPLY ) << requestID;
        return true;
    }

    if( config->isRunning( ))
    {
        LBWARN << "Release of running configuration" << std::endl;
        config->exit(); // Make sure config is exited
    }

    const uint32_t destroyRequestID = registerRequest();
    node->send( fabric::CMD_SERVER_DESTROY_CONFIG )
            << config->getID() << destroyRequestID;
    waitRequest( destroyRequestID );

#ifdef EQUALIZER_USE_HWSD
    if( config->isAutoConfig( ))
    {
        LBASSERT( _admins.empty( ));
        config->deregister();
        config::Server::release( config );
    }
    else
#endif
    {
        ConfigRestoreVisitor restore;
        config->accept( restore );
        config->commit();
    }

    node->send( fabric::CMD_SERVER_RELEASE_CONFIG_REPLY ) << requestID;
    LBLOG( lunchbox::LOG_ANY ) << "----- Released Config -----" << std::endl;
    return true;
}
开发者ID:benjaminlong,项目名称:Equalizer,代码行数:57,代码来源:server.cpp

示例3: _cmdMap

bool Server::_cmdMap( co::ICommand& command )
{
    co::NodePtr node = command.getNode();
    _admins.push_back( node );

    const Configs& configs = getConfigs();
    for( Configs::const_iterator i = configs.begin(); i != configs.end(); ++i )
    {
        Config* config = *i;
        node->send( fabric::CMD_SERVER_CREATE_CONFIG )
                << co::ObjectVersion( config ) << LB_UNDEFINED_UINT32;
    }

    node->send( fabric::CMD_SERVER_MAP_REPLY ) << command.get< uint32_t >();
    return true;
}
开发者ID:benjaminlong,项目名称:Equalizer,代码行数:16,代码来源:server.cpp

示例4: _cmdShutdown

bool Server::_cmdShutdown( co::ICommand& command )
{
    const uint32_t requestID = command.get< uint32_t >();

    co::NodePtr node = command.getNode();

    if( !_admins.empty( ))
    {
        LBWARN << "Ignoring shutdown request, " << _admins.size()
               << " admin clients connected" << std::endl;

        node->send( fabric::CMD_SERVER_SHUTDOWN_REPLY ) << requestID << false;
        return true;
    }

    const Configs& configs = getConfigs();
    for( Configs::const_iterator i = configs.begin(); i != configs.end(); ++i )
    {
        Config* candidate = *i;
        if( candidate->isUsed( ))
        {
            LBWARN << "Ignoring shutdown request due to used config"
                   << std::endl;

            node->send( fabric::CMD_SERVER_SHUTDOWN_REPLY )
                    << requestID << false;
            return true;
        }
    }

    LBINFO << "Shutting down server" << std::endl;

    _running = false;
    node->send( fabric::CMD_SERVER_SHUTDOWN_REPLY ) << requestID << true;

#ifndef WIN32
    // WAR for 2874188: Lockup at shutdown
    lunchbox::sleep( 100 );
#endif

    return true;
}
开发者ID:benjaminlong,项目名称:Equalizer,代码行数:42,代码来源:server.cpp

示例5: _cmdUnmap

bool Server::_cmdUnmap( co::ICommand& command )
{
    co::NodePtr node = command.getNode();
    co::Nodes::iterator i = stde::find( _admins, node );

    LBASSERT( i != _admins.end( ));
    if( i != _admins.end( ))
    {
        _admins.erase( i );
        const Configs& configs = getConfigs();
        for( Configs::const_iterator j = configs.begin();
             j != configs.end(); ++j )
        {
            Config* config = *j;
            node->send( fabric::CMD_SERVER_DESTROY_CONFIG )
                    << config->getID() << LB_UNDEFINED_UINT32;
        }
    }

    node->send( fabric::CMD_SERVER_UNMAP_REPLY ) << command.get< uint32_t >();
    return true;
}
开发者ID:benjaminlong,项目名称:Equalizer,代码行数:22,代码来源:server.cpp

示例6: _cmdChooseConfig

bool Server::_cmdChooseConfig( co::ICommand& command )
{
    const uint32_t requestID = command.get< uint32_t >();
    const fabric::ConfigParams& params = command.get< fabric::ConfigParams >();

    LBVERB << "Handle choose config " << command << " req " << requestID
           << " renderer " << params.getWorkDir() << '/'
           << params.getRenderClient() << std::endl;

    Config* config = 0;
    const Configs& configs = getConfigs();
    for( ConfigsCIter i = configs.begin(); i != configs.end() && !config; ++i )
    {
        Config* candidate = *i;
        const float version = candidate->getFAttribute( Config::FATTR_VERSION );
        LBASSERT( version == 1.2f );
        if( !candidate->isUsed() && version == 1.2f )
            config = candidate;
    }

#ifdef EQUALIZER_USE_HWSD
    if( !config )
    {
        const std::string& configFile = command.get< std::string >();
        config = config::Server::configure( this, configFile, params );
        if( config )
        {
            config->register_();
            LBINFO << "Configured\n" << *this << std::endl;
        }
    }
#endif

    co::NodePtr node = command.getNode();

    if( !config )
    {
        node->send( fabric::CMD_SERVER_CHOOSE_CONFIG_REPLY )
            << UUID() << requestID;
        return true;
    }

    ConfigBackupVisitor backup;
    config->accept( backup );
    config->setApplicationNetNode( node );
    config->setWorkDir( params.getWorkDir( ));
    config->setRenderClient( params.getRenderClient( ));
    config->commit();

    node->send( fabric::CMD_SERVER_CREATE_CONFIG )
            << co::ObjectVersion( config ) << LB_UNDEFINED_UINT32;

    server::Node* appNode = config->findApplicationNode();
    const co::ConnectionDescriptions& descs =
        appNode->getConnectionDescriptions();

    if( config->getNodes().size() > 1 )
    {
        if( descs.empty() && node->getConnectionDescriptions().empty( ))
        {
            LBWARN << "Likely misconfiguration: Neither the application nor the"
                   << " config file has a connection for this multi-node "
                   << "config. Render clients will be unable to communicate "
                   << "with the application process." << std::endl;
        }
        if( getConnectionDescriptions().empty( ))
        {
            LBWARN << "Likely misconfiguration: The server has no listening "
                   << "connection for this multi-node config. Render clients "
                   << "will be unable to communicate with the server."
                   << std::endl;
        }
    }

    node->send( fabric::CMD_SERVER_CHOOSE_CONFIG_REPLY )
            << config->getID() << requestID << co::serialize( descs );
    return true;
}
开发者ID:benjaminlong,项目名称:Equalizer,代码行数:78,代码来源:server.cpp

示例7: _cmdSync

 bool _cmdSync( co::ICommand& command )
 {
     TEST( _gotAsync );
     ackRequest( command.getNode(), command.get< uint32_t >( ));
     return true;
 }
开发者ID:qqdiguo,项目名称:Collage,代码行数:6,代码来源:command.cpp


注:本文中的co::ICommand::getNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。