Hydra 0.20
|
#include <Registry.h>
Classes | |
class | payload_t |
Public Types | |
typedef BASE | base_type |
typedef BASE *(* | loadfunc_t )(void) |
Public Member Functions | |
template<class SUB > | |
BASE * | loadfunc_impl (void) |
void | appendFunc (loadfunc_t func, const char *name=0) |
size_t | size (void) |
std::shared_ptr< BASE > | create (size_t index) |
const char * | name (size_t index) |
This allows you to setup a load-time registering plugin system that registers objects for any purpose.
You typically make a BASE class for your plugins. In that base class, you:
The Regisiter objects will then use BASE::registry to add types. You can then inspect and instatiate registered objects via the members of BASE::registry
std::shared_ptr<BASE> hydra::Registry< BASE >::create | ( | size_t | index | ) | [inline] |
Instatite the registered type.
const char* hydra::Registry< BASE >::name | ( | size_t | index | ) | [inline] |
Returns the set name of the given registered type. Might be null if it was never set.
size_t hydra::Registry< BASE >::size | ( | void | ) | [inline] |
Returns the number of currently registered types in this registry.