introduce an explicit StreamType::ID
This commit is contained in:
parent
9c86deb18c
commit
7043db90ee
12 changed files with 57 additions and 24 deletions
|
|
@ -28,7 +28,7 @@
|
|||
#include <string>
|
||||
#include <typeinfo>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/format.hpp> /////////////////////////////////////////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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include "lib/symbol.hpp"
|
||||
#include "lib/query.hpp"
|
||||
#include "proc/asset/entry-id.hpp"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
|
|
@ -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<StreamType> 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?
|
||||
|
|
|
|||
|
|
@ -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(); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "proc/asset/struct.hpp"
|
||||
#include "proc/asset/procpatt.hpp"
|
||||
#include "lib/streamtype.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
|
@ -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<Pipe>::ID(HashVal id) : ID<Struct> (id) {};
|
||||
inline ID<Pipe>::ID(Pipe const& pipe) : ID<Struct> (pipe.getID()) {};
|
||||
inline ID<Pipe>::ID(PPipe const& pipe) : ID<Struct> (pipe->getID()) {};
|
||||
inline ID<Pipe>::operator PPipe() const { return Pipe::lookup(*this); }
|
||||
|
||||
inline
|
||||
ID<Pipe>::operator PPipe() const
|
||||
{
|
||||
return Pipe::lookup(*this);
|
||||
}
|
||||
|
||||
inline StreamType::ID
|
||||
ID<Pipe>::streamType() const
|
||||
{
|
||||
return Pipe::lookup(*this)->getStreamID();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ namespace asset {
|
|||
normaliseID (pipeID);
|
||||
normaliseID (streamID);
|
||||
static format descriptor("pipe(%s), stream(%s).");
|
||||
Pipe* pP = impl_->fabricate (Query<Pipe> (descriptor % pipeID % streamID));
|
||||
Pipe* pP = impl_->fabricate (Query<Pipe> (str(descriptor % pipeID % streamID)));
|
||||
return AssetManager::instance().wrap (*pP);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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) ;
|
||||
|
||||
|
|
|
|||
|
|
@ -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<const ProcPatt>("stream("+sID+")")));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ namespace test {
|
|||
{
|
||||
PPipe srcP = Pipe::lookup (sourcePipeID);
|
||||
format queryPattern ("id(master_%1%), stream(%1%), ord(%2%)");
|
||||
return Query<Pipe> (queryPattern % srcP->getStreamID() % seqNr);
|
||||
return Query<Pipe> (str(queryPattern % srcP->getStreamID() % seqNr));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include "common/configrules.hpp"
|
||||
#include "proc/assetmanager.hpp"
|
||||
#include "proc/mobject/session.hpp"
|
||||
#include "lib/streamtype.hpp"
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
|
|
@ -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<Pipe> ("stream("+sID+")")));
|
||||
// can't be registered with this query, due to failure caused by wrong stream-ID
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include "proc/asset/pipe.hpp"
|
||||
#include "proc/assetmanager.hpp"
|
||||
#include "proc/mobject/session.hpp"
|
||||
#include "lib/streamtype.hpp"
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue