Skip to content
Snippets Groups Projects
Commit dcd594f0 authored by Nicolas Mansard's avatar Nicolas Mansard
Browse files

Added a function to test for the existence of a named entity.

parent eb68f2e9
No related branches found
No related tags found
No related merge requests found
......@@ -86,6 +86,11 @@ namespace dynamicgraph
*/
Entity& getEntity (const std::string& name);
/*! \brief Test if the entity exists. */
bool existEntity (const std::string& name);
/*! \brief Test if the entity exists. If it does, return a pointer on it. */
bool existEntity (const std::string& name, Entity*& ptr);
/*! \brief Disallocate an entity.
\par[in] entname: The name of the entity,
*/
......
......@@ -115,6 +115,24 @@ getEntity( const std::string& name )
else return *entPtr->second;
}
bool PoolStorage::
existEntity (const std::string& name)
{
return entityMap.find( name ) != entityMap.end();
}
bool PoolStorage::
existEntity (const std::string& name, Entity*& ptr)
{
Entities::iterator entPtr = entityMap.find( name );
if( entPtr == entityMap.end () ) return false;
else
{
ptr = entPtr->second;
return true;
}
}
void PoolStorage::
clearPlugin( const std::string& name )
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment