Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Data Fields | Static Public Attributes | Private Member Functions | Static Private Member Functions
boostx::registrar< T, REGISTRY, ARGS > Struct Template Reference

Registrar mixin class which holds flag of registered class, to be derived from T. More...

#include <factory.hpp>

Collaboration diagram for boostx::registrar< T, REGISTRY, ARGS >:
Collaboration graph
[legend]

Public Types

typedef REGISTRY registry_type
 Typedef for registry. More...
 
typedef registry_type::key_type key_type
 Gets key type from registry. More...
 
typedef
registry_type::interface_type 
interface_type
 Gets interface type from registry. More...
 
typedef
registry_type::template
typeinfo_type< T > 
typeinfo_type
 Get type info type from registry. More...
 

Public Member Functions

 registrar ()
 Constructor of registrar registeres the object if not already registered. More...
 

Data Fields

friend registry_type
 Friend of registry so registry can access registrar's private functions. More...
 

Static Public Attributes

static registrarinstance_ = registrar<T,R,ARGS...>::instance()
 This static instance is responsible for auto registration. More...
 

Private Member Functions

registraroperator= (const registrar &)
 Overload assignment operator so no copying is possible. More...
 

Static Private Member Functions

static bool registered ()
 The class is registered when the instance is not a null pointer. More...
 
static interface_typecreate (const ARGS &..._args)
 Create an instance of the interface and return raw pointer. More...
 
static decltype(typeinfo_type()()) type_id ()
 Return type id by calling the call operator of type info template. More...
 
static registrarinstance ()
 Holds the instance which cares about auto registration. More...
 

Detailed Description

template<typename T, typename REGISTRY, typename... ARGS>
struct boostx::registrar< T, REGISTRY, ARGS >

Registrar mixin class which holds flag of registered class, to be derived from T.

Template Parameters
Ttype of derived class
REGISTRYtype of registry the registrar class uses
...ARGSTemplate parameter which comply to the constructor signature of the interface

Member Typedef Documentation

template<typename T , typename REGISTRY , typename... ARGS>
typedef registry_type::interface_type boostx::registrar< T, REGISTRY, ARGS >::interface_type

Gets interface type from registry.

template<typename T , typename REGISTRY , typename... ARGS>
typedef registry_type::key_type boostx::registrar< T, REGISTRY, ARGS >::key_type

Gets key type from registry.

template<typename T , typename REGISTRY , typename... ARGS>
typedef REGISTRY boostx::registrar< T, REGISTRY, ARGS >::registry_type

Typedef for registry.

template<typename T , typename REGISTRY , typename... ARGS>
typedef registry_type::template typeinfo_type<T> boostx::registrar< T, REGISTRY, ARGS >::typeinfo_type

Get type info type from registry.

Constructor & Destructor Documentation

template<typename T , typename REGISTRY , typename... ARGS>
boostx::registrar< T, REGISTRY, ARGS >::registrar ( )
inline

Constructor of registrar registeres the object if not already registered.

163  {
164  if (!registered()) registry_type::template reg<T>(type_id());
165  }
static bool registered()
The class is registered when the instance is not a null pointer.
Definition: factory.hpp:175
static decltype(typeinfo_type()()) type_id()
Return type id by calling the call operator of type info template.
Definition: factory.hpp:187

Member Function Documentation

template<typename T , typename REGISTRY , typename... ARGS>
static interface_type* boostx::registrar< T, REGISTRY, ARGS >::create ( const ARGS &...  _args)
inlinestaticprivate

Create an instance of the interface and return raw pointer.

182  {
183  return new T(_args...);
184  }
template<typename T , typename REGISTRY , typename... ARGS>
static registrar* boostx::registrar< T, REGISTRY, ARGS >::instance ( )
inlinestaticprivate

Holds the instance which cares about auto registration.

194  {
195  static registrar theInstance;
196  instance_ = &theInstance;
197  return instance_;
198  }
registrar()
Constructor of registrar registeres the object if not already registered.
Definition: factory.hpp:162
static registrar * instance_
This static instance is responsible for auto registration.
Definition: factory.hpp:159
template<typename T , typename REGISTRY , typename... ARGS>
registrar& boostx::registrar< T, REGISTRY, ARGS >::operator= ( const registrar< T, REGISTRY, ARGS > &  )
inlineprivate

Overload assignment operator so no copying is possible.

170  {
171  return *this;
172  }
template<typename T , typename REGISTRY , typename... ARGS>
static bool boostx::registrar< T, REGISTRY, ARGS >::registered ( )
inlinestaticprivate

The class is registered when the instance is not a null pointer.

176  {
177  return instance_ != nullptr;
178  }
static registrar * instance_
This static instance is responsible for auto registration.
Definition: factory.hpp:159
template<typename T , typename REGISTRY , typename... ARGS>
static decltype(typeinfo_type()()) boostx::registrar< T, REGISTRY, ARGS >::type_id ( )
inlinestaticprivate

Return type id by calling the call operator of type info template.

188  {
189  return typeinfo_type()();
190  }
registry_type::template typeinfo_type< T > typeinfo_type
Get type info type from registry.
Definition: factory.hpp:153

Field Documentation

template<typename T , typename REGISTRY , typename... ARGS>
registrar< T, R, ARGS...> * boostx::registrar< T, R, ARGS >::instance_ = registrar<T,R,ARGS...>::instance()
static

This static instance is responsible for auto registration.

Our static instance.

template<typename T , typename REGISTRY , typename... ARGS>
friend boostx::registrar< T, REGISTRY, ARGS >::registry_type

Friend of registry so registry can access registrar's private functions.


The documentation for this struct was generated from the following file: