From 384ee681290c3d425b681fb5a24bb05aface0b29 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Wed, 26 Dec 2012 02:20:11 +0100 Subject: [PATCH] allow simple query-for-pipe again (revert) while refactoring, I thought it might be a good idea only to use Query objects. But in this special case, most often you'd just want to pass in a simple query with a literal query string. So this convenience shortcut indeed makes sense. --- src/proc/asset/pipe.cpp | 5 ++--- src/proc/asset/pipe.hpp | 2 +- src/proc/mobject/output-mapping.hpp | 2 +- src/proc/mobject/session/locatingpin.cpp | 2 +- src/proc/play/dummy-play-connection.hpp | 2 +- tests/components/proc/asset/basicpipetest.cpp | 16 ++++++++-------- .../proc/engine/engine-interface-test.cpp | 2 +- .../builder/fixture-change-detector-test.cpp | 2 +- .../mobject/builder/model-port-registry-test.cpp | 2 +- .../builder/segmentation-datastructure-test.cpp | 2 +- .../proc/mobject/output-mapping-test.cpp | 16 ++++++++-------- .../mobject/session/defs-manager-impl-test.cpp | 2 +- .../proc/mobject/session/defs-manager-test.cpp | 12 ++++++------ 13 files changed, 33 insertions(+), 34 deletions(-) diff --git a/src/proc/asset/pipe.cpp b/src/proc/asset/pipe.cpp index 3ddf6b04b..f66b0ca53 100644 --- a/src/proc/asset/pipe.cpp +++ b/src/proc/asset/pipe.cpp @@ -58,10 +58,9 @@ namespace asset { PPipe - Pipe::query (Query const& properties) + Pipe::query (string const& properties) { - //////////////////////////////////////////////////TODO maybe provide a direct way to query, based on a predicate string? - return Struct::retrieve (properties); + return Struct::retrieve (Query (properties)); } diff --git a/src/proc/asset/pipe.hpp b/src/proc/asset/pipe.hpp index aa731b61f..90de5cb23 100644 --- a/src/proc/asset/pipe.hpp +++ b/src/proc/asset/pipe.hpp @@ -98,7 +98,7 @@ namespace asset { void switchProcPatt (PProcPatt& another); /** convenience shortcut for retrieving default configured pipes */ - static PPipe query (Query const& properties); + static PPipe query (string const& properties); /** convenience shortcut for lookup by id */ static PPipe lookup (ID id); diff --git a/src/proc/mobject/output-mapping.hpp b/src/proc/mobject/output-mapping.hpp index 303b449cf..19305c348 100644 --- a/src/proc/mobject/output-mapping.hpp +++ b/src/proc/mobject/output-mapping.hpp @@ -387,7 +387,7 @@ namespace mobject { // treat the special case // when actually requesting the "Nth default of this kind" PPipe corresponding_sourcePipe - = asset::Pipe::query( + = asset::Struct::retrieve ( _mapping::build_corresponding_sourceQuery (query4pipe)); ENSURE (corresponding_sourcePipe); diff --git a/src/proc/mobject/session/locatingpin.cpp b/src/proc/mobject/session/locatingpin.cpp index 126edd1ef..93f6437e5 100644 --- a/src/proc/mobject/session/locatingpin.cpp +++ b/src/proc/mobject/session/locatingpin.cpp @@ -148,7 +148,7 @@ namespace session { LocatingPin::LocatingSolution::getPipe() { TODO ("implement Placement LocatingSolution"); - return asset::Pipe::query (lumiera::Query("pipe(master)")); // yet another idiotic dummy + return asset::Pipe::query ("pipe(master)"); // yet another idiotic dummy } diff --git a/src/proc/play/dummy-play-connection.hpp b/src/proc/play/dummy-play-connection.hpp index 8e2e9fc3e..24c6d21a9 100644 --- a/src/proc/play/dummy-play-connection.hpp +++ b/src/proc/play/dummy-play-connection.hpp @@ -139,7 +139,7 @@ namespace play { inline PID getPipe (string id) { - return Pipe::query (Query ("id("+id+")")); + return Pipe::query ("id("+id+")"); } inline TID diff --git a/tests/components/proc/asset/basicpipetest.cpp b/tests/components/proc/asset/basicpipetest.cpp index b0634f2f5..b8d8b6443 100644 --- a/tests/components/proc/asset/basicpipetest.cpp +++ b/tests/components/proc/asset/basicpipetest.cpp @@ -108,19 +108,19 @@ namespace test { { normaliseID (pID); - PPipe pipe1 = Pipe::query (Query ("pipe("+pID+")")); + PPipe pipe1 = Pipe::query ("pipe("+pID+")"); CHECK (pipe1); CHECK (pipe1->getPipeID() == pID); string pID2 = "another-" + pID; - PPipe pipe2 = Pipe::query (Query ("pipe("+pID2+")")); + PPipe pipe2 = Pipe::query ("pipe("+pID2+")"); CHECK (pipe2); CHECK (pipe2 != pipe1); Category c1 = pipe1->ident.category; Category c2 = pipe2->ident.category; CHECK (c1 == c2); - PPipe pipe3 = Pipe::query (Query ("pipe("+pID2+")")); + PPipe pipe3 = Pipe::query ("pipe("+pID2+")"); //////////////////////////////////////////////////////////////TODO: that's broken; creating a new one instead to find the existing one, as it should be CHECK (pipe3 == pipe2); } @@ -128,7 +128,7 @@ namespace test { void create_using_default() { - PPipe pipe1 = Pipe::query (Query("")); // "the default pipe" + PPipe pipe1 = Pipe::query (""); // "the default pipe" PPipe pipe2; CHECK (pipe1); CHECK (pipe1 == Session::current->defaults (Query())); @@ -146,7 +146,7 @@ namespace test { CHECK (pipe2 == pipe1); string sID = pipe1->getStreamID(); // sort of a "default stream type" - PPipe pipe3 = Pipe::query (Query ("stream("+sID+")")); + PPipe pipe3 = Pipe::query ("stream("+sID+")"); CHECK (pipe3); CHECK (pipe3->getStreamID() == StreamType::ID(sID)); CHECK (pipe3->getProcPatt() == Session::current->defaults (Query("stream("+sID+")"))); @@ -158,7 +158,7 @@ namespace test { typedef P PPipe; /////TODO: transition to P<> typedef P PProcPatt; - PPipe thePipe = Pipe::query (Query ("pipe("+pID+")")); + PPipe thePipe = Pipe::query ("pipe("+pID+")"); CHECK (thePipe); PProcPatt thePatt = thePipe->getProcPatt(); CHECK (thePatt); @@ -172,7 +172,7 @@ namespace test { // now querying for a pipe using this pattern (created on-the-fly) // note: because the pattern is new, this new pipe will be used as // default pipe for this pattern automatically - PPipe pipe2x = Pipe::query (Query ("pattern(another)")); + PPipe pipe2x = Pipe::query ("pattern(another)"); CHECK (pattern2 == pipe2x->getProcPatt()); CHECK (pipe2x == Session::current->defaults (Query("pattern(another)"))); @@ -194,7 +194,7 @@ namespace test { CHECK (thePipe->getProcPatt()); CHECK ( pattern3 == pattern2); // but is still valid, as long as the ref is alive.... - PPipe pipe3x = Pipe::query (Query ("pattern(another)")); + PPipe pipe3x = Pipe::query ("pattern(another)"); pattern3 = pipe3x->getProcPatt(); /////TODO: transition to P<> CHECK (pattern3 != pattern2); // because pattern2 is already unlinked... CHECK (pipe3x == Session::current->defaults (Query("pattern(another)"))); diff --git a/tests/components/proc/engine/engine-interface-test.cpp b/tests/components/proc/engine/engine-interface-test.cpp index 614c4d135..7f7b6ea59 100644 --- a/tests/components/proc/engine/engine-interface-test.cpp +++ b/tests/components/proc/engine/engine-interface-test.cpp @@ -91,7 +91,7 @@ namespace test { EngineService& engine = EngineService::instance(); EngineDiagnostics monitor(engine); - PID pipe = Pipe::query(lumiera::Query ("id(dummy)")); + PID pipe = Pipe::query("id(dummy)"); ModelPort port(pipe); OutputSlot& oSlot = DiagnosticOutputSlot::build(); diff --git a/tests/components/proc/mobject/builder/fixture-change-detector-test.cpp b/tests/components/proc/mobject/builder/fixture-change-detector-test.cpp index 61eb5cb50..a07a47761 100644 --- a/tests/components/proc/mobject/builder/fixture-change-detector-test.cpp +++ b/tests/components/proc/mobject/builder/fixture-change-detector-test.cpp @@ -56,7 +56,7 @@ namespace test { inline PID getPipe (string id) { - return Pipe::query (Query ("id("+id+")")); + return Pipe::query ("id("+id+")"); } inline TID diff --git a/tests/components/proc/mobject/builder/model-port-registry-test.cpp b/tests/components/proc/mobject/builder/model-port-registry-test.cpp index 9b3487502..9052db807 100644 --- a/tests/components/proc/mobject/builder/model-port-registry-test.cpp +++ b/tests/components/proc/mobject/builder/model-port-registry-test.cpp @@ -56,7 +56,7 @@ namespace test { inline PID getPipe (string id) { - return Pipe::query (Query ("id("+id+")")); + return Pipe::query ("id("+id+")"); } inline TID diff --git a/tests/components/proc/mobject/builder/segmentation-datastructure-test.cpp b/tests/components/proc/mobject/builder/segmentation-datastructure-test.cpp index 431cbb84b..c09b3a70f 100644 --- a/tests/components/proc/mobject/builder/segmentation-datastructure-test.cpp +++ b/tests/components/proc/mobject/builder/segmentation-datastructure-test.cpp @@ -56,7 +56,7 @@ namespace test { inline PID getPipe (string id) { - return Pipe::query (Query ("id("+id+")")); + return Pipe::query ("id("+id+")"); } inline TID diff --git a/tests/components/proc/mobject/output-mapping-test.cpp b/tests/components/proc/mobject/output-mapping-test.cpp index a36e87807..5bd75c464 100644 --- a/tests/components/proc/mobject/output-mapping-test.cpp +++ b/tests/components/proc/mobject/output-mapping-test.cpp @@ -98,9 +98,9 @@ namespace test { Mapping map; CHECK (isnil (map)); - PPipe p1 = Pipe::query(Query ("id(hairy)")); - PPipe p2 = Pipe::query(Query ("id(furry)")); - PPipe pX = Pipe::query(Query ("id(curly)")); + PPipe p1 = Pipe::query("id(hairy)"); + PPipe p2 = Pipe::query("id(furry)"); + PPipe pX = Pipe::query("id(curly)"); map[p1] = p2; CHECK (!isnil (map)); @@ -125,9 +125,9 @@ namespace test { { Mapping m1; - PPipe p1 = Pipe::query(Query ("id(hairy)")); - PPipe p2 = Pipe::query(Query ("id(furry)")); - PPipe pi = Pipe::query(Query ("id(nappy)")); + PPipe p1 = Pipe::query("id(hairy)"); + PPipe p2 = Pipe::query("id(furry)"); + PPipe pi = Pipe::query("id(nappy)"); m1[pi] = p1; Mapping m2(m1); @@ -158,8 +158,8 @@ namespace test { Mapping map; CHECK (isnil (map)); - PPipe p1 = Pipe::query(Query ("stream(hairy)")); - PPipe p2 = Pipe::query(Query ("stream(furry)")); + PPipe p1 = Pipe::query("stream(hairy)"); + PPipe p2 = Pipe::query("stream(furry)"); CHECK (map[p1] == "master_hairy"); CHECK (map[p2] == "master_furry"); diff --git a/tests/components/proc/mobject/session/defs-manager-impl-test.cpp b/tests/components/proc/mobject/session/defs-manager-impl-test.cpp index 0caed09ad..76de4e6b3 100644 --- a/tests/components/proc/mobject/session/defs-manager-impl-test.cpp +++ b/tests/components/proc/mobject/session/defs-manager-impl-test.cpp @@ -159,7 +159,7 @@ lumiera::query::setFakeBypass(pipeWithSpecificStream); ///////////////////////// void forget (string pID) { - PPipe pipe = Pipe::query (Query ("pipe("+pID+")")); + PPipe pipe = Pipe::query ("pipe("+pID+")"); REQUIRE (find (pipe->getPipeID()), "test assumes pre-registered default pipe"); long cnt = pipe.use_count(); diff --git a/tests/components/proc/mobject/session/defs-manager-test.cpp b/tests/components/proc/mobject/session/defs-manager-test.cpp index f3f941cd8..51400e31f 100644 --- a/tests/components/proc/mobject/session/defs-manager-test.cpp +++ b/tests/components/proc/mobject/session/defs-manager-test.cpp @@ -104,13 +104,13 @@ namespace test { void retrieveSimpleDefault (string) { - PPipe pipe1 = Pipe::query (Query ("")); // "the default pipe" + PPipe pipe1 = Pipe::query (""); // "the default pipe" PPipe pipe2; // several variants to query for "the default pipe" - pipe2 = Pipe::query (Query ("")); + pipe2 = Pipe::query (""); CHECK (pipe2 == pipe1); - pipe2 = Pipe::query (Query ("default(X)")); + pipe2 = Pipe::query ("default(X)"); CHECK (pipe2 == pipe1); pipe2 = Session::current->defaults(Query ()); CHECK (pipe2 == pipe1); @@ -124,7 +124,7 @@ namespace test { void retrieveConstrainedDefault (string pID, string sID) { - PPipe pipe1 = Pipe::query (Query ("")); // "the default pipe" + PPipe pipe1 = Pipe::query (""); // "the default pipe" CHECK ( pipe1->getStreamID() != StreamType::ID(sID), "stream-ID \"%s\" not suitable for test, because " "the default-pipe \"%s\" happens to have the same " @@ -133,10 +133,10 @@ namespace test { ); string query_for_sID ("stream("+sID+")"); - PPipe pipe2 = Pipe::query (Query (query_for_sID)); + PPipe pipe2 = Pipe::query (query_for_sID); CHECK (pipe2->getStreamID() == StreamType::ID(sID)); CHECK (pipe2 != pipe1); - CHECK (pipe2 == Pipe::query (Query (query_for_sID))); // reproducible + CHECK (pipe2 == Pipe::query (query_for_sID)); // reproducible }