Version 11 (modified by landauf, 8 years ago) (diff) |
---|
ClassIdentifier
Important: The ClassIdentifier is derived from Identifier. Read the related Wiki-page to learn about all inherited features and functions.
- Go to the Identifier
Description
The ClassIdentifier is a Template and a Singleton, derived from Identifier, with two important tasks:
- Doing some class-specific stuff
- Fast and easy link to the Identifier of a class
Uniqueness
Specially the second point is of major importance: ClassIdentifier is a singleton, meaning there's only one instance of ClassIdentifier<T> for every T. This allows you to get the Identifier of any class by calling ClassIdentifier<classname>::getIdentifier():
Identifier* identifier = ClassIdentifier<SomeClass>::getIdentifier();
This is in fact just what the Class(classname) macro in CoreIncludes does.
To assure uniqueness even in different libraries, a ClassIdentifier has to register in a map. If the Identifier for a specific class already exists, the second ClassIdentifier will just refer to the first one.