Planet
navihomeaboutscreenshotsdownloaddevelopmentforum

ClassIdentifier


Important: The ClassIdentifier is derived from Identifier. Read the related Wiki-page to learn about all inherited features and functions.


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.