try to get rid of the query functions on asset::Struct (#706)
This commit is contained in:
parent
7a53f65508
commit
1f511c327a
11 changed files with 46 additions and 55 deletions
|
|
@ -37,12 +37,14 @@ namespace asset {
|
|||
* default wiring.
|
||||
*/
|
||||
Pipe::Pipe ( const Asset::Ident& idi
|
||||
, string const& streamID
|
||||
, PProcPatt& wiring
|
||||
, string shortName
|
||||
, string longName
|
||||
)
|
||||
)
|
||||
: Struct (idi)
|
||||
, wiringTemplate(wiring)
|
||||
, wiringTemplate_(wiring)
|
||||
, streamID_(streamID)
|
||||
, shortDesc (shortName)
|
||||
, longDesc (longName)
|
||||
{
|
||||
|
|
@ -50,7 +52,7 @@ namespace asset {
|
|||
if (isnil (shortDesc))
|
||||
shortDesc = string(idi);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
PPipe
|
||||
|
|
@ -62,11 +64,11 @@ namespace asset {
|
|||
void
|
||||
Pipe::switchProcPatt (PProcPatt& another)
|
||||
{
|
||||
wiringTemplate = another;
|
||||
wiringTemplate_ = another;
|
||||
TODO ("trigger rebuild fixture");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace asset
|
||||
|
|
|
|||
|
|
@ -55,9 +55,11 @@ namespace asset {
|
|||
* of the model forming a processing pipe
|
||||
* for generating media output
|
||||
*/
|
||||
class Pipe : public Struct
|
||||
class Pipe
|
||||
: public Struct
|
||||
{
|
||||
PProcPatt wiringTemplate;
|
||||
PProcPatt wiringTemplate_;
|
||||
const string streamID_; ///< @todo just a placeholder for now 10/10
|
||||
|
||||
public:
|
||||
string shortDesc;
|
||||
|
|
@ -70,13 +72,15 @@ namespace asset {
|
|||
|
||||
|
||||
protected:
|
||||
Pipe (Asset::Ident const&, PProcPatt& wiring, string shortName ="", string longName ="") ;
|
||||
Pipe (Asset::Ident const&, string const& streamID, PProcPatt& wiring, string shortName ="", string longName ="") ;
|
||||
friend class StructFactory;
|
||||
friend class StructFactoryImpl;
|
||||
|
||||
public:
|
||||
const string& getPipeID() const { return ident.name; }
|
||||
const PProcPatt& getProcPatt() const { return wiringTemplate; }
|
||||
string const& getPipeID() const { return ident.name; }
|
||||
string const& getStreamID() const { return streamID_; }
|
||||
PProcPatt const& getProcPatt() const { return wiringTemplate_; }
|
||||
|
||||
|
||||
/** use another wiring template. Triggers complete rebuild of the render engine. */
|
||||
void switchProcPatt (PProcPatt& another);
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@ namespace asset
|
|||
|
||||
|
||||
/** create a new ProcPatt asset as a literal copy
|
||||
* of this one. The new ProcPatt can then be customized
|
||||
* of this one. The new ProcPatt can then be customised
|
||||
* independently of the original one. This allows using
|
||||
* some ProcPatt as a template for creating more
|
||||
* spezialized patterns.
|
||||
* specialised patterns.
|
||||
*/
|
||||
P<ProcPatt>
|
||||
ProcPatt::newCopy (string newID) const
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ using std::vector;
|
|||
|
||||
|
||||
|
||||
namespace asset
|
||||
{
|
||||
namespace asset {
|
||||
|
||||
using lumiera::P;
|
||||
using lib::Symbol;
|
||||
|
||||
|
|
@ -51,7 +51,8 @@ namespace asset
|
|||
* representing information how to build some part
|
||||
* of the render engine's processing nodes network.
|
||||
*/
|
||||
class ProcPatt : public Struct
|
||||
class ProcPatt
|
||||
: public Struct
|
||||
{
|
||||
InstructionSequence instructions_;
|
||||
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ namespace asset {
|
|||
* Implementation details, especially concerning how configuration
|
||||
* queries are resolved and when to create new objects automatically.
|
||||
* @todo better use a general struct traits class, esp.for creating the Ident
|
||||
* @todo shouldn't some of the generic factory logic be moved over into the struct baseclass? ////////////////TICKET #565
|
||||
*/
|
||||
class StructFactoryImpl
|
||||
{
|
||||
|
|
@ -188,6 +189,7 @@ namespace asset {
|
|||
if (isnil (streamID)) streamID = "default";
|
||||
PProcPatt processingPattern = Session::current->defaults (Query<const ProcPatt>("stream("+streamID+")"));
|
||||
return new Pipe( idi
|
||||
, streamID
|
||||
, processingPattern
|
||||
); ///////////////////////TICKET #565 maybe store the capabilities query within the Struct asset somehow?
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
/** @file struct-scheme.hpp
|
||||
** Naming and labeling scheme for structural assets.
|
||||
** Naming and labelling scheme for structural assets.
|
||||
** Preconfigured traits data for the relevant types encountered in
|
||||
** Lumiera's session data model.
|
||||
**
|
||||
|
|
|
|||
|
|
@ -49,22 +49,6 @@ namespace asset {
|
|||
|
||||
|
||||
|
||||
/** query the currently defined properties of this
|
||||
structural asset for a stream-ID predicate */
|
||||
const string
|
||||
Struct::queryStreamID() const
|
||||
{
|
||||
return lumiera::query::extractID ("stream", this->ident.name);
|
||||
}
|
||||
|
||||
/** query the currently defined properties of this
|
||||
structural asset for a pipe-ID predicate */
|
||||
const string
|
||||
Struct::queryPipeID() const
|
||||
{
|
||||
return lumiera::query::extractID ("pipe", this->ident.name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** storage for the static StructFactory instance */
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
** on demand, just by referral. Thus, the collection of these assets provides a map
|
||||
** for exploring the current session's structure and allow for tweaking of the
|
||||
** default behaviour.
|
||||
** - Track acts as unique track ID
|
||||
** - Track acts as unique track ID <i>(note: to be removed and replaced by a plain \c entryID )</i>
|
||||
** - Timeline and Sequence are facades, part of the session API
|
||||
** - Pipe is an attachment point for wiring connections and defines a StreamType
|
||||
** - ProcPatt is used as a blueprint in the build process, a standard connection pattern
|
||||
|
|
@ -90,7 +90,7 @@ namespace asset {
|
|||
ID (size_t id);
|
||||
ID (const Struct&);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -114,8 +114,6 @@ namespace asset {
|
|||
return static_cast<const ID<Struct>& > (Asset::getID());
|
||||
}
|
||||
|
||||
const string queryStreamID() const;
|
||||
const string queryPipeID() const;
|
||||
|
||||
|
||||
protected:
|
||||
|
|
@ -126,7 +124,7 @@ namespace asset {
|
|||
|
||||
// definition of ID<Struct> ctors is possible now,
|
||||
// after providing full definition of class Struct
|
||||
|
||||
|
||||
inline ID<Struct>::ID(size_t id) : ID<Asset> (id) {};
|
||||
inline ID<Struct>::ID(const Struct& stru) : ID<Asset> (stru.getID()) {};
|
||||
|
||||
|
|
@ -141,11 +139,11 @@ namespace asset {
|
|||
class StructFactory : public lib::Factory<asset::Struct>
|
||||
{
|
||||
scoped_ptr<StructFactoryImpl> impl_;
|
||||
|
||||
|
||||
protected:
|
||||
StructFactory ();
|
||||
friend class Struct;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
typedef P<asset::Struct> PType;
|
||||
|
|
@ -160,8 +158,8 @@ namespace asset {
|
|||
|
||||
P<Pipe> newPipe (string pipeID, string streamID);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace asset
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -88,13 +88,13 @@ namespace asset
|
|||
ASSERT (thePipe);
|
||||
ASSERT (thePipe->getProcPatt());
|
||||
ASSERT (thePipe->getPipeID() == pID_sane);
|
||||
ASSERT (thePipe->getProcPatt()->queryStreamID() == sID);
|
||||
ASSERT (thePipe->getStreamID() == sID);
|
||||
ASSERT (thePipe->shortDesc == pID_sane);
|
||||
|
||||
Asset::Ident idi = thePipe->ident;
|
||||
ASSERT (idi.org == "lumi");
|
||||
ASSERT (contains (idi.name, thePipe->getPipeID()));
|
||||
ASSERT (contains (idi.name, thePipe->getProcPatt()->queryStreamID()));
|
||||
ASSERT (contains (idi.name, thePipe->getStreamID()));
|
||||
|
||||
Category cat (idi.category);
|
||||
Category refcat (STRUCT,"pipes");
|
||||
|
|
@ -133,8 +133,8 @@ namespace asset
|
|||
ASSERT (pipe1 == Session::current->defaults (Query<Pipe>()));
|
||||
ASSERT (pipe1->ident.category.hasKind(VIDEO));
|
||||
ASSERT (pipe1->getProcPatt());
|
||||
PProcPatt popa = Session::current->defaults (Query<const ProcPatt>("pipe(default)"));
|
||||
ASSERT (popa == pipe1->getProcPatt());
|
||||
PProcPatt propa = Session::current->defaults (Query<const ProcPatt>("pipe(default)"));
|
||||
ASSERT (propa == pipe1->getProcPatt());
|
||||
|
||||
// several variants to query for "the default pipe"
|
||||
pipe2 = Session::current->defaults(Query<Pipe> ());
|
||||
|
|
@ -144,10 +144,10 @@ namespace asset
|
|||
pipe2 = asset::Struct::retrieve (Query<Pipe> ("pipe(default)"));
|
||||
ASSERT (pipe2 == pipe1);
|
||||
|
||||
string sID = popa->queryStreamID(); // sort of a "default stream type"
|
||||
string sID = pipe1->getStreamID(); // sort of a "default stream type"
|
||||
PPipe pipe3 = Pipe::query ("stream("+sID+")");
|
||||
ASSERT (pipe3);
|
||||
ASSERT (pipe3->getProcPatt()->queryStreamID() == sID);
|
||||
ASSERT (pipe3->getStreamID() == sID);
|
||||
ASSERT (pipe3->getProcPatt() == Session::current->defaults (Query<const ProcPatt>("stream("+sID+")")));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ namespace asset {
|
|||
PPipe pipe2 = Struct::retrieve.newPipe (newID("pipe"), sID );
|
||||
|
||||
ASSERT (pipe1 != pipe2);
|
||||
ASSERT (sID == pipe2->getProcPatt()->queryStreamID());
|
||||
ASSERT (sID == pipe2->getStreamID());
|
||||
|
||||
ASSERT (!find (pipe1->getPipeID()), "accidental clash of random test-IDs");
|
||||
ASSERT (!find (pipe2->getPipeID()), "accidental clash of random test-IDs");
|
||||
|
|
@ -116,7 +116,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->getProcPatt()->queryStreamID(), "accidental clash");
|
||||
ASSERT (sID != 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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ namespace test {
|
|||
retrieveConstrainedDefault (string pID, string sID)
|
||||
{
|
||||
PPipe pipe1 = Pipe::query (""); // "the default pipe"
|
||||
ASSERT (sID != pipe1->getProcPatt()->queryStreamID(),
|
||||
ASSERT (sID != pipe1->getStreamID(),
|
||||
"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 +126,7 @@ namespace test {
|
|||
|
||||
string query_for_sID ("stream("+sID+")");
|
||||
PPipe pipe2 = Pipe::query (query_for_sID);
|
||||
ASSERT (sID == pipe2->getProcPatt()->queryStreamID());
|
||||
ASSERT (sID == pipe2->getStreamID());
|
||||
ASSERT (pipe2 != pipe1);
|
||||
ASSERT (pipe2 == Pipe::query (query_for_sID)); // reproducible
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue