Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
MockTable Class Reference

#include "steam/mobject/session/query/fake-configrules.hpp"

Description

the actual table holding preconfigured answers packaged as boost::any objects.

MockTable is the implementation base; subclasses for the individual types are layered below to define the resolve(..) functions. Finally #MockConfigRules wraps things up.

The implementation relies on boost::any records to stash the objects in automatically managed heap memory.

Definition at line 121 of file fake-configrules.hpp.

Public Member Functions

template<>
bool detect_case (WrapReturn< Pipe >::Wrapper &candidate, Query< Pipe > const &q)
 
template<>
bool detect_case (WrapReturn< const ProcPatt >::Wrapper &candidate, Query< const ProcPatt > const &q)
 
template<>
bool detect_case (WrapReturn< asset::Timeline >::Wrapper &candidate, Query< asset::Timeline > const &q)
 
template<>
bool detect_case (WrapReturn< asset::Sequence >::Wrapper &candidate, Query< asset::Sequence > const &q)
 

Protected Member Functions

 MockTable ()
 
virtual void reset ()
 clear the contents of the mock solution table.
 
any const & fetch_from_table_for (QueryKey const &query)
 this is the (preliminary/mock) implementation handling queries for objects of a specific type and with capabilities or properties defined by the query.
 
template<class TY >
bool detect_case (typename WrapReturn< TY >::Wrapper &, Query< TY > const &)
 Hook for treating very special cases for individual types only.
 
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...
 
bool fabricate_just_new_Pipe (Query< Pipe > const &q)
 special case: create a new pipe for a specific stream ID
 
bool fabricate_ProcPatt_on_demand (Query< const ProcPatt > const &q)
 special case: create/retrieve new processing pattern for given stream ID...
 
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 within the query.
 
bool fabricate_Sequence_on_demand (Query< asset::Sequence > const &q)
 special case: fabricate new Timeline, maybe using ID specs from the query...
 
template<class TY >
bool set_new_mock_solution (Query< TY > const &q, typename WrapReturn< TY >::Wrapper &candidate)
 for entering "valid" solutions on-the-fly from tests
 
- Protected Member Functions inherited from ConfigRules< InterfaceTypes >
 ConfigRules ()
 
virtual ~ConfigRules ()
 

Private Types

using Tab = std::map< QueryKey, any >
 

Private Member Functions

void fill_mock_table ()
 hard coded answers to configuration queries.
 
template<class STRU >
any & item (string const &querySpec)
 shortcut for simply accessing a table entry
 

Private Attributes

Tab answer_
 
bool isInit_
 

Additional Inherited Members

- Static Public Attributes inherited from ConfigResolver
static lib::Depend< ConfigResolverinstance
 Singleton factory instance, configured with the actual implementation type.
 

Constructor & Destructor Documentation

◆ MockTable()

MockTable ( )
protected

Definition at line 268 of file fake-configrules.cpp.

Member Typedef Documentation

◆ Tab

using Tab = std::map<QueryKey,any>
private

Definition at line 124 of file fake-configrules.hpp.

Member Function Documentation

◆ reset()

void reset ( )
protectedvirtual

clear the contents of the mock solution table.

Used by Session lifecycle to restore pristine state

Implements ConfigRules< InterfaceTypes >.

Definition at line 121 of file fake-configrules.cpp.

References MockTable::answer_, and MockTable::isInit_.

◆ fetch_from_table_for()

any const & fetch_from_table_for ( QueryKey const &  query)
protected

this is the (preliminary/mock) implementation handling queries for objects of a specific type and with capabilities or properties defined by the query.

The real implementation would require a rule based system (Ichthyo plans to use YAP Prolog), while this dummy implementation simply replies based on a table of pre-fabricated objects. Never fails.

Returns
smart ptr (or similar) holding the object, maybe an empty smart ptr if not found

Definition at line 287 of file fake-configrules.cpp.

References MockTable::answer_, MockTable::fill_mock_table(), and MockTable::isInit_.

+ Here is the call graph for this function:

◆ detect_case() [1/5]

template<class TY >
bool detect_case ( typename WrapReturn< TY >::Wrapper &  ,
Query< TY > const &   
)
inlineprotected

Hook for treating very special cases for individual types only.

Definition at line 218 of file fake-configrules.hpp.

◆ fabricate_matching_new_Pipe()

bool fabricate_matching_new_Pipe ( Query< Pipe > const &  q,
string const &  pipeID,
string const &  streamID 
)
protected

special case: create a new pipe with matching pipe and stream IDs on the fly when referred...

Definition at line 138 of file fake-configrules.cpp.

References MockTable::answer_, and Struct::retrieve.

Referenced by MockTable::detect_case().

+ Here is the caller graph for this function:

◆ fabricate_just_new_Pipe()

bool fabricate_just_new_Pipe ( Query< Pipe > const &  q)
protected

special case: create a new pipe for a specific stream ID

Definition at line 149 of file fake-configrules.cpp.

References MockTable::answer_, and Struct::retrieve.

Referenced by MockTable::detect_case().

+ Here is the caller graph for this function:

◆ fabricate_ProcPatt_on_demand()

bool fabricate_ProcPatt_on_demand ( Query< const ProcPatt > const &  q)
protected

special case: create/retrieve new processing pattern for given stream ID...

Definition at line 160 of file fake-configrules.cpp.

References MockTable::answer_, and Struct::retrieve.

Referenced by MockTable::detect_case().

+ Here is the caller graph for this function:

◆ fabricate_Timeline_on_demand()

bool fabricate_Timeline_on_demand ( Query< asset::Timeline > const &  query)
protected

special case: fabricate new Timeline, maybe using specific sub-objects as hinted by the IDs given within the query.

This might include searching the session's timelines / sequences to retrieve an existing object with matching ID...

Definition at line 175 of file fake-configrules.cpp.

References MockTable::answer_, Session::current, Query< RES >::extractID(), StructFactory::made4fake(), Query< RES >::Builder::prependConditions(), Query< RES >::rebuild(), Query< RES >::Builder::removeTerm(), Struct::retrieve, and Session::timelines.

Referenced by MockTable::detect_case().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fabricate_Sequence_on_demand()

bool fabricate_Sequence_on_demand ( Query< asset::Sequence > const &  q)
protected

special case: fabricate new Timeline, maybe using ID specs from the query...

Definition at line 211 of file fake-configrules.cpp.

References MockTable::answer_, Session::current, Query< RES >::extractID(), StructFactory::made4fake(), Query< RES >::Builder::prependConditions(), Query< RES >::rebuild(), Query< RES >::Builder::removeTerm(), Struct::retrieve, and Session::sequences.

Referenced by MockTable::detect_case().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_new_mock_solution()

template<class TY >
template bool set_new_mock_solution ( Query< TY > const &  q,
typename WrapReturn< TY >::Wrapper &  candidate 
)
protected

for entering "valid" solutions on-the-fly from tests

Definition at line 249 of file fake-configrules.cpp.

References MockTable::answer_.

Referenced by MockTable::detect_case().

+ Here is the caller graph for this function:

◆ fill_mock_table()

void fill_mock_table ( )
private

hard coded answers to configuration queries.

Note
while filling the table re-entrance will be quite common, so the order of creating the objects is important.

Definition at line 97 of file fake-configrules.cpp.

References MockTable::answer_, and MockTable::isInit_.

Referenced by MockTable::fetch_from_table_for().

+ Here is the caller graph for this function:

◆ item()

template<class STRU >
any & item ( string const &  querySpec)
inlineprivate

shortcut for simply accessing a table entry

Definition at line 153 of file fake-configrules.hpp.

References MockTable::answer_.

◆ detect_case() [2/5]

template<>
bool detect_case ( WrapReturn< Pipe >::Wrapper &  candidate,
Query< Pipe > const &  q 
)
inline

Definition at line 224 of file fake-configrules.hpp.

References Query< RES >::extractID(), MockTable::fabricate_just_new_Pipe(), MockTable::fabricate_matching_new_Pipe(), MockTable::set_new_mock_solution(), and Query< RES >::usesPredicate().

+ Here is the call graph for this function:

◆ detect_case() [3/5]

template<>
bool detect_case ( WrapReturn< const ProcPatt >::Wrapper &  candidate,
Query< const ProcPatt > const &  q 
)
inline

Definition at line 247 of file fake-configrules.hpp.

References Query< RES >::extractID(), and MockTable::fabricate_ProcPatt_on_demand().

+ Here is the call graph for this function:

◆ detect_case() [4/5]

template<>
bool detect_case ( WrapReturn< asset::Timeline >::Wrapper &  candidate,
Query< asset::Timeline > const &  q 
)
inline

Definition at line 258 of file fake-configrules.hpp.

References MockTable::fabricate_Timeline_on_demand().

+ Here is the call graph for this function:

◆ detect_case() [5/5]

template<>
bool detect_case ( WrapReturn< asset::Sequence >::Wrapper &  candidate,
Query< asset::Sequence > const &  q 
)
inline

Definition at line 267 of file fake-configrules.hpp.

References MockTable::fabricate_Sequence_on_demand().

+ Here is the call graph for this function:

Member Data Documentation

◆ answer_

◆ isInit_

bool isInit_
private
+ Inheritance diagram for MockTable:
+ Collaboration diagram for MockTable:

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