template<class T>
eckit::Factory class

Public types

using key_t = std::string
using product_t = T
using builder_t = product_t::builder_t
using builder_ptr = builder_t*
using storage_t = std::map<key_t, builder_ptr>

Public static functions

static auto instance() -> Factory<T>&
static auto build_type() -> std::string

Public functions

auto exists(const key_t& k) const -> bool
void regist(const key_t&, builder_ptr)
void unregist(const key_t&)
auto get(const key_t& name) const -> const builder_t&
auto size() const -> size_t
auto keys() const -> std::vector<key_t>

Friends

auto operator<<(std::ostream& os, const Factory<T>& o) -> std::ostream&

Function documentation

template<class T>
static Factory<T>& eckit::Factory<T>::instance()

Returns the instance of this singleton factory

template<class T>
static std::string eckit::Factory<T>::build_type()

Returns class name of the type built by this factory

template<class T>
bool eckit::Factory<T>::exists(const key_t& k) const

Checks if a builder is registered

template<class T>
void eckit::Factory<T>::regist(const key_t&, builder_ptr)

Exceptions
BadParameter if the builder already registered

Registers a builder

template<class T>
void eckit::Factory<T>::unregist(const key_t&)

Exceptions
BadParameter if the builder is not registered

Remove a registered builder

template<class T>
const builder_t& eckit::Factory<T>::get(const key_t& name) const

Parameters
name of the builder

Gets the builder registered to the associated key

template<class T>
size_t eckit::Factory<T>::size() const

Returns the number of builders registered to the factory