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.
This commit is contained in:
Fischlurch 2012-12-26 02:20:11 +01:00
parent 873d6c3d5c
commit 384ee68129
13 changed files with 33 additions and 34 deletions

View file

@ -58,10 +58,9 @@ namespace asset {
PPipe
Pipe::query (Query<Pipe> 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<Pipe> (properties));
}

View file

@ -98,7 +98,7 @@ namespace asset {
void switchProcPatt (PProcPatt& another);
/** convenience shortcut for retrieving default configured pipes */
static PPipe query (Query<Pipe> const& properties);
static PPipe query (string const& properties);
/** convenience shortcut for lookup by id */
static PPipe lookup (ID<Pipe> id);

View file

@ -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);

View file

@ -148,7 +148,7 @@ namespace session {
LocatingPin::LocatingSolution::getPipe()
{
TODO ("implement Placement LocatingSolution");
return asset::Pipe::query (lumiera::Query<asset::Pipe>("pipe(master)")); // yet another idiotic dummy
return asset::Pipe::query ("pipe(master)"); // yet another idiotic dummy
}

View file

@ -139,7 +139,7 @@ namespace play {
inline PID
getPipe (string id)
{
return Pipe::query (Query<Pipe> ("id("+id+")"));
return Pipe::query ("id("+id+")");
}
inline TID

View file

@ -108,19 +108,19 @@ namespace test {
{
normaliseID (pID);
PPipe pipe1 = Pipe::query (Query<Pipe> ("pipe("+pID+")"));
PPipe pipe1 = Pipe::query ("pipe("+pID+")");
CHECK (pipe1);
CHECK (pipe1->getPipeID() == pID);
string pID2 = "another-" + pID;
PPipe pipe2 = Pipe::query (Query<Pipe> ("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> ("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<Pipe>("")); // "the default pipe"
PPipe pipe1 = Pipe::query (""); // "the default pipe"
PPipe pipe2;
CHECK (pipe1);
CHECK (pipe1 == Session::current->defaults (Query<Pipe>()));
@ -146,7 +146,7 @@ namespace test {
CHECK (pipe2 == pipe1);
string sID = pipe1->getStreamID(); // sort of a "default stream type"
PPipe pipe3 = Pipe::query (Query<Pipe> ("stream("+sID+")"));
PPipe pipe3 = Pipe::query ("stream("+sID+")");
CHECK (pipe3);
CHECK (pipe3->getStreamID() == StreamType::ID(sID));
CHECK (pipe3->getProcPatt() == Session::current->defaults (Query<const ProcPatt>("stream("+sID+")")));
@ -158,7 +158,7 @@ namespace test {
typedef P<Pipe> PPipe; /////TODO: transition to P<>
typedef P<const ProcPatt> PProcPatt;
PPipe thePipe = Pipe::query (Query<Pipe> ("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<Pipe> ("pattern(another)"));
PPipe pipe2x = Pipe::query ("pattern(another)");
CHECK (pattern2 == pipe2x->getProcPatt());
CHECK (pipe2x == Session::current->defaults (Query<Pipe>("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<Pipe> ("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<Pipe>("pattern(another)")));

View file

@ -91,7 +91,7 @@ namespace test {
EngineService& engine = EngineService::instance();
EngineDiagnostics monitor(engine);
PID pipe = Pipe::query(lumiera::Query<Pipe> ("id(dummy)"));
PID pipe = Pipe::query("id(dummy)");
ModelPort port(pipe);
OutputSlot& oSlot = DiagnosticOutputSlot::build();

View file

@ -56,7 +56,7 @@ namespace test {
inline PID
getPipe (string id)
{
return Pipe::query (Query<Pipe> ("id("+id+")"));
return Pipe::query ("id("+id+")");
}
inline TID

View file

@ -56,7 +56,7 @@ namespace test {
inline PID
getPipe (string id)
{
return Pipe::query (Query<Pipe> ("id("+id+")"));
return Pipe::query ("id("+id+")");
}
inline TID

View file

@ -56,7 +56,7 @@ namespace test {
inline PID
getPipe (string id)
{
return Pipe::query (Query<Pipe> ("id("+id+")"));
return Pipe::query ("id("+id+")");
}
inline TID

View file

@ -98,9 +98,9 @@ namespace test {
Mapping map;
CHECK (isnil (map));
PPipe p1 = Pipe::query(Query<Pipe> ("id(hairy)"));
PPipe p2 = Pipe::query(Query<Pipe> ("id(furry)"));
PPipe pX = Pipe::query(Query<Pipe> ("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<Pipe> ("id(hairy)"));
PPipe p2 = Pipe::query(Query<Pipe> ("id(furry)"));
PPipe pi = Pipe::query(Query<Pipe> ("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<Pipe> ("stream(hairy)"));
PPipe p2 = Pipe::query(Query<Pipe> ("stream(furry)"));
PPipe p1 = Pipe::query("stream(hairy)");
PPipe p2 = Pipe::query("stream(furry)");
CHECK (map[p1] == "master_hairy");
CHECK (map[p2] == "master_furry");

View file

@ -159,7 +159,7 @@ lumiera::query::setFakeBypass(pipeWithSpecificStream); /////////////////////////
void
forget (string pID)
{
PPipe pipe = Pipe::query (Query<Pipe> ("pipe("+pID+")"));
PPipe pipe = Pipe::query ("pipe("+pID+")");
REQUIRE (find (pipe->getPipeID()), "test assumes pre-registered default pipe");
long cnt = pipe.use_count();

View file

@ -104,13 +104,13 @@ namespace test {
void
retrieveSimpleDefault (string)
{
PPipe pipe1 = Pipe::query (Query<Pipe> ("")); // "the default pipe"
PPipe pipe1 = Pipe::query (""); // "the default pipe"
PPipe pipe2;
// several variants to query for "the default pipe"
pipe2 = Pipe::query (Query<Pipe> (""));
pipe2 = Pipe::query ("");
CHECK (pipe2 == pipe1);
pipe2 = Pipe::query (Query<Pipe> ("default(X)"));
pipe2 = Pipe::query ("default(X)");
CHECK (pipe2 == pipe1);
pipe2 = Session::current->defaults(Query<Pipe> ());
CHECK (pipe2 == pipe1);
@ -124,7 +124,7 @@ namespace test {
void
retrieveConstrainedDefault (string pID, string sID)
{
PPipe pipe1 = Pipe::query (Query<Pipe> ("")); // "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<Pipe> (query_for_sID));
PPipe pipe2 = Pipe::query (query_for_sID);
CHECK (pipe2->getStreamID() == StreamType::ID(sID));
CHECK (pipe2 != pipe1);
CHECK (pipe2 == Pipe::query (Query<Pipe> (query_for_sID))); // reproducible
CHECK (pipe2 == Pipe::query (query_for_sID)); // reproducible
}