|
|
Stores key object pairs. More...
#include <ArmarXCore/core/util/Registrar.h>
Classes | |
| struct | RegisterElement |
| Registers the object passed to the constructor. More... | |
Public Types | |
| using | ContainerType = std::unordered_map< KeyType, RegisteredType > |
Static Public Member Functions | |
| static const RegisteredType & | get (const KeyType &key) |
| Returns the registered object for the given key. More... | |
| static std::vector< KeyType > | getKeys () |
| Retrieves the list of all registered elements. More... | |
| static bool | has (const KeyType &key) |
| static void | registerElement (const KeyType &key, RegisteredType element) |
| Registers an element. More... | |
Stores key object pairs.
The third template parameter offers the option to tag this registrar with a class.
If polymorphic objects are required use a base class and unique pointers. E.g.:
If functions are stored use std::function (or function pointers).
To register elements on file inclusion use this code in the header (note the missing static).
Example for strings
Definition at line 62 of file Registrar.h.
| using ContainerType = std::unordered_map<KeyType, RegisteredType> |
Definition at line 65 of file Registrar.h.
|
inlinestatic |
Returns the registered object for the given key.
| key | The object's key. |
Definition at line 85 of file Registrar.h.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinestatic |
Retrieves the list of all registered elements.
Definition at line 119 of file Registrar.h.
Here is the caller graph for this function:
|
inlinestatic |
|
inlinestatic |
Registers an element.
| key | The element's key. |
| element | The element. |
Definition at line 108 of file Registrar.h.
Here is the caller graph for this function: