#include <ImFusion/GL/GlObjectFactory.h>
Factory singleton for creating GlObject from string IDs.
More...
Factory singleton for creating GlObject from string IDs.
Every GlObject implements the typeName() method returning a unique string identifier for that specific type of GlObject. GlObjects have to be registered with GlObjectFactory using this string ID and a factory method for instantiating a GlObject of such type. During registration GlObjectFactory ensures the uniqueness of the registered GlObjects and otherwise raises an assertion/logs a warning.
|
|
static GlObjectFactory & | get () |
| | Returns the GlObjectFactory singleton object.
|
◆ registerObject() [1/2]
Registers a GlObject with the GlObjectFactory.
- Note
- The string IDs of GlObjects have to be unique. If you register an ID a second time, the previously registered factory method will be overwritten. Debug builds will also raise an assertion.
- Parameters
-
| id | Unique string ID for the GlObject to register. |
| factoryFunction | Method to use for instantiating the GlObject to register which takes reference data and potential objects to wrap. |
| factoryCompatibilityFunction | Method to use for checking if the GlObject can be created with given data and potential objects to wrap. |
◆ registerObject() [2/2]
Registers a GlObject with the GlObjectFactory which does not require Data of GlObjects.
- Note
- The string IDs of GlObjects have to be unique. If you register an ID a second time, the previously registered factory method will be overwritten. Debug builds will also raise an assertion.
- Parameters
-
| id | Unique string ID for the GlObject to register. |
| factoryFunction | Method to use for instantiating the GlObject to register. |
◆ canCreateObject()
Test if a GlObject can be constructed with the given ID and the provided arguments.
- Parameters
-
| id | Unique ID of the GlObject to create. |
| p | Optional pointer to a Properties object. If not 0, it will used to configure the newly created GlObject. |
| data | Data on which the GlObject relies (optional). |
| objects | GlObjects on which the GlObject relies (optional). |
◆ createObject()
Instantiates a GlObject specified by the given ID.
- Parameters
-
| id | Unique ID of the GlObject to create. |
| p | Optional pointer to a Properties object. If not 0, it will used to configure the newly created GlObject. |
| data | Data on which the GlObject relies (optional). |
| objects | GlObjects on which the GlObject relies (optional). |
The documentation for this class was generated from the following file:
- ImFusion/GL/GlObjectFactory.h