void SimGroup::clear() { lock(); while( size() > 0 ) { SimObject* object = objectList.last(); object->onGroupRemove(); objectList.pop_back(); mNameDictionary.remove( object ); object->mGroup = 0; getSetModificationSignal().trigger( SetObjectRemoved, this, object ); if( object->isProperlyAdded() ) onObjectRemoved_callback( object ); if( engineAPI::gUseConsoleInterop ) object->deleteObject(); else object->decRefCount(); } unlock(); getSetModificationSignal().trigger( SetCleared, this, NULL ); }
void SimGroup::popObject() { MutexHandle handle; handle.lock( mMutex ); if( objectList.empty() ) { AssertWarn( false, "SimGroup::popObject - Stack underflow" ); return; } SimObject* object = objectList.last(); objectList.pop_back(); object->onGroupRemove(); object->mGroup = NULL; clearNotify( object ); mNameDictionary.remove( object ); getSetModificationSignal().trigger( SetObjectAdded, this, object ); if( object->isProperlyAdded() ) onObjectRemoved_callback( object ); object->decRefCount(); }