00001 #ifndef __LOUT_OBJECTX_HH__ 00002 #define __LOUT_OBJECTX_HH__ 00003 00004 #include "object.hh" 00005 #include "container.hh" 00006 #include "signal.hh" 00007 00012 namespace lout { 00013 00014 namespace identity { 00015 00099 class IdentifiableObject: public object::Object 00100 { 00101 private: 00102 class Class: public object::Object 00103 { 00104 public: 00105 Class *parent; 00106 int id; 00107 const char *className; 00108 00109 Class (Class *parent, int id, const char *className); 00110 }; 00111 00112 static container::typed::HashTable <object::ConstString, 00113 Class> *classesByName; 00114 static container::typed::Vector <Class> *classesById; 00115 static Class *currentlyConstructedClass; 00116 00117 int classId; 00118 00119 protected: 00120 void registerName (const char *className, int *classId); 00121 00122 public: 00123 IdentifiableObject (); 00124 00125 virtual void intoStringBuffer(misc::StringBuffer *sb); 00126 00133 int getClassId () { return classId; } 00134 00139 const char *getClassName() { return classesById->get(classId)->className; } 00140 00141 bool instanceOf (int otherClassId); 00142 }; 00143 00144 } // namespace identity 00145 00146 } // namespace lout 00147 00148 #endif // __LOUT_OBJECTX_HH__
1.5.9