示例#1
0
const Model* Config::getModel( const eq::uint128_t& modelID )
{
    if( modelID == 0 )
        return 0;

    // Protect if accessed concurrently from multiple pipe threads
    const eq::Node* node = getNodes().front();
    const bool needModelLock = (node->getPipes().size() > 1);
    lunchbox::ScopedWrite _mutex( needModelLock ? &_modelLock : 0 );

    const size_t nModels = _models.size();
    LBASSERT( _modelDist.size() == nModels );

    for( size_t i = 0; i < nModels; ++i )
    {
        const ModelDist* dist = _modelDist[ i ];
        if( dist->getID() == modelID )
            return _models[ i ];
    }

    _modelDist.push_back( new ModelDist );
    Model* model = _modelDist.back()->loadModel( getApplicationNode(),
                                                 getClient(), modelID );
    LBASSERT( model );
    _models.push_back( model );

    return model;
}
示例#2
0
bool SlaveConfig::mapData(const uint128_t& initID)
{
    LBASSERT(!_objects);

    _objects = new ObjectMap(*this, *getApplication());
    const uint32_t request =
        mapObjectNB(_objects, initID, co::VERSION_OLDEST, getApplicationNode());
    return mapObjectSync(request);
}
示例#3
0
bool Config::loadData( const eq::uint128_t& initDataID )
{
    if( !_initData.isAttached( ))
    {
        const uint32_t request = mapObjectNB( &_initData, initDataID,
                                              co::VERSION_OLDEST,
                                              getApplicationNode( ));
        if( !mapObjectSync( request ))
            return false;
        unmapObject( &_initData ); // data was retrieved, unmap immediately
    }
    else // appNode, _initData is registered already
    {
        LBASSERT( _initData.getID() == initDataID );
    }
    return true;
}
示例#4
0
bool Config::loadInitData(const eq::uint128_t& id)
{
    LBASSERT(!_initData.isAttached());
    return getClient()->syncObject(&_initData, id, getApplicationNode());
}