Lumiera
0.pre.03
»edit your freedom«
|
#include "common/query/defs-manager.hpp"
Organise a collection of preconfigured default objects.
For various kinds of objects we can tweak the default parametrisation as part of the general session configuration. A ref to an instance of this class is accessible through the current session and can be used to fill in parts of the configuration of new objects, if the user code didn't give more specific parameters. Necessary sub-objects will be created on demand, and any default configuration, once found, will be remembered and stored with the current session.
Definition at line 138 of file defs-manager.hpp.
Public Member Functions | |
DefsManager () noexcept | |
initialise the most basic internal defaults. More... | |
~DefsManager () | |
void | clear () |
template<class TAR > | |
P< TAR > | create (const Query< TAR > &capabilities) |
template<class TAR > | |
lib::P< TAR > | create (Query< TAR > const &) |
retrieve an object fulfilling the query and register it as default. More... | |
template<class TAR > | |
bool | define (lib::P< TAR > const &, Query< TAR > const &=Query< TAR >()) |
register the given object as default, after ensuring it fulfils the query. More... | |
template<class TAR > | |
bool | forget (lib::P< TAR > const &) |
remove the defaults registration of the given object, if there was such More... | |
template<class TAR > | |
P< TAR > | operator() (const Query< TAR > &capabilities) |
template<class TAR > | |
lib::P< TAR > | operator() (Query< TAR > const &) |
common access point: retrieve the default object fulfilling some given conditions. More... | |
template<class TAR > | |
P< TAR > | search (const Query< TAR > &capabilities) |
template<class TAR > | |
lib::P< TAR > | search (Query< TAR > const &) |
search through the registered defaults, never create anything. More... | |
Private Attributes | |
unique_ptr< impl::DefsRegistry > | defsRegistry_ |
Additional Inherited Members | |
Private Member Functions inherited from NonCopyable | |
NonCopyable (NonCopyable const &)=delete | |
NonCopyable & | operator= (NonCopyable const &)=delete |
|
noexcept |
initialise the most basic internal defaults.
Definition at line 65 of file defs-manager-impl.hpp.
~DefsManager | ( | ) |
causes std::default_delete from unique_ptr<DefsRegistry>
to be emitted here, where the declaration of DefsRegistry is available.
Definition at line 76 of file defs-manager-impl.hpp.
common access point: retrieve the default object fulfilling some given conditions.
May silently trigger object creation.
error::Config | in case no solution is possible, which is considered misconfiguration. |
Referenced by DefsManager::forget().
search through the registered defaults, never create anything.
empty
ptr if not found. Referenced by DefsManager::clear(), and DefsManager::forget().
retrieve an object fulfilling the query and register it as default.
The resolution is delegated to the ConfigQuery system (which may cause creation of new object instances)
empty
ptr if no solution. Referenced by DefsManager::forget().
register the given object as default, after ensuring it fulfils the query.
The latter may cause some properties of the object to be set, trigger creation of additional objects, and may fail altogether.
Definition at line 120 of file defs-manager-impl.hpp.
template bool forget | ( | lib::P< TAR > const & | ) |
remove the defaults registration of the given object, if there was such
Definition at line 134 of file defs-manager-impl.hpp.
References DefsManager::create(), DefsManager::operator()(), and DefsManager::search().
void clear | ( | ) |
for session lifecycle
Definition at line 80 of file defs-manager-impl.hpp.
References DefsManager::search().