Loading...
Searching...
No Matches
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::InterfaceListMain score::InterfaceListBase

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>
requires std::is_invocable_v< Fun, typename score::InterfaceList<T>::factory_type&, Args...>
auto make (Fun f, Args &&... args) const noexcept
 Apply a function on the correct factory according to a set of parameter.
 
- 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.
 
T * get (const key_type &k) const noexcept
 Get a particular factory from its ConcreteKey.
 
auto begin () noexcept
 
auto begin () const noexcept
 
auto end () noexcept
 
auto end () const noexcept
 
auto cbegin () const noexcept
 
auto cend () const noexcept
 
- Public Member Functions inherited from score::InterfaceListMain
void insert_base (std::unique_ptr< score::InterfaceBase > e, score::uuid_t k)
 
auto reserve (std::size_t v)
 
auto size () const noexcept
 
auto empty () const noexcept
 
void optimize () noexcept final override
 optimize Called when all the factories are loaded.
 
- Public Member Functions inherited from score::InterfaceListBase
 InterfaceListBase (const InterfaceListBase &)=delete
 
 InterfaceListBase (InterfaceListBase &&)=delete
 
InterfaceListBaseoperator= (const InterfaceListBase &)=delete
 
InterfaceListBaseoperator= (InterfaceListBase &&)=delete
 

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 >
 
- Static Public Member Functions inherited from score::InterfaceList< T >
static const constexpr score::InterfaceKey static_interfaceKey () noexcept
 
- Public Attributes inherited from score::InterfaceListMain
Nano::Signal< void(const score::InterfaceBase &)> added
 
ossia::hash_map< score::uuid_t, std::unique_ptr< score::InterfaceBase > > map
 
- Static Public Attributes inherited from score::InterfaceListBase
static constexpr bool factory_list_tag = true
 

Member Function Documentation

◆ make()

template<typename T >
template<typename Fun , typename... Args>
requires std::is_invocable_v< Fun, typename score::InterfaceList<T>::factory_type&, 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: