From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a02348.html | 320 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 320 insertions(+) create mode 100644 docs/doxygen/nel/a02348.html (limited to 'docs/doxygen/nel/a02348.html') diff --git a/docs/doxygen/nel/a02348.html b/docs/doxygen/nel/a02348.html new file mode 100644 index 00000000..176ad032 --- /dev/null +++ b/docs/doxygen/nel/a02348.html @@ -0,0 +1,320 @@ + + +NeL: NLMISC::CClassRegistry class Reference + + + +
+

NLMISC::CClassRegistry Class Reference

#include <class_registry.h> +

+


Detailed Description

+The Class registry where we can instanciate IClassable objects from their names.
Author:
Lionel Berenguier

+Nevrax France

+
Date:
2000
+ +

+ +

+Definition at line 88 of file class_registry.h. + + + + + + + + + + + + + + + + + + + + + +

Static Public Member Functions

bool checkObject (IClassable *obj)
 check if the object has been correctly registered. Must be used for debug only, and Must compile with RTTI.

IClassablecreate (const std::string &className) throw (ERegistry)
 Create an object from his class name.

void registerClass (const std::string &className, IClassable *(*creator)(), const std::string &typeidCheck) throw (ERegistry)
 Register your class for future Instanciation.


Private Types

typedef std::hash_map< std::string,
+ CClassNode
TClassMap

Static Private Member Functions

void init ()
 Inits the ClassRegistry (especially RegistredClasses).


Static Private Attributes

TClassMapRegistredClasses = NULL
+


Member Typedef Documentation

+

+ + + + +
+ + +
typedef std::hash_map<std::string, CClassNode> NLMISC::CClassRegistry::TClassMap [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 108 of file class_registry.h. +

+Referenced by init().

+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
bool NLMISC::CClassRegistry::checkObject IClassable obj  )  [static]
+
+ + + + + +
+   + + +

+check if the object has been correctly registered. Must be used for debug only, and Must compile with RTTI. +

+ +

+Definition at line 91 of file class_registry.cpp. +

+References NLMISC::IClassable::getClassName(), init(), and RegistredClasses. +

+

00092 {
+00093         init();
+00094 
+00095         TClassMap::iterator     it;     
+00096         it=RegistredClasses->find(obj->getClassName());
+00097         if(it==RegistredClasses->end())
+00098                 return false;   
+00099 
+00100         if( it->second.TypeIdCheck != string(typeid(*obj).name()) )
+00101                 return false;
+00102 
+00103         return true;
+00104 }
+
+

+ + + + +
+ + + + + + + + + + +
IClassable * NLMISC::CClassRegistry::create const std::string &  className  )  throw (ERegistry) [static]
+
+ + + + + +
+   + + +

+Create an object from his class name. +

+ +

+Definition at line 51 of file class_registry.cpp. +

+References nlassert. +

+

00052 {
+00053         init();
+00054 
+00055         TClassMap::iterator     it;     
+00056         
+00057         it=RegistredClasses->find(className);
+00058 
+00059         if(it==RegistredClasses->end())
+00060                 return NULL;
+00061         else
+00062         {
+00063                 IClassable      *ptr;
+00064                 ptr=it->second.Creator();
+00065                 #ifdef NL_DEBUG
+00066                         nlassert(CClassRegistry::checkObject(ptr));
+00067                 #endif
+00068                 return ptr;
+00069         }
+00070 
+00071 }
+
+

+ + + + +
+ + + + + + + + + +
void NLMISC::CClassRegistry::init  )  [static, private]
+
+ + + + + +
+   + + +

+Inits the ClassRegistry (especially RegistredClasses). +

+ +

+Definition at line 43 of file class_registry.cpp. +

+References RegistredClasses, and TClassMap. +

+Referenced by checkObject(). +

+

00044 {
+00045         if (RegistredClasses == NULL)
+00046                 RegistredClasses = new TClassMap;
+00047 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NLMISC::CClassRegistry::registerClass const std::string &  className,
IClassable *(*  creator)(),
const std::string &  typeidCheck
throw (ERegistry) [static]
+
+ + + + + +
+   + + +

+Register your class for future Instanciation. +

+ +

+Definition at line 74 of file class_registry.cpp. +

+References NLMISC::CClassRegistry::CClassNode::Creator, nlstop, and NLMISC::CClassRegistry::CClassNode::TypeIdCheck. +

+

00075 {
+00076         init();
+00077 
+00078         CClassNode      node;   
+00079         node.Creator=creator;
+00080         node.TypeIdCheck= typeidCheck;
+00081         std::pair<TClassMap::iterator, bool> result;
+00082         result = RegistredClasses->insert(TClassMap::value_type(className, node));
+00083         if(!result.second)
+00084         {
+00085                 nlstop;
+00086                 throw ERegisteredClass();
+00087         }       
+00088 }
+
+


Field Documentation

+

+ + + + +
+ + +
CClassRegistry::TClassMap * NLMISC::CClassRegistry::RegistredClasses = NULL [static, private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 39 of file class_registry.cpp. +

+Referenced by checkObject(), and init().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 13:06:15 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1