libpressio 0.93.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
pressio_registry< T > Struct Template Reference

#include <pressio.h>

Public Types

using value_type = T
 
using reference = T &
 
using const_reference = T const
 

Public Member Functions

build (std::string const &name) const
 
template<class Name , class Factory >
void regsiter_factory (Name &&name, Factory &&factory)
 
auto begin () const -> decltype(factories.begin())
 
auto end () const -> decltype(factories.end())
 
bool contains (std::string const &key) const
 
auto find (std::string const &key) const -> decltype(factories.find(key))
 
auto find (std::string const &key) -> decltype(factories.find(key))
 
size_t size () const
 

Detailed Description

template<class T>
struct pressio_registry< T >

a type that registers constructor functions

Member Typedef Documentation

◆ const_reference

template<class T >
using pressio_registry< T >::const_reference = T const

the const reference type the registry constructs

◆ reference

template<class T >
using pressio_registry< T >::reference = T&

the reference type the registry constructs

◆ value_type

template<class T >
using pressio_registry< T >::value_type = T

the value type the registry constructs

Member Function Documentation

◆ begin()

template<class T >
auto pressio_registry< T >::begin ( ) const -> decltype(factories.begin())
inline
Returns
an begin iterator over the registered types

◆ build()

template<class T >
T pressio_registry< T >::build ( std::string const &  name) const
inline

construct a element of the registered type

Parameters
[in]namethe item to construct
Returns
the result of the factory function

◆ contains()

template<class T >
bool pressio_registry< T >::contains ( std::string const &  key) const
inline

checks if the name is registered

Parameters
[in]keythe key to search for
Returns
true if present

◆ end()

template<class T >
auto pressio_registry< T >::end ( ) const -> decltype(factories.end())
inline
Returns
an end iterator over the registered types

◆ find() [1/2]

template<class T >
auto pressio_registry< T >::find ( std::string const &  key) -> decltype(factories.find(key))
inline

checks if the name is registered

Parameters
[in]keythe key to search for
Returns
an iterator if the entry is found; else end()

◆ find() [2/2]

template<class T >
auto pressio_registry< T >::find ( std::string const &  key) const -> decltype(factories.find(key))
inline

checks if the name is registered

Parameters
[in]keythe key to search for
Returns
an iterator if the entry is found; else end()

◆ regsiter_factory()

template<class T >
template<class Name , class Factory >
void pressio_registry< T >::regsiter_factory ( Name &&  name,
Factory &&  factory 
)
inline

register a factory function with the registry at the provided name

Parameters
[in]namethe name to register
[in]factorythe constructor function which takes 0 arguments

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