Lumiera  0.pre.03
»edit your freedom«
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 130 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

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_just_new_Pipe (Query< Pipe > const &q)
 special case: create a new pipe for a specific stream ID
 
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... More...
 
bool fabricate_ProcPatt_on_demand (Query< const ProcPatt > const &q)
 special case: create/retrieve new processing pattern for given stream ID... More...
 
bool fabricate_Sequence_on_demand (Query< asset::Sequence > const &q)
 special case: fabricate new Timeline, maybe using ID specs from the query... More...
 
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. More...
 
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. More...
 
virtual void reset ()
 clear the contents of the mock solution table. More...
 
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
 

Private Types

typedef std::map< QueryKey, any > Tab
 

Private Member Functions

void fill_mock_table ()
 hard coded answers to configuration queries. More...
 
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. More...
 

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 130 of file fake-configrules.cpp.

◆ 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 296 of file fake-configrules.cpp.

References MockTable::fill_mock_table().

+ Here is the call graph for this function:

◆ 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 147 of file fake-configrules.cpp.

References Struct::retrieve.

◆ 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 169 of file fake-configrules.cpp.

References Struct::retrieve.

◆ 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 184 of file fake-configrules.cpp.

References Query< RES >::extractID().

+ Here is the call graph for this function:

◆ fabricate_Sequence_on_demand()

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

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

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

References Query< RES >::extractID().

+ Here is the call 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 106 of file fake-configrules.cpp.

Referenced by MockTable::fetch_from_table_for().

+ Here is the caller graph for this function:
+ Inheritance diagram for MockTable:
+ Collaboration diagram for MockTable:

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