minor tweaks
This commit is contained in:
parent
ebd90382a4
commit
e200ffc762
|
|
@ -118,12 +118,12 @@ void forEachInstance( const scene::Instantiable::Visitor& visitor ){
|
||||||
}
|
}
|
||||||
|
|
||||||
void insert( scene::Instantiable::Observer* observer, const scene::Path& path, scene::Instance* instance ){
|
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" );
|
const bool inserted = m_instances.insert( InstanceMap::value_type( key_type( observer, PathConstReference( instance->path() ) ), instance ) ).second;
|
||||||
m_instances.insert( InstanceMap::value_type( key_type( observer, PathConstReference( instance->path() ) ), instance ) );
|
ASSERT_MESSAGE( inserted, "InstanceSet::insert - element already exists" );
|
||||||
}
|
}
|
||||||
scene::Instance* erase( scene::Instantiable::Observer* observer, const scene::Path& path ){
|
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 ) ) );
|
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;
|
scene::Instance* instance = i->second;
|
||||||
m_instances.erase( i );
|
m_instances.erase( i );
|
||||||
return instance;
|
return instance;
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,12 @@ public:
|
||||||
ASSERT_MESSAGE( m_observers.empty(), "ModuleObservers::~ModuleObservers: observers still attached" );
|
ASSERT_MESSAGE( m_observers.empty(), "ModuleObservers::~ModuleObservers: observers still attached" );
|
||||||
}
|
}
|
||||||
void attach( ModuleObserver& observer ){
|
void attach( ModuleObserver& observer ){
|
||||||
ASSERT_MESSAGE( m_observers.find( &observer ) == m_observers.end(), "ModuleObservers::attach: cannot attach observer" );
|
const bool inserted = m_observers.insert( &observer ).second;
|
||||||
m_observers.insert( &observer );
|
ASSERT_MESSAGE( inserted, "ModuleObservers::attach: cannot attach observer" );
|
||||||
}
|
}
|
||||||
void detach( ModuleObserver& observer ){
|
void detach( ModuleObserver& observer ){
|
||||||
ASSERT_MESSAGE( m_observers.find( &observer ) != m_observers.end(), "ModuleObservers::detach: cannot detach observer" );
|
const bool erased = m_observers.erase( &observer );
|
||||||
m_observers.erase( &observer );
|
ASSERT_MESSAGE( erased, "ModuleObservers::detach: cannot detach observer" );
|
||||||
}
|
}
|
||||||
void realise(){
|
void realise(){
|
||||||
for ( Observers::iterator i = m_observers.begin(); i != m_observers.end(); ++i )
|
for ( Observers::iterator i = m_observers.begin(); i != m_observers.end(); ++i )
|
||||||
|
|
|
||||||
|
|
@ -424,12 +424,12 @@ typedef std::set<TargetableInstance*> TargetableInstances;
|
||||||
TargetableInstances m_instances;
|
TargetableInstances m_instances;
|
||||||
public:
|
public:
|
||||||
void attach( TargetableInstance& instance ){
|
void attach( TargetableInstance& instance ){
|
||||||
ASSERT_MESSAGE( m_instances.find( &instance ) == m_instances.end(), "cannot attach instance" );
|
const bool inserted = m_instances.insert( &instance ).second;
|
||||||
m_instances.insert( &instance );
|
ASSERT_MESSAGE( inserted, "cannot attach instance" );
|
||||||
}
|
}
|
||||||
void detach( TargetableInstance& instance ){
|
void detach( TargetableInstance& instance ){
|
||||||
ASSERT_MESSAGE( m_instances.find( &instance ) != m_instances.end(), "cannot detach instance" );
|
const bool erased = m_instances.erase( &instance );
|
||||||
m_instances.erase( &instance );
|
ASSERT_MESSAGE( erased, "cannot detach instance" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderSolid( Renderer& renderer, const VolumeTest& volume ) const {
|
void renderSolid( Renderer& renderer, const VolumeTest& volume ) const {
|
||||||
|
|
|
||||||
|
|
@ -96,13 +96,13 @@ void addFilter( Filter& filter, int mask ){
|
||||||
g_filters.back().update();
|
g_filters.back().update();
|
||||||
}
|
}
|
||||||
void registerFilterable( Filterable& filterable ){
|
void registerFilterable( Filterable& filterable ){
|
||||||
ASSERT_MESSAGE( g_filterables.find( &filterable ) == g_filterables.end(), "filterable already registered" );
|
|
||||||
filterable.updateFiltered();
|
filterable.updateFiltered();
|
||||||
g_filterables.insert( &filterable );
|
const bool inserted = g_filterables.insert( &filterable ).second;
|
||||||
|
ASSERT_MESSAGE( inserted, "filterable already registered" );
|
||||||
}
|
}
|
||||||
void unregisterFilterable( Filterable& filterable ){
|
void unregisterFilterable( Filterable& filterable ){
|
||||||
ASSERT_MESSAGE( g_filterables.find( &filterable ) != g_filterables.end(), "filterable not registered" );
|
const bool erased = g_filterables.erase( &filterable );
|
||||||
g_filterables.erase( &filterable );
|
ASSERT_MESSAGE( erased, "filterable not registered" );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1437,13 +1437,13 @@ void changed( LightCullable& cullable ){
|
||||||
( *i ).second.lightsChanged();
|
( *i ).second.lightsChanged();
|
||||||
}
|
}
|
||||||
void attach( RendererLight& light ){
|
void attach( RendererLight& light ){
|
||||||
ASSERT_MESSAGE( m_lights.find( &light ) == m_lights.end(), "light could not be attached" );
|
const bool inserted = m_lights.insert( &light ).second;
|
||||||
m_lights.insert( &light );
|
ASSERT_MESSAGE( inserted, "light could not be attached" );
|
||||||
changed( light );
|
changed( light );
|
||||||
}
|
}
|
||||||
void detach( RendererLight& light ){
|
void detach( RendererLight& light ){
|
||||||
ASSERT_MESSAGE( m_lights.find( &light ) != m_lights.end(), "light could not be detached" );
|
const bool erased = m_lights.erase( &light );
|
||||||
m_lights.erase( &light );
|
ASSERT_MESSAGE( erased, "light could not be detached" );
|
||||||
changed( light );
|
changed( light );
|
||||||
}
|
}
|
||||||
void changed( RendererLight& light ){
|
void changed( RendererLight& light ){
|
||||||
|
|
@ -1467,13 +1467,13 @@ mutable bool m_traverseRenderablesMutex;
|
||||||
// renderables
|
// renderables
|
||||||
void attachRenderable( const Renderable& renderable ){
|
void attachRenderable( const Renderable& renderable ){
|
||||||
ASSERT_MESSAGE( !m_traverseRenderablesMutex, "attaching renderable during traversal" );
|
ASSERT_MESSAGE( !m_traverseRenderablesMutex, "attaching renderable during traversal" );
|
||||||
ASSERT_MESSAGE( m_renderables.find( &renderable ) == m_renderables.end(), "renderable could not be attached" );
|
const bool inserted = m_renderables.insert( &renderable ).second;
|
||||||
m_renderables.insert( &renderable );
|
ASSERT_MESSAGE( inserted, "renderable could not be attached" );
|
||||||
}
|
}
|
||||||
void detachRenderable( const Renderable& renderable ){
|
void detachRenderable( const Renderable& renderable ){
|
||||||
ASSERT_MESSAGE( !m_traverseRenderablesMutex, "detaching renderable during traversal" );
|
ASSERT_MESSAGE( !m_traverseRenderablesMutex, "detaching renderable during traversal" );
|
||||||
ASSERT_MESSAGE( m_renderables.find( &renderable ) != m_renderables.end(), "renderable could not be detached" );
|
const bool erased = m_renderables.erase( &renderable );
|
||||||
m_renderables.erase( &renderable );
|
ASSERT_MESSAGE( erased, "renderable could not be detached" );
|
||||||
}
|
}
|
||||||
void forEachRenderable( const RenderableCallback& callback ) const {
|
void forEachRenderable( const RenderableCallback& callback ) const {
|
||||||
ASSERT_MESSAGE( !m_traverseRenderablesMutex, "for-each during traversal" );
|
ASSERT_MESSAGE( !m_traverseRenderablesMutex, "for-each during traversal" );
|
||||||
|
|
|
||||||
|
|
@ -340,12 +340,12 @@ void clear(){
|
||||||
trackersClear();
|
trackersClear();
|
||||||
}
|
}
|
||||||
void trackerAttach( UndoTracker& tracker ){
|
void trackerAttach( UndoTracker& tracker ){
|
||||||
ASSERT_MESSAGE( m_trackers.find( &tracker ) == m_trackers.end(), "undo tracker already attached" );
|
const bool inserted = m_trackers.insert( &tracker ).second;
|
||||||
m_trackers.insert( &tracker );
|
ASSERT_MESSAGE( inserted, "undo tracker already attached" );
|
||||||
}
|
}
|
||||||
void trackerDetach( UndoTracker& tracker ){
|
void trackerDetach( UndoTracker& tracker ){
|
||||||
ASSERT_MESSAGE( m_trackers.find( &tracker ) != m_trackers.end(), "undo tracker cannot be detached" );
|
const bool erased = m_trackers.erase( &tracker );
|
||||||
m_trackers.erase( &tracker );
|
ASSERT_MESSAGE( erased, "undo tracker cannot be detached" );
|
||||||
}
|
}
|
||||||
void trackersClear() const {
|
void trackersClear() const {
|
||||||
for ( Trackers::const_iterator i = m_trackers.begin(); i != m_trackers.end(); ++i )
|
for ( Trackers::const_iterator i = m_trackers.begin(); i != m_trackers.end(); ++i )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user