library/utility/factory.hh

namespace scarab

The standard scarab namespace.

Functions

scarab::LOGGER(slog_fact, "factory")
template <class XBaseType, typename… XArgs>
class base_registrar
#include <factory.hh>

Public Functions

base_registrar()
virtual ~base_registrar()

Protected Functions

virtual XBaseType *create(XArgs... args) const = 0

Friends

friend scarab::factory< XBaseType, XArgs... >
template <class XBaseType>
template<>
class base_registrar<XBaseType, void>
#include <factory.hh>

Public Functions

base_registrar()
virtual ~base_registrar()

Protected Functions

virtual XBaseType *create() const = 0

Friends

friend scarab::factory< XBaseType >
template <class XBaseType, typename… XArgs>
class factory
#include <factory.hh>

Inherits from singleton< factory< XBaseType, XArgs… > >

Public Types

typedef std::map<std::string, const base_registrar<XBaseType, XArgs...> *> FactoryMap
typedef FactoryMap::value_type FactoryEntry
typedef FactoryMap::iterator FactoryIt
typedef FactoryMap::const_iterator FactoryCIt

Public Functions

XBaseType *create(const std::string &a_class_name, XArgs... args)
XBaseType *create(const FactoryCIt &iter, XArgs... args)
void register_class(const std::string &a_class_name, const base_registrar<XBaseType, XArgs...> *base_registrar)
bool has_class(const std::string &a_class_name) const
void remove_class(const std::string &a_class_name)
factory<XBaseType, XArgs...>::FactoryCIt begin() const
factory<XBaseType, XArgs...>::FactoryCIt end() const

Protected Functions

allow_singleton_access(factory)
factory()
~factory()

Protected Attributes

FactoryMap *fMap
std::mutex f_factory_mutex
template <class XBaseType>
template<>
class factory<XBaseType, void>
#include <factory.hh>

Inherits from singleton< factory< XBaseType > >

Public Types

typedef std::map<std::string, const base_registrar<XBaseType> *> FactoryMap
typedef FactoryMap::value_type FactoryEntry
typedef FactoryMap::iterator FactoryIt
typedef FactoryMap::const_iterator FactoryCIt

Public Functions

XBaseType *create(const std::string &a_class_name)
XBaseType *create(const FactoryCIt &iter)
void register_class(const std::string &a_class_name, const base_registrar<XBaseType> *base_registrar)
bool has_class(const std::string &a_class_name) const
void remove_class(const std::string &a_class_name)
factory<XBaseType, void>::FactoryCIt begin() const
factory<XBaseType, void>::FactoryCIt end() const

Protected Functions

factory()
~factory()

Protected Attributes

FactoryMap *fMap
std::mutex f_factory_mutex

Friends

friend scarab::singleton< factory >
friend scarab::destroyer< factory >
template <class XBaseType, class XDerivedType, typename… XArgs>
class registrar
#include <factory.hh>

Inherits from base_registrar< XBaseType, XArgs… >

Public Functions

registrar(const std::string &a_class_name)
~registrar()

Protected Functions

void register_class(const std::string &a_class_name) const
XBaseType *create(XArgs... args) const

Protected Attributes

std::string f_class_name
template <class XBaseType, class XDerivedType>
template<>
class registrar<XBaseType, XDerivedType, void>
#include <factory.hh>

Inherits from base_registrar< XBaseType >

Public Functions

registrar(const std::string &a_class_name)
~registrar()

Protected Functions

void register_class(const std::string &a_class_name) const
XBaseType *create() const

Protected Attributes

std::string f_class_name