EzGL
Public Types | Static Public Member Functions
EzGL::ComponentFactory Class Referencefinal

Component enlister and smart pointer factory. More...

#include <ComponentFactory.hpp>

Public Types

using Key = std::string
 Component key type. More...
 

Static Public Member Functions

static ComponentPtr Create (Key const &key)
 Component smart pointer creator. More...
 
template<typename T >
static ComponentVec Create (T const &keys)
 Component container creator. More...
 
template<class T >
static Key Enlist (Key const &key)
 Component enlister. More...
 

Detailed Description

Component enlister and smart pointer factory.

Component developers need only to worry about the enlisting capabilities of this class. Component creation is Object's responsability.

Member Typedef Documentation

◆ Key

using EzGL::ComponentFactory::Key = std::string

Component key type.

Component keys are essentially the name of the component we will use when refering to it during enlistment and creation.

Member Function Documentation

◆ Create() [1/2]

ComponentPtr EzGL::ComponentFactory::Create ( Key const &  key)
static

Component smart pointer creator.

Parameters
keyKey of the desired component.
Returns
A smart pointer to the newly created component.

◆ Create() [2/2]

template<typename T >
static ComponentVec EzGL::ComponentFactory::Create ( T const &  keys)
inlinestatic

Component container creator.

Template Parameters
TContainer of keys with iterator support.
Parameters
keysKeys of the desired components.
Returns
A container of smart pointers to the newly created components.

◆ Enlist()

template<class T >
static Key EzGL::ComponentFactory::Enlist ( Key const &  key)
inlinestatic

Component enlister.

It is NOT RECOMMENDED for you to call this directly. Use the EZGL_COMPONENT_ENLIST macro, it will do a lot of the work for you as well as make sure that your component gets enlisted before anyone attempts to create it.

Template Parameters
TName of the component class being enlisted.
Parameters
keyKey that should be associated with the component.
Returns
Same value as the key parameter.

The documentation for this class was generated from the following files: