diff --git a/src/lib/query.hpp b/src/lib/query.hpp index 283292b24..2e3186cc6 100644 --- a/src/lib/query.hpp +++ b/src/lib/query.hpp @@ -28,7 +28,7 @@ #include #include -#include +#include /////////////////////////////////////////TICKET #166 Oh RLY ... need to do away with this #include "lib/symbol.hpp" @@ -64,7 +64,7 @@ namespace lumiera { { public: explicit Query (string const& predicate="") : string(predicate) {} - explicit Query (format& pattern) : string(str(pattern)) {} +// explicit Query (format& pattern) : string(str(pattern)) {} //////////////TICKET #166 outch... that needs to disappear const string asKey() const { diff --git a/src/lib/streamtype.hpp b/src/lib/streamtype.hpp index 6dc5747fc..cf45ad59c 100644 --- a/src/lib/streamtype.hpp +++ b/src/lib/streamtype.hpp @@ -37,6 +37,7 @@ #include "lib/symbol.hpp" #include "lib/query.hpp" +#include "proc/asset/entry-id.hpp" #include @@ -47,7 +48,7 @@ namespace lumiera { /** - * + * TODO write type comment */ struct StreamType : boost::noncopyable { @@ -72,6 +73,8 @@ namespace lumiera { class ImplFacade; class ImplConstraint; + typedef asset::EntryID ID; + Prototype const& prototype; ImplFacade * implType; /////////////TODO: really by ptr??? @@ -149,9 +152,9 @@ namespace lumiera { * and use it to create a new framebuffer */ virtual DataBuffer* createFrame () const =0; - /** similarily create a impl type which complies to this constraint + /** Similarly create a impl type which complies to this constraint * as well as to the additional constraints (e.g. frame size). - * Create a new framebuffer of the resutling type */ + * Create a new frame buffer of the resulting type */ virtual DataBuffer* createFrame (ImplConstraint const& furtherConstraints) const =0; //TODO: do we need functions to represent and describe this constraint? diff --git a/src/proc/asset/entry-id.hpp b/src/proc/asset/entry-id.hpp index 3f736892e..b16739a02 100644 --- a/src/proc/asset/entry-id.hpp +++ b/src/proc/asset/entry-id.hpp @@ -241,7 +241,7 @@ namespace asset { } friend ostream& operator<< (ostream& os, EntryID const& id) { return os << string(id); } - friend bool operator< (EntryID const& i1, EntryID const& i2) { return i1.getSym() < i2.getSym(); } + friend bool operator< (EntryID const& i1, EntryID const& i2) { return i1.getSym() < i2.getSym(); } }; diff --git a/src/proc/asset/pipe.cpp b/src/proc/asset/pipe.cpp index 2188a8138..8e823313a 100644 --- a/src/proc/asset/pipe.cpp +++ b/src/proc/asset/pipe.cpp @@ -38,7 +38,7 @@ namespace asset { * default wiring. */ Pipe::Pipe ( const Asset::Ident& idi - , string const& streamID + , string const& streamID ////////////////////////////////////////TICKET #648 , PProcPatt& wiring , string shortName , string longName diff --git a/src/proc/asset/pipe.hpp b/src/proc/asset/pipe.hpp index 35c64664d..aed616264 100644 --- a/src/proc/asset/pipe.hpp +++ b/src/proc/asset/pipe.hpp @@ -26,6 +26,7 @@ #include "proc/asset/struct.hpp" #include "proc/asset/procpatt.hpp" +#include "lib/streamtype.hpp" #include @@ -34,6 +35,7 @@ namespace asset { using lumiera::P; + using lumiera::StreamType; using std::string; class Pipe; @@ -49,9 +51,12 @@ namespace asset { ID (PPipe const&); /** allows a Pipe-ID to stand in for a full Pipe Asset - * @throw error::Invalid when there is no corresponding Pipe - */ + * @throw error::Invalid when there is no corresponding Pipe */ operator PPipe() const; + + /** allows to fetch the StreamType directly just from a Pipe-ID + * @throw error::Invalid when there is no corresponding Pipe */ + StreamType::ID streamType() const; }; @@ -65,7 +70,7 @@ namespace asset { : public Struct { PProcPatt wiringTemplate_; - const string streamID_; ///< @todo just a placeholder for now 10/10 + StreamType::ID streamID_; ////////////////////////////////////////TICKET #648 public: string shortDesc; @@ -84,7 +89,7 @@ namespace asset { public: string const& getPipeID() const { return ident.name; } - string const& getStreamID() const { return streamID_; } + StreamType::ID getStreamID() const { return streamID_; } ////////////////////////////////////////TICKET #648 PProcPatt const& getProcPatt() const { return wiringTemplate_; } @@ -104,8 +109,18 @@ namespace asset { inline ID::ID(HashVal id) : ID (id) {}; inline ID::ID(Pipe const& pipe) : ID (pipe.getID()) {}; inline ID::ID(PPipe const& pipe) : ID (pipe->getID()) {}; - inline ID::operator PPipe() const { return Pipe::lookup(*this); } + inline + ID::operator PPipe() const + { + return Pipe::lookup(*this); + } + + inline StreamType::ID + ID::streamType() const + { + return Pipe::lookup(*this)->getStreamID(); + } diff --git a/src/proc/asset/struct.cpp b/src/proc/asset/struct.cpp index 9145c2ad8..70f893149 100644 --- a/src/proc/asset/struct.cpp +++ b/src/proc/asset/struct.cpp @@ -148,7 +148,7 @@ namespace asset { normaliseID (pipeID); normaliseID (streamID); static format descriptor("pipe(%s), stream(%s)."); - Pipe* pP = impl_->fabricate (Query (descriptor % pipeID % streamID)); + Pipe* pP = impl_->fabricate (Query (str(descriptor % pipeID % streamID))); return AssetManager::instance().wrap (*pP); } diff --git a/src/proc/control/stypemanager.cpp b/src/proc/control/stypemanager.cpp index 10131f130..4ba2fda19 100644 --- a/src/proc/control/stypemanager.cpp +++ b/src/proc/control/stypemanager.cpp @@ -79,6 +79,14 @@ namespace control { } + /** */ + StreamType const& + STypeManager::getType (StreamType::ID stID) + { + UNIMPLEMENTED ("get type just by symbolic ID (query defaults manager)"); + } + + StreamType const& STypeManager::getType (StreamType::Prototype const& protoType) { diff --git a/src/proc/control/stypemanager.hpp b/src/proc/control/stypemanager.hpp index 70003eef4..cd6a311df 100644 --- a/src/proc/control/stypemanager.hpp +++ b/src/proc/control/stypemanager.hpp @@ -53,6 +53,8 @@ namespace control { * just a symbolic ID. Effectively this queries a default */ StreamType const& getType (Symbol sTypeID) ; + StreamType const& getType (StreamType::ID stID) ; + /** build or retrieve a complete StreamType implementing the given Prototype */ StreamType const& getType (StreamType::Prototype const& protoType) ; diff --git a/tests/components/proc/asset/basicpipetest.cpp b/tests/components/proc/asset/basicpipetest.cpp index 70f644ed1..e3491cba4 100644 --- a/tests/components/proc/asset/basicpipetest.cpp +++ b/tests/components/proc/asset/basicpipetest.cpp @@ -42,13 +42,13 @@ using std::string; using std::cout; -namespace asset - { - namespace test - { +namespace asset { +namespace test { + using mobject::Session; using lumiera::Query; using lumiera::query::normaliseID; + using lumiera::StreamType; @@ -88,7 +88,7 @@ namespace asset ASSERT (thePipe); ASSERT (thePipe->getProcPatt()); ASSERT (thePipe->getPipeID() == pID_sane); - ASSERT (thePipe->getStreamID() == sID); + ASSERT (thePipe->getStreamID() == StreamType::ID(sID)); ASSERT (thePipe->shortDesc == pID_sane); Asset::Ident idi = thePipe->ident; @@ -147,7 +147,7 @@ namespace asset string sID = pipe1->getStreamID(); // sort of a "default stream type" PPipe pipe3 = Pipe::query ("stream("+sID+")"); ASSERT (pipe3); - ASSERT (pipe3->getStreamID() == sID); + ASSERT (pipe3->getStreamID() == StreamType::ID(sID)); ASSERT (pipe3->getProcPatt() == Session::current->defaults (Query("stream("+sID+")"))); } diff --git a/tests/components/proc/mobject/output-mapping-test.cpp b/tests/components/proc/mobject/output-mapping-test.cpp index db6f36ee1..5f4a5be1a 100644 --- a/tests/components/proc/mobject/output-mapping-test.cpp +++ b/tests/components/proc/mobject/output-mapping-test.cpp @@ -76,7 +76,7 @@ namespace test { { PPipe srcP = Pipe::lookup (sourcePipeID); format queryPattern ("id(master_%1%), stream(%1%), ord(%2%)"); - return Query (queryPattern % srcP->getStreamID() % seqNr); + return Query (str(queryPattern % srcP->getStreamID() % seqNr)); } }; diff --git a/tests/components/proc/mobject/session/defsmanagerimpltest.cpp b/tests/components/proc/mobject/session/defsmanagerimpltest.cpp index 954730804..44a2184cd 100644 --- a/tests/components/proc/mobject/session/defsmanagerimpltest.cpp +++ b/tests/components/proc/mobject/session/defsmanagerimpltest.cpp @@ -31,6 +31,7 @@ #include "common/configrules.hpp" #include "proc/assetmanager.hpp" #include "proc/mobject/session.hpp" +#include "lib/streamtype.hpp" #include @@ -49,6 +50,7 @@ namespace asset { using lumiera::ConfigRules; using lumiera::query::QueryHandler; + using lumiera::StreamType; @@ -94,6 +96,7 @@ namespace asset { define_and_search () { string sID = newID ("stream"); + StreamType::ID stID (sID); // create Pipes explicitly // (without utilising default queries) @@ -101,7 +104,7 @@ namespace asset { PPipe pipe2 = Struct::retrieve.newPipe (newID("pipe"), sID ); ASSERT (pipe1 != pipe2); - ASSERT (sID == pipe2->getStreamID()); + ASSERT (stID == pipe2->getStreamID()); ASSERT (!find (pipe1->getPipeID()), "accidental clash of random test-IDs"); ASSERT (!find (pipe2->getPipeID()), "accidental clash of random test-IDs"); @@ -116,7 +119,7 @@ lumiera::query::setFakeBypass("stream("+sID+")"); ////////////////////////////// ASSERT ( find (pipe1->getPipeID()), "failure declaring object as default"); ASSERT ( find (pipe2->getPipeID()), "failure declaring object as default"); - ASSERT (sID != pipe1->getStreamID(), "accidental clash"); + ASSERT (stID != pipe1->getStreamID(), "accidental clash"); ASSERT (!Session::current->defaults.define (pipe1, Query ("stream("+sID+")"))); // can't be registered with this query, due to failure caused by wrong stream-ID } diff --git a/tests/components/proc/mobject/session/defsmanagertest.cpp b/tests/components/proc/mobject/session/defsmanagertest.cpp index 608dce6db..8b67522c9 100644 --- a/tests/components/proc/mobject/session/defsmanagertest.cpp +++ b/tests/components/proc/mobject/session/defsmanagertest.cpp @@ -32,6 +32,7 @@ #include "proc/asset/pipe.hpp" #include "proc/assetmanager.hpp" #include "proc/mobject/session.hpp" +#include "lib/streamtype.hpp" #include @@ -49,6 +50,7 @@ namespace test { using mobject::Session; using lumiera::Query; using lumiera::query::normaliseID; + using lumiera::StreamType; /** shortcut: run just a query @@ -117,7 +119,7 @@ namespace test { retrieveConstrainedDefault (string pID, string sID) { PPipe pipe1 = Pipe::query (""); // "the default pipe" - ASSERT (sID != pipe1->getStreamID(), + ASSERT ( pipe1->getStreamID() != StreamType::ID(sID), "stream-ID \"%s\" not suitable for test, because " "the default-pipe \"%s\" happens to have the same " "stream-ID. We need it to be different", @@ -126,7 +128,7 @@ namespace test { string query_for_sID ("stream("+sID+")"); PPipe pipe2 = Pipe::query (query_for_sID); - ASSERT (sID == pipe2->getStreamID()); + ASSERT (pipe2->getStreamID() == StreamType::ID(sID)); ASSERT (pipe2 != pipe1); ASSERT (pipe2 == Pipe::query (query_for_sID)); // reproducible }