const boost::shared_ptr<StartupSynchronizerImpl> Get(const std::string& uniqueName) { boost::lock_guard<boost::mutex> lck(m_lock); Table::iterator findIt = m_table.find(uniqueName); if (findIt != m_table.end()) { boost::shared_ptr<StartupSynchronizerImpl> impl = findIt->second.lock(); if (impl != NULL) { return impl; } else { m_table.erase(findIt); } } //Either not found or had already been deleted. Create a new one boost::shared_ptr<StartupSynchronizerImpl> newImpl(new StartupSynchronizerImpl(uniqueName), boost::bind(&ImplKeeper::Deleter,this,_1)); m_table.insert(std::make_pair(uniqueName,boost::weak_ptr<StartupSynchronizerImpl>(newImpl))); return newImpl; }
Circuit::Circuit( const brion::BlueConfig& config ) : _impl( newImpl( config )) { }
Circuit::Circuit( const URI& source ) : _impl( newImpl( brion::BlueConfig( source.getPath( )))) { }
Property::Value& Property::Value::operator=( const Property::Value& value ) { if ( this == &value ) { // skip self assignment return *this; } // if we are assigned an empty value, just drop impl if( !value.mImpl ) { delete mImpl; mImpl = NULL; return *this; } // first check if the type is the same, no need to change impl, just assign if( mImpl && ( mImpl->type == value.mImpl->type ) ) { switch( mImpl->type ) { case Property::BOOLEAN: { mImpl->integerValue = value.mImpl->integerValue; break; } case Property::FLOAT: { mImpl->floatValue = value.mImpl->floatValue; break; } case Property::INTEGER: { mImpl->integerValue = value.mImpl->integerValue; break; } case Property::VECTOR2: { *mImpl->vector2Value = *value.mImpl->vector2Value; // type cannot change in mImpl so vector is allocated break; } case Property::VECTOR3: { *mImpl->vector3Value = *value.mImpl->vector3Value; // type cannot change in mImpl so vector is allocated break; } case Property::VECTOR4: { *mImpl->vector4Value = *value.mImpl->vector4Value; // type cannot change in mImpl so vector is allocated break; } case Property::RECTANGLE: { *mImpl->rectValue = *value.mImpl->rectValue; // type cannot change in mImpl so rect is allocated break; } case Property::ROTATION: { *mImpl->quaternionValue = *value.mImpl->quaternionValue; // type cannot change in mImpl so quaternion is allocated break; } case Property::STRING: { *mImpl->stringValue = *value.mImpl->stringValue; // type cannot change in mImpl so string is allocated break; } case Property::MATRIX: { *mImpl->matrixValue = *value.mImpl->matrixValue; // type cannot change in mImpl so matrix is allocated break; } case Property::MATRIX3: { *mImpl->matrix3Value = *value.mImpl->matrix3Value; // type cannot change in mImpl so matrix is allocated break; } case Property::ARRAY: { *mImpl->arrayValue = *value.mImpl->arrayValue; // type cannot change in mImpl so array is allocated break; } case Property::MAP: { *mImpl->mapValue = *value.mImpl->mapValue; // type cannot change in mImpl so map is allocated break; } case Property::NONE: { // mImpl will be NULL, there's no way to get to this case } } } else { // different type, release old impl and create new Impl* newImpl( NULL ); switch ( value.mImpl->type ) { case Property::BOOLEAN: { newImpl = new Impl( bool( value.mImpl->integerValue ) ); break; } case Property::FLOAT: { newImpl = new Impl( value.mImpl->floatValue ); break; } case Property::INTEGER: { newImpl = new Impl( value.mImpl->integerValue ); break; } case Property::VECTOR2: { newImpl = new Impl( *value.mImpl->vector2Value ); // type cannot change in mImpl so vector is allocated break; } case Property::VECTOR3: { newImpl = new Impl( *value.mImpl->vector3Value ); // type cannot change in mImpl so vector is allocated break; } case Property::VECTOR4: { newImpl = new Impl( *value.mImpl->vector4Value ); // type cannot change in mImpl so vector is allocated break; } case Property::RECTANGLE: { newImpl = new Impl( *value.mImpl->rectValue ); // type cannot change in mImpl so rect is allocated break; } case Property::ROTATION: { newImpl = new Impl( *value.mImpl->quaternionValue ); // type cannot change in mImpl so quaternion is allocated break; } case Property::MATRIX3: { newImpl = new Impl( *value.mImpl->matrix3Value ); // type cannot change in mImpl so matrix is allocated break; } case Property::MATRIX: { newImpl = new Impl( *value.mImpl->matrixValue ); // type cannot change in mImpl so matrix is allocated break; } case Property::STRING: { newImpl = new Impl( *value.mImpl->stringValue ); // type cannot change in mImpl so string is allocated break; } case Property::ARRAY: { newImpl = new Impl( *value.mImpl->arrayValue ); // type cannot change in mImpl so array is allocated break; } case Property::MAP: { newImpl = new Impl( *value.mImpl->mapValue ); // type cannot change in mImpl so map is allocated break; } case Property::NONE: { // NULL value will be used for "empty" value } } delete mImpl; mImpl = newImpl; } return *this; }
gkHUD::gkHUD(gkResourceManager* creator, const gkResourceName& name, const gkResourceHandle& handle) : gkResource(creator, name, handle), m_overlay(0) { newImpl(); }
Simulation::Simulation(const URI& source) : _impl{newImpl(source)} { }