Hydra 0.20
hydra::Registry< BASE > Class Template Reference

#include <Registry.h>

List of all members.

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)

Detailed Description

template<class BASE>
class hydra::Registry< BASE >

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:

  • typedef Registry<ThatBase> registry_type
  • static registry_type registry
  • make sure your dtor is virtual

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

Author:
Aleksander Demko

Member Function Documentation

template<class BASE >
std::shared_ptr<BASE> hydra::Registry< BASE >::create ( size_t  index) [inline]

Instatite the registered type.

Author:
Aleksander Demko
template<class BASE >
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.

Author:
Aleksander Demko
template<class BASE >
size_t hydra::Registry< BASE >::size ( void  ) [inline]

Returns the number of currently registered types in this registry.

Author:
Aleksander Demko

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables