Dillo v3.1.1-14-g8f67d6e0
Loading...
Searching...
No Matches
identity.hh
Go to the documentation of this file.
1#ifndef __LOUT_OBJECTX_HH__
2#define __LOUT_OBJECTX_HH__
3
4#include "object.hh"
5#include "container.hh"
6#include "signal.hh"
7
8namespace lout {
9
13namespace identity {
14
99{
100private:
101 class Class: public object::Object
102 {
103 public:
105 int id;
106 const char *className;
107
108 Class (Class *parent, int id, const char *className);
109
111 };
112
115 static container::typed::Vector <Class> *classesById;
117
119
120protected:
121 void registerName (const char *className, int *classId);
122
123public:
125
127
134 int getClassId () { return classId; }
135
140 const char *getClassName() { return classesById->get(classId)->className; }
141
142 bool instanceOf (int otherClassId);
143};
144
145} // namespace identity
146
147} // namespace lout
148
149#endif // __LOUT_OBJECTX_HH__
Typed version of container::untyped::HashTable.
Definition container.hh:536
void intoStringBuffer(misc::StringBuffer *sb)
Store a textual representation of the object in a misc::StringBuffer.
Definition identity.cc:42
Instances of classes, which are sub classes of this class, may be identified at run-time.
Definition identity.hh:99
static container::typed::HashTable< object::ConstString, Class > * classesByName
Definition identity.hh:114
static Class * currentlyConstructedClass
Definition identity.hh:116
int getClassId()
Returns the class identifier.
Definition identity.hh:134
bool instanceOf(int otherClassId)
Returns, whether this class is an instance of the class, given by otherClassId, or of a sub class of ...
Definition identity.cc:105
static container::typed::Vector< Class > * classesById
Definition identity.hh:115
const char * getClassName()
Return the name, under which the class of this object was registered.
Definition identity.hh:140
void registerName(const char *className, int *classId)
This method must be called in the constructor for the sub class.
Definition identity.cc:83
void intoStringBuffer(misc::StringBuffer *sb)
Store a textual representation of the object in a misc::StringBuffer.
Definition identity.cc:70
A class for fast concatenation of a large number of strings.
Definition misc.hh:566
An object::Object wrapper for constant strings (char*).
Definition object.hh:163
This is the base class for many other classes, which defines very common virtual methods.
Definition object.hh:25