score::MatchingFactory< T > Class Template Reference

Utility class for making a factory interface list. More...

Inheritance diagram for score::MatchingFactory< T >:
score::InterfaceList< T > score::InterfaceListBase score::IndirectContainer< T, U >

Detailed Description

template<typename T>
class score::MatchingFactory< T >

Utility class for making a factory interface list.

Public Member Functions

template<typename Fun , typename... Args>
auto make (Fun f, Args &&... args) const noexcept
 Apply a function on the correct factory according to a set of parameter. More...
 
- Public Member Functions inherited from score::InterfaceList< T >
constexpr score::InterfaceKey interfaceKey () const noexcept final override
 A key that uniquely identifies this family of factories.
 
void insert (std::unique_ptr< score::InterfaceBase > e) final override
 insert Register a new factory. More...
 
T * get (const key_type &k) const noexcept
 Get a particular factory from its ConcreteKey.
 
- Public Member Functions inherited from score::InterfaceListBase
 InterfaceListBase (const InterfaceListBase &)=delete
 
 InterfaceListBase (InterfaceListBase &&)=delete
 
InterfaceListBaseoperator= (const InterfaceListBase &)=delete
 
InterfaceListBaseoperator= (InterfaceListBase &&)=delete
 
- Public Member Functions inherited from score::IndirectContainer< T, U >
auto begin () noexcept
 
auto end () noexcept
 
auto begin () const noexcept
 
auto end () const noexcept
 
auto rbegin () noexcept
 
auto rend () noexcept
 
auto rbegin () const noexcept
 
auto rend () const noexcept
 
auto cbegin () const noexcept
 
auto cend () const noexcept
 
auto size () const noexcept
 
auto empty () const noexcept
 
auto push_back (T *ptr)
 
auto & front () const noexcept
 
auto & back () const noexcept
 
auto & operator[] (int pos) noexcept
 
auto & operator[] (int pos) const noexcept
 

Additional Inherited Members

- Public Types inherited from score::InterfaceList< T >
using factory_type = T
 
using key_type = typename FactoryType::ConcreteKey
 
using vector_type = IndirectContainer< T >
 
- Public Types inherited from score::IndirectContainer< T, U >
using ctnr_t = std::vector< T *, U >
 
using value_type = T
 
- Static Public Member Functions inherited from score::InterfaceList< T >
static constexpr const score::InterfaceKey static_interfaceKey () noexcept
 
- Public Attributes inherited from score::InterfaceList< T >
Nano::Signal< void(const factory_type &)> added
 
- Static Public Attributes inherited from score::InterfaceListBase
static constexpr bool factory_list_tag = true
 
- Protected Attributes inherited from score::InterfaceList< T >
ossia::hash_map< typename FactoryType::ConcreteKey, std::unique_ptr< T > > map
 

Member Function Documentation

◆ make()

template<typename T >
template<typename Fun , typename... Args>
auto score::MatchingFactory< T >::make ( Fun  f,
Args &&...  args 
) const
inlinenoexcept

Apply a function on the correct factory according to a set of parameter.

The factory must have a function match that takes some arguments, and return true if these arguments are correct for the given factory.

Then, the function passed in first argument is called on the actual factory if it is found, else a default-constructed return value (so for instance a null pointer).


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