Skip to content
Snippets Groups Projects
Commit 681b9484 authored by Florent Lamiraux's avatar Florent Lamiraux
Browse files

Add a method that return the list of entity types registered in factory

    * include/dynamic-graph/factory.h,
    * src/dgraph/factory.cpp: method name is FactoryStorage::listEntities.
parent 4b9ab523
No related branches found
No related tags found
No related merge requests found
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
/* --- STD --- */ /* --- STD --- */
#include <map> #include <map>
#include <string> #include <string>
#include <vector>
/* --- DYNAMIC-GRAPH --- */ /* --- DYNAMIC-GRAPH --- */
#include <dynamic-graph/exception-factory.h> #include <dynamic-graph/exception-factory.h>
#include <dynamic-graph/dynamic-graph-api.h> #include <dynamic-graph/dynamic-graph-api.h>
...@@ -70,7 +70,9 @@ class DYNAMICGRAPH_EXPORT FactoryStorage ...@@ -70,7 +70,9 @@ class DYNAMICGRAPH_EXPORT FactoryStorage
Entity* newEntity( const std::string& name,const std::string& objname ); Entity* newEntity( const std::string& name,const std::string& objname );
bool existEntity( const std::string& name, EntityMap::iterator& entPtr ); bool existEntity( const std::string& name, EntityMap::iterator& entPtr );
bool existEntity( const std::string& name ); bool existEntity( const std::string& name );
/// Return the list of Entity class names registered in the factory.
/// Class names are appended at end of output vector.
void listEntities(std::vector <std::string>& outList);
void commandLine( const std::string& cmdLine,std::istringstream& cmdArgs, void commandLine( const std::string& cmdLine,std::istringstream& cmdArgs,
std::ostream& os ); std::ostream& os );
......
...@@ -118,6 +118,15 @@ existEntity( const std::string& name ) ...@@ -118,6 +118,15 @@ existEntity( const std::string& name )
EntityMap::iterator entPtr;return existEntity( name,entPtr ); EntityMap::iterator entPtr;return existEntity( name,entPtr );
} }
void FactoryStorage::
listEntities(std::vector <std::string>& outList)
{
for (EntityMap::iterator it = entityMap.begin();
it != entityMap.end(); it++) {
outList.push_back(it->first);
}
}
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/* --- REGISTERERS ----------------------------------------------------- */ /* --- REGISTERERS ----------------------------------------------------- */
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
......
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