From 0b5b9b593e3cb9f04fa36df6244d2455624a3b00 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Tue, 8 Apr 2008 03:21:24 +0200 Subject: [PATCH] DefsManagerImpl_test now running --- src/common/query/mockconfigrules.cpp | 15 ++++++++++++--- src/common/query/mockconfigrules.hpp | 13 ++++++++++--- tests/53session.tests | 5 +++-- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/common/query/mockconfigrules.cpp b/src/common/query/mockconfigrules.cpp index f05f3c745..ddc7bd57a 100644 --- a/src/common/query/mockconfigrules.cpp +++ b/src/common/query/mockconfigrules.cpp @@ -97,11 +97,10 @@ namespace lumiera // for baiscpipetest.cpp --------- answer_->insert (entry_Struct ("stream(video)")); answer_->insert (entry_Struct ("stream(teststream)")); - item (answer_, "stream(default)") = item (answer_,"stream(video)"); //TODO killme + item (answer_, "stream(default)") = item (answer_,"stream(video)"); // set up a default stream answer_->insert (entry_Struct ("pipe(master), stream(video)")); - item (answer_, "pipe(default)") = item(answer_,"pipe(master), stream(video)"); //TODO killme - TODO ("remove the default entries!!! DefaultsManager should find them automatically"); + item (answer_, "default(P)") = item(answer_,"pipe(master), stream(video)"); } @@ -121,6 +120,16 @@ namespace lumiera answer_->insert (entry (q, newPipe)); return true; // denotes query will now succeed... } + /** special case: create a new pipe for a specific stream ID */ + bool + MockTable::fabricate_new_Pipe_for_stream (Query& q, string const& streamID) + { + typedef WrapReturn::Wrapper Ptr; + + Ptr newPipe (Struct::create (Query ("make(PP), "+q))); + answer_->insert (entry (q, newPipe)); + return true; + } /** special case: create/retrieve new rocessing pattern for given stream ID... */ bool MockTable::fabricate_ProcPatt_on_demand (Query& q, string const& streamID) diff --git a/src/common/query/mockconfigrules.hpp b/src/common/query/mockconfigrules.hpp index c4f56aeef..dba328754 100644 --- a/src/common/query/mockconfigrules.hpp +++ b/src/common/query/mockconfigrules.hpp @@ -111,6 +111,7 @@ namespace lumiera template bool detect_case (typename WrapReturn::Wrapper&, Query& q); bool fabricate_matching_new_Pipe (Query& q, string const& pipeID, string const& streamID); + bool fabricate_new_Pipe_for_stream (Query& q, string const& streamID); bool fabricate_ProcPatt_on_demand (Query& q, string const& streamID); template @@ -180,6 +181,11 @@ namespace lumiera inline bool MockTable::detect_case (WrapReturn::Wrapper& candidate, Query& q) { + if (!isnil (extractID("make", q))) + return false; // let the query fail here, + // so the invoking factory will go ahead + // and create a new object. + const string pipeID = extractID("pipe", q); const string streamID = extractID("stream", q); @@ -188,6 +194,9 @@ namespace lumiera if (!isnil(pipeID) && !isnil(streamID)) return fabricate_matching_new_Pipe (q, pipeID, streamID); + + if (!candidate && !isnil(streamID)) + return fabricate_new_Pipe_for_stream (q, streamID); q.clear(); return false; @@ -197,9 +206,7 @@ namespace lumiera MockTable::detect_case (WrapReturn::Wrapper& candidate, Query& q) { if (!isnil (extractID("make", q))) - return false; // let the query fail here, - // so the invoking factory will go ahead - // and create a new object. + return false; // failure triggers creation... const string streamID = extractID("stream", q); if (!candidate && !isnil(streamID)) diff --git a/tests/53session.tests b/tests/53session.tests index dbf85bc75..64946fcf2 100644 --- a/tests/53session.tests +++ b/tests/53session.tests @@ -6,11 +6,12 @@ PLANNED "AddClip_test" AddClip_test <