Revision: 8507 http://playerstage.svn.sourceforge.net/playerstage/?rev=8507&view=rev Author: hsujohnhsu Date: 2010-01-15 09:41:16 +0000 (Fri, 15 Jan 2010)
Log Message: ----------- adding back fundtion World::ProcessEntitiesToDelete() Modified Paths: -------------- code/gazebo/trunk/server/World.cc code/gazebo/trunk/server/World.hh Modified: code/gazebo/trunk/server/World.cc =================================================================== --- code/gazebo/trunk/server/World.cc 2010-01-15 09:39:55 UTC (rev 8506) +++ code/gazebo/trunk/server/World.cc 2010-01-15 09:41:16 UTC (rev 8507) @@ -508,6 +508,32 @@ } //////////////////////////////////////////////////////////////////////////////// +// Load all the entities that have been queued +void World::ProcessEntitiesToDelete() +{ + if (!this->toDeleteModels.empty()) + { + // maybe try try_lock here instead + boost::recursive_mutex::scoped_lock lock(*Simulator::Instance()->GetMDMutex()); + + // Remove and delete all models that are marked for deletion + std::vector< Model* >::iterator miter; + for (miter=this->toDeleteModels.begin(); + miter!=this->toDeleteModels.end(); miter++) + { + //std::cerr << "ProcessEngitiesToDelete " << (*miter)->GetName() << std::endl; + (*miter)->Fini(); + this->models.erase( + std::remove(this->models.begin(), this->models.end(), *miter) ); + delete (*miter); + } + + this->toDeleteModels.clear(); + } + +} + +//////////////////////////////////////////////////////////////////////////////// /// Delete an entity by name void World::DeleteEntity(const char *name) { Modified: code/gazebo/trunk/server/World.hh =================================================================== --- code/gazebo/trunk/server/World.hh 2010-01-15 09:39:55 UTC (rev 8506) +++ code/gazebo/trunk/server/World.hh 2010-01-15 09:41:16 UTC (rev 8507) @@ -149,6 +149,9 @@ /// \brief Load all the entities that have been queued public: void ProcessEntitiesToLoad(); + /// \brief Delete all the entities that have been queued + public: void ProcessEntitiesToDelete(); + /// \brief Delete an entity by name /// \param name The name of the entity to delete public: void DeleteEntity(const char *name); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ Playerstage-commit mailing list Playerstage-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/playerstage-commit