X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/92d7eb81980a40dda0715b23e874a1537cf3adb8..3a1185f2c9e5bc9c13c7d94c3c03cd45fb02f13e:/named_object_list.h?ds=inline

diff --git a/named_object_list.h b/named_object_list.h
index 2c91263..94d281e 100644
--- a/named_object_list.h
+++ b/named_object_list.h
@@ -4,6 +4,17 @@
 #include <map>
 #include <string>
 
+// Define an associative container that maps a name with a class and a
+// description.  All classes must be derived from a same base class.
+//
+// We can then use the name to create an object of the associated
+// class, and to retrieve a pointer to this object.
+//
+// Furthermore, it is possible to iterate over the elements to get
+// their name and their description.
+
+// I am too lazy to comment the code, which should be obvious...
+
 //===== arity 0 =====
 
 template <typename Base>
@@ -56,11 +67,6 @@ public:
             return NULL;
     }
 
-    Base* new_instance(const char* name) const
-    {
-        return new_instance(std::string(name));
-    }
-
     const std::string& get_name(iterator& it) const { return it->first; }
     const std::string& get_descr(iterator& it) const
     { return it->second->description; }
@@ -125,11 +131,6 @@ public:
             return NULL;
     }
 
-    Base* new_instance(const char* name, Arg1 arg1, Arg2 arg2) const
-    {
-        return new_instance(std::string(name), arg1, arg2);
-    }
-
     const std::string& get_name(iterator& it) const { return it->first; }
     const std::string& get_descr(iterator& it) const
     { return it->second->description; }
@@ -143,6 +144,7 @@ public:
 
 //===================
 
+// "NOL" like in Named_Object_List....
 #define NOL_INSERT(name, descr, class) insert(name, new creator<class>(descr))
 
 #endif // !NAMED_OBJECT_LIST_H