diff --git a/src/common/query.hpp b/src/common/query.hpp index 14d23982b..db76259db 100644 --- a/src/common/query.hpp +++ b/src/common/query.hpp @@ -52,12 +52,13 @@ namespace lumiera explicit Query (const string& predicate="") : string(predicate) {} explicit Query (format& pattern) : string(str(pattern)) {} - const string asKey() const { return string(typeid(OBJ).name())+": "+*this; } - }; + + operator string& () { return *this; } // TODO: needed temporarily by mockconfigrules + }; // for calling removeTerm on the string-ref.... namespace query diff --git a/src/common/query/mockconfigrules.cpp b/src/common/query/mockconfigrules.cpp index d688d9dbd..7589d84f7 100644 --- a/src/common/query/mockconfigrules.cpp +++ b/src/common/query/mockconfigrules.cpp @@ -93,6 +93,7 @@ namespace lumiera typedef const ProcPatt cPP; + // for baiscpipetest.cpp --------- answer_->insert (entry_Struct ("stream(video)")); answer_->insert (entry_Struct ("stream(teststream)")); @@ -104,6 +105,8 @@ namespace lumiera } + + /* under some circumstances we need to emulate the behaviour * * of a real resolution engine in a more detailed manner. * * These case are hard wired in code below */ @@ -112,17 +115,22 @@ namespace lumiera bool MockTable::fabricate_matching_new_Pipe (Query& q, string const& pipeID, string const& streamID) { - answer_->insert (entry (q, Struct::create (pipeID, streamID))); + typedef WrapReturn::Wrapper Ptr; + + Ptr newPipe (Struct::create (pipeID, streamID)); + answer_->insert (entry (q, newPipe)); + return true; // denotes query will now succeed... } /** special case: create/retrieve new rocessing pattern for given stream ID... */ bool MockTable::fabricate_ProcPatt_on_demand (Query& q, string const& streamID) { typedef const ProcPatt cPP; - typedef typename WrapReturn::Wrapper Ptr; + typedef WrapReturn::Wrapper Ptr; Ptr newPP (Struct::create (Query ("make(PP), "+q))); answer_->insert (entry (q, newPP)); + return true; } diff --git a/src/common/query/mockconfigrules.hpp b/src/common/query/mockconfigrules.hpp index 3ff5d1cff..c3f6684ca 100644 --- a/src/common/query/mockconfigrules.hpp +++ b/src/common/query/mockconfigrules.hpp @@ -67,12 +67,28 @@ namespace lumiera - /** a traits-class to define the smart-ptr to wrap the result */ - template - struct WrapReturn { typedef shared_ptr Wrapper; }; - template<> - struct WrapReturn { typedef PProcPatt Wrapper; }; + + namespace // internal details + { + + /** a traits-class to define the smart-ptr to wrap the result */ + template + struct WrapReturn { typedef shared_ptr Wrapper; }; + + template<> + struct WrapReturn { typedef PProcPatt Wrapper; }; + + + /** helper detecting if a query actually intended to retrieve a "default" object. + * This implementation is quite crude, of cours it would be necessary to actually + * parse and evaluate the query. @note query is modified if "default" ... */ + inline bool + is_defaults_query (string& query) + { + return !isnil (removeTerm ("default", query)); + } + } // details (end) /** @@ -92,6 +108,8 @@ namespace lumiera const any& fetch_from_table_for (const string& queryStr); // special cases.... + template + bool detect_case (Query& q); bool fabricate_matching_new_Pipe (Query& q, string const& pipeID, string const& streamID); bool fabricate_ProcPatt_on_demand (Query& q, string const& streamID); @@ -133,32 +151,28 @@ namespace lumiera try_special_case (Ret& solution, const Query& q) { Query newQuery = q; - if (is_defaults_query (q)) // modified query.. + if (is_defaults_query (newQuery)) // modified query.. return solution = Session::current->defaults (newQuery); - // may cause recursion + // may cause recursion if (detect_case (newQuery)) return resolve (solution, newQuery); - return solution = Ret(); - // fail: return default-constructed empty smart ptr + return solution = Ret(); // fail: return default-constructed empty smart ptr } - - bool - detect_case (Query& q); }; /** Hook for treating very special cases for individual types only */ - template + template inline bool - LookupPreconfigured::detect_case (Query& q) + MockTable::detect_case (Query& q) { q.clear(); // end recursion return false; } - template + template<> inline bool - LookupPreconfigured::detect_case (Query& q) + MockTable::detect_case (Query& q) { const string pipeID = extractID("pipe", q); const string streamID = extractID("stream", q); @@ -170,7 +184,7 @@ namespace lumiera } template<> inline bool - LookupPreconfigured::detect_case (Query& q) + MockTable::detect_case (Query& q) { const string streamID = extractID("stream", q); if (!isnil(streamID)) diff --git a/src/proc/mobject/session/defsmanager.cpp b/src/proc/mobject/session/defsmanager.cpp index 4c5cd9f82..1d6f92e9a 100644 --- a/src/proc/mobject/session/defsmanager.cpp +++ b/src/proc/mobject/session/defsmanager.cpp @@ -134,6 +134,8 @@ namespace mobject #include "proc/asset/procpatt.hpp" #include "proc/asset/pipe.hpp" +#include "proc/asset/track.hpp" +#include "proc/mobject/session/track.hpp" namespace mobject { @@ -145,9 +147,15 @@ namespace mobject using asset::ProcPatt; using asset::PProcPatt; + using mobject::session::Track; + using mobject::session::TrackAsset; + using mobject::session::PTrack; + using mobject::session::PTrackAsset; - template PPipe DefsManager::operator() (const Query&); - template PProcPatt DefsManager::operator() (const Query&); + template PPipe DefsManager::operator() (const Query&); + template PProcPatt DefsManager::operator() (const Query&); + template PTrack DefsManager::operator() (const Query&); + template PTrackAsset DefsManager::operator() (const Query&); template bool DefsManager::define (const PPipe&, const Query&); template bool DefsManager::forget (const PPipe&); diff --git a/src/proc/mobject/session/mobjectfactory.hpp b/src/proc/mobject/session/mobjectfactory.hpp index 02a0f52b3..cff884ca7 100644 --- a/src/proc/mobject/session/mobjectfactory.hpp +++ b/src/proc/mobject/session/mobjectfactory.hpp @@ -45,7 +45,7 @@ namespace mobject class Track; class Effect; - typedef shared_ptr PTrackAsset; + typedef shared_ptr PTrackAsset; class MObjectFactory diff --git a/src/proc/mobject/session/track.hpp b/src/proc/mobject/session/track.hpp index 3a5517d52..d4005b97d 100644 --- a/src/proc/mobject/session/track.hpp +++ b/src/proc/mobject/session/track.hpp @@ -34,7 +34,11 @@ namespace mobject { namespace session { - typedef shared_ptr PTrackAsset; + class Track; + typedef asset::Track TrackAsset; + + typedef shared_ptr PTrack; + typedef shared_ptr PTrackAsset; /** @@ -57,7 +61,7 @@ namespace mobject public: /** Child tracks in a tree structure */ - vector > subTracks; // TODO: Placement!!!!!!! + vector > subTracks; ////TODO: it should really work with Placements! this here is just a decoy!!!!!!! virtual bool isValid() const; };