diff --git a/include/dynamic-graph/factory.h b/include/dynamic-graph/factory.h index 5e3bdf4ba1c1e603da3d47e26bc12aae0d222cef..e0027977c7fb646c9bc6a16f9ffb2bb1465617a6 100644 --- a/include/dynamic-graph/factory.h +++ b/include/dynamic-graph/factory.h @@ -28,7 +28,7 @@ /* --- STD --- */ #include <map> #include <string> - +#include <vector> /* --- DYNAMIC-GRAPH --- */ #include <dynamic-graph/exception-factory.h> #include <dynamic-graph/dynamic-graph-api.h> @@ -70,7 +70,9 @@ class DYNAMICGRAPH_EXPORT FactoryStorage 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 ); - + /// 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, std::ostream& os ); diff --git a/src/dgraph/factory.cpp b/src/dgraph/factory.cpp index a9fbf75bb45432eadd5ad322bcb88f865a82c061..637c0292fb908fc93916e017d706dc2b20bf1f05 100644 --- a/src/dgraph/factory.cpp +++ b/src/dgraph/factory.cpp @@ -118,6 +118,15 @@ existEntity( const std::string& name ) 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 ----------------------------------------------------- */ /* --------------------------------------------------------------------- */