minor tweaks
This commit is contained in:
@@ -118,12 +118,12 @@ void forEachInstance( const scene::Instantiable::Visitor& visitor ){
|
||||
}
|
||||
|
||||
void insert( scene::Instantiable::Observer* observer, const scene::Path& path, scene::Instance* instance ){
|
||||
ASSERT_MESSAGE( m_instances.find( key_type( observer, PathConstReference( instance->path() ) ) ) == m_instances.end(), "InstanceSet::insert - element already exists" );
|
||||
m_instances.insert( InstanceMap::value_type( key_type( observer, PathConstReference( instance->path() ) ), instance ) );
|
||||
const bool inserted = m_instances.insert( InstanceMap::value_type( key_type( observer, PathConstReference( instance->path() ) ), instance ) ).second;
|
||||
ASSERT_MESSAGE( inserted, "InstanceSet::insert - element already exists" );
|
||||
}
|
||||
scene::Instance* erase( scene::Instantiable::Observer* observer, const scene::Path& path ){
|
||||
ASSERT_MESSAGE( m_instances.find( key_type( observer, PathConstReference( path ) ) ) != m_instances.end(), "InstanceSet::erase - failed to find element" );
|
||||
InstanceMap::iterator i = m_instances.find( key_type( observer, PathConstReference( path ) ) );
|
||||
ASSERT_MESSAGE( i != m_instances.end(), "InstanceSet::erase - failed to find element" );
|
||||
scene::Instance* instance = i->second;
|
||||
m_instances.erase( i );
|
||||
return instance;
|
||||
|
||||
@@ -35,12 +35,12 @@ public:
|
||||
ASSERT_MESSAGE( m_observers.empty(), "ModuleObservers::~ModuleObservers: observers still attached" );
|
||||
}
|
||||
void attach( ModuleObserver& observer ){
|
||||
ASSERT_MESSAGE( m_observers.find( &observer ) == m_observers.end(), "ModuleObservers::attach: cannot attach observer" );
|
||||
m_observers.insert( &observer );
|
||||
const bool inserted = m_observers.insert( &observer ).second;
|
||||
ASSERT_MESSAGE( inserted, "ModuleObservers::attach: cannot attach observer" );
|
||||
}
|
||||
void detach( ModuleObserver& observer ){
|
||||
ASSERT_MESSAGE( m_observers.find( &observer ) != m_observers.end(), "ModuleObservers::detach: cannot detach observer" );
|
||||
m_observers.erase( &observer );
|
||||
const bool erased = m_observers.erase( &observer );
|
||||
ASSERT_MESSAGE( erased, "ModuleObservers::detach: cannot detach observer" );
|
||||
}
|
||||
void realise(){
|
||||
for ( Observers::iterator i = m_observers.begin(); i != m_observers.end(); ++i )
|
||||
|
||||
Reference in New Issue
Block a user