From 681b9484d5978b25039b558597955226cdcd5a1e Mon Sep 17 00:00:00 2001
From: florent <florent@laas.fr>
Date: Mon, 18 Oct 2010 21:56:01 +0200
Subject: [PATCH] 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.
---
 include/dynamic-graph/factory.h | 6 ++++--
 src/dgraph/factory.cpp          | 9 +++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/include/dynamic-graph/factory.h b/include/dynamic-graph/factory.h
index 5e3bdf4..e002797 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 a9fbf75..637c029 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 ----------------------------------------------------- */
 /* --------------------------------------------------------------------- */
-- 
GitLab