The Factory is a singleton that maps Identifiers with their name and their network ID. The Factory is used by the CreateFactory(classname) macro to add new entries. The ClassByString?("classname") and ClassByID(network ID) macros use the Factory to retrieve an Identifier with a given classname or a given network ID respectively. See CoreIncludes for more information.
The ClassByString? and ClassByID macros are an abbreviation of the static function Factory::getIdentifier("name" or ID). The Factory also handles the change of a network ID to avoid conflicts with ambiguous map-entries.
- getIdentifier(name) and getIdentifier(network ID) return the Identifier with the given name or the given network ID respectively.
Because the Factory knows all Identifiers with a ClassFactory, it provides functions to get the map-iterators to iterate through all stored Identifiers:
- getFactoryMap(): returns an iterator to the map.
- getFactoryMapBegin(): returns an iterator to the first Identifier in the map.
- getFactoryMapEnd(): returns an iterator to the last Identifier in the map.
- createClassHierarchy(): Creates the class hierarchy by creating an instance of all classes in the Identifier map (and destroying them afterwards).