37#ifndef MOBJECT_SESSION_QUERY_FAKECONFIGRULES_H
38#define MOBJECT_SESSION_QUERY_FAKECONFIGRULES_H
47#include <boost/any.hpp>
75 using boost::any_cast;
101 template<
typename WRA>
105 return bool(solution);
124 using Tab = std::map<QueryKey,any>;
131 virtual void reset();
166 _Pragma(
"GCC diagnostic ignored \"-Woverloaded-virtual\"")
174 template<class TY, class BASE>
177 using Ret = WrapReturn<TY>::Wrapper;
183 any
const& entry = this->fetch_from_table_for(q);
186 Ret const& candidate (any_cast<Ret const&> (entry));
188 or(solution and solution == candidate)
190 return exists (solution = candidate);
192 return try_special_case(solution, q);
198 if (solution and isFakeBypass(q))
199 return exists (solution);
201 if (is_defaults_query (q))
207 if (this->detect_case (solution, q))
208 return resolve (solution, q);
210 return exists (solution =
Ret());
230 const string pipeID = q.
extractID(
"pipe");
231 const string streamID = q.
extractID(
"stream");
233 if (candidate and pipeID == candidate->getPipeID())
236 if (!isnil(pipeID) and not isnil(streamID))
239 if (not candidate and (not isnil(streamID) or not isnil(pipeID)))
249 const string streamID = q.
extractID(
"stream");
251 if (not candidate and not isnil(streamID))
262 return bool(candidate);
271 return bool(candidate);
286 , LookupPreconfigured
This framework allows to (re)configure the lib::Depend front-end for dependency-injection.
Helper to abstract creation and lifecycle of a dependency.
Wrapper for indexing and ordering.
Builder & removeTerm(Symbol termPredicate)
remove the first term from this query definition, which matches the given predicate symbol
Generic interface to express a query for specifically typed result elements exposing some capabilitie...
bool usesPredicate(Symbol predicate) const
string extractID(Symbol predicate) const
convenience shortcut to extract a desired name-ID.
user-visible Interface to the ConfigRules subsystem.
structural asset corresponding to the part of the model forming a processing pipe for generating medi...
"Processing Pattern" is a structural Asset representing information how to build some part of the ren...
The (current) Session holds all the user visible content to be edited and manipulated within the Lumi...
static session::SessManager & current
access point to the current Session
Facade: Dummy Implementation of the query interface.
MockConfigRules()
to be used only by the singleton factory
the actual table holding preconfigured answers packaged as boost::any objects.
bool detect_case(typename WrapReturn< TY >::Wrapper &, Query< TY > const &)
Hook for treating very special cases for individual types only.
bool fabricate_Timeline_on_demand(Query< asset::Timeline > const &q)
special case: fabricate new Timeline, maybe using specific sub-objects as hinted by the IDs given wit...
std::map< QueryKey, any > Tab
bool fabricate_ProcPatt_on_demand(Query< const ProcPatt > const &q)
special case: create/retrieve new processing pattern for given stream ID...
any const & fetch_from_table_for(QueryKey const &query)
this is the (preliminary/mock) implementation handling queries for objects of a specific type and wit...
void fill_mock_table()
hard coded answers to configuration queries.
bool fabricate_matching_new_Pipe(Query< Pipe > const &q, string const &pipeID, string const &streamID)
special case: create a new pipe with matching pipe and stream IDs on the fly when referred....
any & item(string const &querySpec)
shortcut for simply accessing a table entry
bool fabricate_just_new_Pipe(Query< Pipe > const &q)
special case: create a new pipe for a specific stream ID
bool fabricate_Sequence_on_demand(Query< asset::Sequence > const &q)
special case: fabricate new Timeline, maybe using ID specs from the query...
bool set_new_mock_solution(Query< TY > const &q, typename WrapReturn< TY >::Wrapper &candidate)
for entering "valid" solutions on-the-fly from tests
virtual void reset()
clear the contents of the mock solution table.
Definition of the concrete frontend for rule based configuration within the session.
Per type specific configuration of instances created as service dependencies.
bool isFakeBypass(lumiera::QueryKey const &q)
The asset subsystem of the Steam-Layer.
bool exists(WRA const &solution)
bool is_defaults_query(Query< TY > const &querySpec)
helper detecting if a query actually intended to retrieve a "default" object.
a traits-class to define the smart-ptr to wrap the result
_Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Woverloaded-virtual\"") template< class TY
building block providing the mock implementation for a single type.
Namespace of Session and user visible high-level objects.
Steam-Layer implementation namespace root.
bool contains(MAP &map, typename MAP::key_type const &key)
shortcut for containment test on a map
bool isnil(lib::time::Duration const &dur)
Customised refcounting smart pointer.
Utilities to support working with predicate queries.
Primary Interface to the current Session.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...