remove the separate pipeID field, because now the asset name is sufficient

This commit is contained in:
Fischlurch 2010-10-29 06:09:06 +02:00
parent de54e46a12
commit 7a53f65508
11 changed files with 32 additions and 24 deletions

View file

@ -124,7 +124,7 @@ namespace lumiera {
{
typedef WrapReturn<Pipe>::Wrapper Ptr;
Ptr newPipe (Struct::retrieve (pipeID, streamID));
Ptr newPipe (Struct::retrieve.newPipe (pipeID, streamID));
answer_->insert (entry<Pipe> (q, newPipe));
return true; // denotes query will now succeed...
}

View file

@ -38,6 +38,7 @@ using util::contains;
using util::removeall;
using util::for_each;
using util::and_all;
using util::isnil;
using util::cStr;
@ -84,6 +85,15 @@ namespace asset {
format id_tuple("Asset(%2%:%3%.%1% v%4%)");
return str (id_tuple % ident.name % ident.category % ident.org % ident.version);
}
bool
Asset::Ident::isValid() const
{
return !isnil (name)
&& !isnil (org)
&& version <= 1000000;
}

View file

@ -190,6 +190,8 @@ namespace asset {
bool operator< (Ident const& oi) const { return compare (oi) < 0; }
operator string () const;
bool isValid() const;
};

View file

@ -38,19 +38,17 @@ namespace asset {
*/
Pipe::Pipe ( const Asset::Ident& idi
, PProcPatt& wiring
, const string& pipeID
, string shortName
, string longName
)
: Struct (idi),
pipeID_ (pipeID),
wiringTemplate(wiring),
shortDesc (shortName),
longDesc (longName)
: Struct (idi)
, wiringTemplate(wiring)
, shortDesc (shortName)
, longDesc (longName)
{
REQUIRE (!isnil (pipeID));
REQUIRE (idi.isValid());
if (isnil (shortDesc))
shortDesc = pipeID;
shortDesc = string(idi);
}

View file

@ -57,7 +57,6 @@ namespace asset {
*/
class Pipe : public Struct
{
const string pipeID_;
PProcPatt wiringTemplate;
public:
@ -71,12 +70,12 @@ namespace asset {
protected:
Pipe (const Asset::Ident&, PProcPatt& wiring, const string& pipeID, string shortName ="", string longName ="") ;
Pipe (Asset::Ident const&, PProcPatt& wiring, string shortName ="", string longName ="") ;
friend class StructFactory;
friend class StructFactoryImpl;
public:
const string& getPipeID() const { return pipeID_; }
const string& getPipeID() const { return ident.name; }
const PProcPatt& getProcPatt() const { return wiringTemplate; }
/** use another wiring template. Triggers complete rebuild of the render engine. */
@ -90,7 +89,7 @@ namespace asset {
// catch up with postponed definition of ID<Struct> ctors...
//
inline ID<Pipe>::ID(size_t id) : ID<Struct> (id) {};
inline ID<Pipe>::ID(const Pipe& pipe) : ID<Struct> (pipe.getID()) {};
inline ID<Pipe>::ID(Pipe const& pipe) : ID<Struct> (pipe.getID()) {};

View file

@ -177,21 +177,19 @@ namespace asset {
{
TODO ("actually extract properties/capabilities from the query...");
return new ProcPatt (createIdent (caps));
}
} ///////////////////////TICKET #565 maybe store the capabilities query within the Struct asset somehow?
template<>
inline Pipe*
StructFactoryImpl::fabricate (const Query<Pipe>& caps)
{
const Asset::Ident idi (createIdent (caps));
string pipeID = extractID ("pipe", idi.name);
string streamID = extractID ("stream", caps);
if (isnil (streamID)) streamID = "default";
PProcPatt processingPattern = Session::current->defaults (Query<const ProcPatt>("stream("+streamID+")"));
return new Pipe( idi
, processingPattern
, pipeID
);
); ///////////////////////TICKET #565 maybe store the capabilities query within the Struct asset somehow?
}
template<>

View file

@ -58,7 +58,7 @@ namespace asset {
}
/** query the currently defined properties of this
structural asset for a stream-ID predicate */
structural asset for a pipe-ID predicate */
const string
Struct::queryPipeID() const
{
@ -141,7 +141,7 @@ namespace asset {
* @see DefaultsManager
*/
P<Pipe>
StructFactory::operator() (string pipeID, string streamID)
StructFactory::newPipe (string pipeID, string streamID)
{
normaliseID (pipeID);
normaliseID (streamID);

View file

@ -153,11 +153,12 @@ namespace asset {
template<class STRU>
P<STRU> operator() (Query<STRU> const& query);
P<Pipe> operator() (string pipeID, string streamID);
// P<Timeline> operator() (MORef<Binding>); ///////////TODO doesn't this create circular includes?? Any better idea how to refer to an existing binding?
template<class STRU>
P<STRU> newInstance (Symbol nameID ="");
P<Pipe> newPipe (string pipeID, string streamID);
};

View file

@ -83,7 +83,7 @@ namespace asset
normaliseID (pID_sane);
ASSERT (pID_sane != pID);
PPipe thePipe = asset::Struct::retrieve (pID,sID);
PPipe thePipe = asset::Struct::retrieve.newPipe (pID,sID);
ASSERT (thePipe);
ASSERT (thePipe->getProcPatt());

View file

@ -97,8 +97,8 @@ namespace asset {
// create Pipes explicitly
// (without utilising default queries)
PPipe pipe1 = Struct::retrieve (newID("pipe"), newID("stream"));
PPipe pipe2 = Struct::retrieve (newID("pipe"), sID );
PPipe pipe1 = Struct::retrieve.newPipe (newID("pipe"), newID("stream"));
PPipe pipe2 = Struct::retrieve.newPipe (newID("pipe"), sID );
ASSERT (pipe1 != pipe2);
ASSERT (sID == pipe2->getProcPatt()->queryStreamID());

View file

@ -169,7 +169,7 @@ namespace test {
ASSERT (3 == pipe1.use_count()); // that's the problem; it should be 2
QueryHandler<Pipe>& typeHandler = ConfigRules::instance();
PPipe pipe2 = asset::Struct::retrieve (pID, "quatsch");
PPipe pipe2 = asset::Struct::retrieve.newPipe (pID, "quatsch");
typeHandler.resolve (pipe2, query_for_pID); // in the mock impl this has the side effect
ASSERT (pipe2); // of replacing the mock entry