#include <mockconfigrules.hpp>


Definition at line 98 of file mockconfigrules.hpp.
Public Member Functions | |
| template<> | |
| bool | detect_case (WrapReturn< const ProcPatt >::Wrapper &candidate, Query< const ProcPatt > &q) |
| template<> | |
| bool | detect_case (WrapReturn< Pipe >::Wrapper &candidate, Query< Pipe > &q) |
Protected Member Functions | |
| template<class TY> | |
| bool | detect_case (typename WrapReturn< TY >::Wrapper &, Query< TY > &q) |
| Hook for treating very special cases for individual types only. | |
| bool | fabricate_just_new_Pipe (Query< Pipe > &q) |
| special case: create a new pipe for a specific stream ID | |
| bool | fabricate_matching_new_Pipe (Query< Pipe > &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_ProcPatt_on_demand (Query< const ProcPatt > &q, string const &streamID) |
| special case: create/retrieve new rocessing pattern for given stream ID. | |
| const any & | fetch_from_table_for (const string &queryStr) |
| 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 | set_new_mock_solution (Query< TY > &q, typename WrapReturn< TY >::Wrapper &candidate) |
| for entering "valid" solutions on-the-fly from tests | |
Private Types | |
| typedef boost::scoped_ptr< Tab > | PTab |
| typedef std::map< string, any > | Tab |
Private Member Functions | |
| void | fill_mock_table () |
| hard coded answers to configuration queries. | |
Private Attributes | |
| PTab | answer_ |
| bool | isInit_ |
| bool lumiera::query::MockTable::detect_case | ( | typename WrapReturn< TY >::Wrapper & | , | |
| Query< TY > & | q | |||
| ) | [inline, protected] |
Hook for treating very special cases for individual types only.
Definition at line 175 of file mockconfigrules.hpp.
special case: create a new pipe for a specific stream ID
Definition at line 125 of file mockconfigrules.cpp.
References asset::Struct::create.
00126 { 00127 typedef WrapReturn<Pipe>::Wrapper Ptr; 00128 00129 Ptr newPipe (Struct::create (Query<Pipe> ("make(PP), "+q))); 00130 answer_->insert (entry<Pipe> (q, newPipe)); 00131 return true; 00132 }
| bool lumiera::query::MockTable::fabricate_matching_new_Pipe | ( | Query< Pipe > & | 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 115 of file mockconfigrules.cpp.
References asset::Struct::create.
00116 { 00117 typedef WrapReturn<Pipe>::Wrapper Ptr; 00118 00119 Ptr newPipe (Struct::create (pipeID, streamID)); 00120 answer_->insert (entry<Pipe> (q, newPipe)); 00121 return true; // denotes query will now succeed... 00122 }
| bool lumiera::query::MockTable::fabricate_ProcPatt_on_demand | ( | Query< const ProcPatt > & | q, | |
| string const & | streamID | |||
| ) | [protected] |
special case: create/retrieve new rocessing pattern for given stream ID.
..
Definition at line 135 of file mockconfigrules.cpp.
References asset::Struct::create.
00136 { 00137 typedef const ProcPatt cPP; 00138 typedef WrapReturn<cPP>::Wrapper Ptr; 00139 00140 Ptr newPP (Struct::create (Query<cPP> ("make(PP), "+q))); 00141 answer_->insert (entry<cPP> (q, newPP)); 00142 return true; 00143 }
| const any & lumiera::query::MockTable::fetch_from_table_for | ( | const string & | queryStr | ) | [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 relpies based on a table of pre-fabricated objects. Never fails.
Definition at line 186 of file mockconfigrules.cpp.
References fill_mock_table().
00187 { 00188 static const any NOTFOUND; 00189 if (!isInit_) fill_mock_table(); 00190 00191 Tab::iterator i = answer_->find (queryStr); 00192 if (i == answer_->end()) 00193 return NOTFOUND; 00194 else 00195 return i->second; 00196 }

| void lumiera::query::MockTable::fill_mock_table | ( | ) | [private] |
hard coded answers to configuration queries.
Definition at line 89 of file mockconfigrules.cpp.
Referenced by fetch_from_table_for().
00090 { 00091 INFO (config, "creating mock answers for some config queries..."); 00092 isInit_ = true; // allow re-entrance 00093 00094 typedef const ProcPatt cPP; 00095 00096 00097 // for baiscpipetest.cpp --------- 00098 answer_->insert (entry_Struct<cPP> ("stream(video)")); 00099 answer_->insert (entry_Struct<cPP> ("stream(teststream)")); 00100 item<cPP> (answer_, "stream(default)") = item<cPP> (answer_,"stream(video)"); // set up a default stream 00101 00102 answer_->insert (entry_Struct<Pipe> ("pipe(master), stream(video)")); 00103 item<Pipe> (answer_, "") = item<Pipe>(answer_,"pipe(master), stream(video)");// use as default 00104 }

| bool lumiera::query::MockTable::set_new_mock_solution | ( | Query< TY > & | q, | |
| typename WrapReturn< TY >::Wrapper & | candidate | |||
| ) | [inline, protected] |
for entering "valid" solutions on-the-fly from tests
Definition at line 148 of file mockconfigrules.cpp.
References lumiera::Query< OBJ >::asKey().
00149 { 00150 answer_->erase (q.asKey()); 00151 answer_->insert (entry<TY> (q, obj)); 00152 return true; 00153 }

1.5.6