From d33242b8cb1d759cb464dbefa620cf730998d034 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 10 Feb 2008 17:23:16 +0100 Subject: [PATCH] filled in lots of daunting details regarding structural assets. StructFactury still very preliminary. Now able to fill the table with mock queries. TODO: fix assertion failure... --- src/common/configrules.hpp | 34 ++++- src/common/query.hpp | 15 ++- src/common/query/mockconfigrules.cpp | 69 +++++++++- src/common/query/mockconfigrules.hpp | 23 +++- src/proc/asset/buildinstruct.cpp | 35 ----- src/proc/asset/buildinstruct.hpp | 93 +++++++++---- src/proc/asset/db.hpp | 4 +- src/proc/asset/port.hpp | 1 + src/proc/asset/proc.hpp | 3 + src/proc/asset/procpatt.cpp | 66 +++++++++- src/proc/asset/procpatt.hpp | 23 +++- src/proc/asset/struct.cpp | 105 ++++++++------- src/proc/asset/struct.hpp | 17 ++- src/proc/asset/structfactoryimpl.hpp | 161 +++++++++++++++++++++++ src/proc/asset/track.hpp | 2 +- src/proc/mobject/session/defsmanager.cpp | 2 +- wiki/renderengine.html | 6 +- 17 files changed, 518 insertions(+), 141 deletions(-) delete mode 100644 src/proc/asset/buildinstruct.cpp create mode 100644 src/proc/asset/structfactoryimpl.hpp diff --git a/src/common/configrules.hpp b/src/common/configrules.hpp index 94dbc8c48..d5189bbbe 100644 --- a/src/common/configrules.hpp +++ b/src/common/configrules.hpp @@ -50,10 +50,11 @@ #include "common/typelistutil.hpp" #include "common/singletonsubclass.hpp" +//TODO: is it sensible to bring in the types explicitly here? (it's not necessary, but may be convienient...) #include "proc/mobject/session/track.hpp" #include "proc/asset/procpatt.hpp" #include "proc/asset/port.hpp" - +#include "proc/asset/track.hpp" #include #include @@ -89,9 +90,8 @@ namespace cinelerra { }; - - typedef const char * const Symbol; - + + template < const Symbol SYM, // Predicate symbol typename SIG = bool(string) // Signature @@ -101,6 +101,17 @@ namespace cinelerra }; + /** + * the "backside" interface towards the classes participating + * in the configuration system (the config system will be + * delivering instances of these classes for a given query). + * This one currently is just brainstorming. The idea is that + * a participating class would provide such and TypeHandler + * implementing the predicates which make sense for this special + * type of object. Registering such a TypeHandler should create + * the necessary handler functions to be installed into + * the Prolog system. + */ template class TypeHandler { @@ -112,13 +123,25 @@ namespace cinelerra template TY make (Pred capability, TY& refObj =NIL); }; - + + /** + * the "frontside" interface: the Proc-Layer code can + * use this QueryHandler to retrieve instances of the + * type TY fulfilling the given Query. To start with, + * we use a mock implementation- + * @see cinelerra::query::LookupPreconfigured + * @see cinelerra::query::MockTable + */ template class QueryHandler { protected: virtual ~QueryHandler() { } public: + /** try to find or create an object of type TY + * fulfilling the given query. + * @return empty shared-ptr if not found, + */ virtual shared_ptr resolve (const Query& q) = 0; }; @@ -173,6 +196,7 @@ namespace cinelerra * rule based config query system */ typedef cinelerra::typelist::Types < mobject::session::Track + , asset::Track , asset::Port , const asset::ProcPatt > ::List diff --git a/src/common/query.hpp b/src/common/query.hpp index 85172d965..b5575f0da 100644 --- a/src/common/query.hpp +++ b/src/common/query.hpp @@ -26,22 +26,33 @@ #include +#include namespace cinelerra { using std::string; + + /* ==== comon definitions for rule based queries ==== */ + typedef const char * const Symbol; + + /** * Generic query interface for retrieving objects matching * some capability query */ - template + template class Query : public std::string { public: - Query (string predicate="") : string(predicate) {} + Query (const string& predicate="") : string(predicate) {} + + const string asKey() const + { + return string(typeid(OBJ).name())+": "+*this; + } }; diff --git a/src/common/query/mockconfigrules.cpp b/src/common/query/mockconfigrules.cpp index f761cbc0f..15181c24e 100644 --- a/src/common/query/mockconfigrules.cpp +++ b/src/common/query/mockconfigrules.cpp @@ -38,22 +38,83 @@ namespace cinelerra namespace query { + using asset::Struct; + using asset::Port; + using asset::PPort; + + using asset::ProcPatt; + using asset::PProcPatt; + + namespace + { + typedef std::pair AnyPair; + + /** helper to simplify creating mock table entries, wrapped correctly */ + template + AnyPair entry (const string& query, typename WrapReturn::Wrapper& obj) + { + return AnyPair ( Query (query).asKey() + , any(obj)); + } + + /** helper especially for creating structural assets from a capability query */ + template + AnyPair entry_Struct(Symbol caps) + { + typedef typename WrapReturn::Wrapper Ptr; + + Query query(caps); + Ptr obj = Struct::create (query); + return AnyPair(query, obj); + } + + } + + + /** hard coded answers to configuration queries */ + void + MockTable::fill_mock_table () + { + // for baiscporttest.cpp --------- + answer_->insert (entry_Struct ("stream(teststream)")); + } + + MockConfigRules::MockConfigRules () { - + WARN (config, "using a mock implementation of the ConfigQuery interface"); } - MockTable::MockTable () + MockTable::MockTable () + : answer_(new Tab()) { - TODO ("build the preconfigured table"); + fill_mock_table (); } + + + /** this is the (preliminary/mock) implementation + * handling queries for objects of a specific type + * and with capabilities or properties defined by + * the query. The real implementation would require + * a rule based system (Ichthyo plans to use YAP Prolog), + * while this dummy implementation simply relies on a + * table of pre-fabricated objects. Never fails. + * @return smart ptr (or similar) holding the object, + * maybe an empty smart ptr if not found + */ const any& MockTable::fetch_from_table_for (const string& queryStr) { - UNIMPLEMENTED ("fetch a preconfigured object from the table"); + static const any NOTFOUND; + + Tab::iterator i = answer_->find (queryStr); + if (i == answer_->end()) + return NOTFOUND; + else + return i->second; } diff --git a/src/common/query/mockconfigrules.hpp b/src/common/query/mockconfigrules.hpp index dfcfde39d..5e256a3b5 100644 --- a/src/common/query/mockconfigrules.hpp +++ b/src/common/query/mockconfigrules.hpp @@ -39,15 +39,18 @@ #define CINELERRA_MOCKCONFIGRULES_H #include "common/configrules.hpp" +#include "common/util.hpp" +#include #include #include +#include namespace cinelerra { - using std::string; + //using std::string; namespace query @@ -55,10 +58,13 @@ namespace cinelerra using asset::ProcPatt; using asset::PProcPatt; + using util::isnil; + using boost::any; using boost::any_cast; + /** a traits-class to define the smart-ptr to wrap the result */ template struct WrapReturn { typedef shared_ptr Wrapper; }; @@ -73,9 +79,17 @@ namespace cinelerra */ class MockTable : public cinelerra::ConfigRules { + typedef std::map Tab; + typedef boost::scoped_ptr PTab; + + PTab answer_; + protected: MockTable (); const any& fetch_from_table_for (const string& queryStr); + + private: + void fill_mock_table (); }; @@ -93,8 +107,11 @@ namespace cinelerra virtual Ret resolve (const Query& q) { - TODO ("handle mismatch and not-found case"); - return any_cast (fetch_from_table_for (q)); + const any& entry = fetch_from_table_for (q.asKey()); + if (!isnil (entry)) + return any_cast (entry); + else + return Ret(); // default-constructed empty smart ptr } }; diff --git a/src/proc/asset/buildinstruct.cpp b/src/proc/asset/buildinstruct.cpp deleted file mode 100644 index de19c647e..000000000 --- a/src/proc/asset/buildinstruct.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - BuildInstruct - Instructions for building some configuration of render nodes. - - Copyright (C) CinelerraCV - 2007, Hermann Vosseler - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -* *****************************************************/ - - -#include "proc/asset/buildinstruct.hpp" -#include "proc/asset/procpatt.hpp" -#include "proc/asset/proc.hpp" - -namespace asset - { - - /** */ - - - -} // namespace asset diff --git a/src/proc/asset/buildinstruct.hpp b/src/proc/asset/buildinstruct.hpp index 0a0062e25..d6eeaec0d 100644 --- a/src/proc/asset/buildinstruct.hpp +++ b/src/proc/asset/buildinstruct.hpp @@ -21,9 +21,18 @@ */ +/** @file buildinstruct.hpp + ** Helper classes used by asset::ProcPatt to represent the processing informations. + ** Consider these classes as owned by ProcPatt. Non-inline functions go to procpatt.cpp + ** + */ + + #ifndef ASSET_BUILDINSTRUCT_H #define ASSET_BUILDINSTRUCT_H + +#include #include using std::string; @@ -36,36 +45,74 @@ namespace asset class Proc; class ProcPatt; + typedef shared_ptr PProc; + typedef shared_ptr PProcPatt; - /** - * (Interface) building instructions to be executed by the Builder - * on the render node network under construction. - */ - class BuildInstruct + + static Symbol CURRENT = "current"; + + struct DoAttach { - }; - - - - class DoRecurse : public BuildInstruct - { - protected: - const ProcPatt* subPattern; - - }; - - - class DoAttach : public BuildInstruct - { - public: - const Proc* nodes; + vector nodes; /** identifying the point where the nodes should be attached */ - const string point; - + string point; + + DoAttach (Symbol where = CURRENT) + : point(where) + { } + + DoAttach (PProc& node, Symbol where = CURRENT) + : point(where) + { + nodes.push_back(node); + } + }; + struct DoRecurse + { + PProcPatt subPattern_; + + explicit DoRecurse (PProcPatt& pattern) : subPattern_(pattern) {} + }; + + + + class DoConditional + { + // How to do this? we need some context to test the condition... + }; + + + typedef boost::variant< DoAttach, DoRecurse, DoConditional > InstructEntry; + + /** + * (Interface) building instructions to be executed by the Builder + * on the render node network under construction. The purpose of this + * "micro language" is to be able to store in the configuration or session + * how certain parts of the model should be assembled. One important example + * is how to build a source reading chain to read and decode frames from a + * media file. Another example being a global audio Pipe, comprised of an + * EQ plugin, a fader and a panner. + * \par + * Build instructions are tightliy coupled to asset::ProcPatt and always + * created from there. + * @see ProcPatt::attach + * @see ProcPatt::operator+= + * + */ + struct BuildInstruct + : public InstructEntry + { + template + BuildInstruct (T& instr) : InstructEntry(instr) {} + }; + + + + } // namespace asset #endif diff --git a/src/proc/asset/db.hpp b/src/proc/asset/db.hpp index 8f228d01b..8de442102 100644 --- a/src/proc/asset/db.hpp +++ b/src/proc/asset/db.hpp @@ -118,8 +118,8 @@ namespace asset { try { - IdHashtable::const_iterator i = table.begin(); - IdHashtable::const_iterator e = table.end(); + IdHashtable::iterator i = table.begin(); + IdHashtable::iterator e = table.end(); for ( ; i!=e ; ++i ) i->second->dependants.clear(); diff --git a/src/proc/asset/port.hpp b/src/proc/asset/port.hpp index 8bb359789..c42af656b 100644 --- a/src/proc/asset/port.hpp +++ b/src/proc/asset/port.hpp @@ -69,6 +69,7 @@ namespace asset protected: Port (PProcPatt& wiring, string portID="", wstring shortDesc =wstring(), wstring longDesc =wstring()) ; friend class StructFactory; + friend class StructFactoryImpl; public: const string& getPortID() const { return portID_; } diff --git a/src/proc/asset/proc.hpp b/src/proc/asset/proc.hpp index fb9d2f494..f2a72cecd 100644 --- a/src/proc/asset/proc.hpp +++ b/src/proc/asset/proc.hpp @@ -46,6 +46,9 @@ namespace asset class Proc; class ProcFactory; + typedef shared_ptr PProc; + + template<> class ID : public ID diff --git a/src/proc/asset/procpatt.cpp b/src/proc/asset/procpatt.cpp index 3b267f1e4..ec9ecb781 100644 --- a/src/proc/asset/procpatt.cpp +++ b/src/proc/asset/procpatt.cpp @@ -22,8 +22,12 @@ #include "proc/asset/procpatt.hpp" -#include "proc/asset/buildinstruct.hpp" +#include "proc/asset/proc.hpp" #include "proc/assetmanager.hpp" +#include "proc/asset/buildinstruct.hpp" +#include "common/util.hpp" + +using util::isnil; namespace asset { @@ -45,14 +49,20 @@ namespace asset } /** */ - ProcPatt::ProcPatt (const string& properties, const vector& instr) + ProcPatt::ProcPatt (const string& properties) : Struct (createPatternIdent (properties)), - propDescriptor_ (properties), - instructions (instr) + propDescriptor_ (properties) { TODO ("verify building instructions, maybe preprocess..."); } + /** @internal used for creating a clone */ + ProcPatt::ProcPatt (const string& props, const InstructionSequence& instructs) + : Struct (createPatternIdent (props)), + propDescriptor_ (props), + instructions_ (instructs) + { } + /** query the currently defined properties of this processing pattern for a stream-ID predicate */ @@ -67,17 +77,59 @@ namespace asset /** create a new ProcPatt asset as a literal copy * of this one. The new ProcPatt can then be customized * independently of the original one. This allows using - * some ProcPatt as a template for creatind more + * some ProcPatt as a template for creating more * spezialized patterns. */ shared_ptr ProcPatt::newCopy (string newID) const { TODO ("implement the Pattern-ID within the propDescriptor!"); - ProcPatt* pP = new ProcPatt (this->propDescriptor_, this->instructions); + ProcPatt* pP = new ProcPatt (this->propDescriptor_, this->instructions_); return AssetManager::instance().wrap (*pP); } - + + + /** extend the processing instructions to add some Effect + * @param where denotes the insertion point where to attach the Effect + * @param node prototype of the Effect to be inserted when building. + */ + ProcPatt& + ProcPatt::attach(Symbol where, PProc& node) + { + DoAttach *last (0); + if ( !isnil (instructions_) + && (last = boost::get (&(instructions_.back()))) + && last->point==where + ) + // instead of adding a new build instruct entry, + // we can extend the list in the last "DoAttach" entry. + last->nodes.push_back(node); + else + { + DoAttach entry(node, where); + instructions_.push_back(BuildInstruct(entry)); + } + TODO ("declare dependency??"); + return *this; + } + + + /** extend the processing instructions by reference to another + * ProcPatt, which will be "executed" at this point while building. + * This allowes for using simple PorcPatt instances as building blocks + * to define more complicated patterns. + */ + ProcPatt& + ProcPatt::operator+= (PProcPatt& toReuse) + { + DoRecurse entry(toReuse); + instructions_.push_back(BuildInstruct (entry)); + TODO ("declare dependency??"); + + return *this; + } + + } // namespace asset diff --git a/src/proc/asset/procpatt.hpp b/src/proc/asset/procpatt.hpp index 2a786027b..5cd22e1e1 100644 --- a/src/proc/asset/procpatt.hpp +++ b/src/proc/asset/procpatt.hpp @@ -24,6 +24,7 @@ #ifndef ASSET_PROCPATT_H #define ASSET_PROCPATT_H +#include "common/query.hpp" #include "proc/asset/struct.hpp" #include @@ -34,26 +35,38 @@ using std::vector; namespace asset { - - class BuildInstruct; + using cinelerra::Symbol; + class Proc; + class ProcPatt; + class BuildInstruct; + typedef shared_ptr PProc; + typedef shared_ptr PProcPatt; + + typedef vector InstructionSequence; /** - * special type of structural Asset + * "Processing Pattern" is a structural Asset * representing information how to build some part * of the render engine's processing nodes network. */ class ProcPatt : public Struct { string propDescriptor_; - vector instructions; + InstructionSequence instructions_; + + ProcPatt (const string& props, const InstructionSequence& instructs); protected: - ProcPatt (const string& properties, const vector& instr); + explicit ProcPatt (const string& propDescriptor); + friend class StructFactoryImpl; public: const string& queryStreamID() const; shared_ptr newCopy (string newID) const; + + ProcPatt& attach (Symbol where, PProc& node); + ProcPatt& operator+= (PProcPatt& toReuse); }; diff --git a/src/proc/asset/struct.cpp b/src/proc/asset/struct.cpp index ad1191045..7aaab7b87 100644 --- a/src/proc/asset/struct.cpp +++ b/src/proc/asset/struct.cpp @@ -27,78 +27,64 @@ #include "proc/asset/track.hpp" #include "proc/asset/port.hpp" #include "proc/mobject/session.hpp" +#include "common/configrules.hpp" + +#include "proc/asset/structfactoryimpl.hpp" -#include "common/query.hpp" #include "common/util.hpp" #include "nobugcfg.h" using mobject::Session; using cinelerra::query::normalizeID; +using cinelerra::ConfigRules; +using cinelerra::query::QueryHandler; + + + namespace asset { - /****** NOTE: not implemented yet. What follows is a hack to build simple tests *******/ - - - namespace // common Struct Asset implementation details - { - /** @internal derive a sensible asset ident tuple when creating - * a track asset based on a query - * @todo define the actual naming scheme of struct assets - */ - const Asset::Ident - createTrackIdent (const Query& query) - { - string name ("track-" + query); // TODO something sensible here; append number, sanitize etc. - TODO ("track naming scheme??"); - Category category (STRUCT,"tracks"); - return Asset::Ident (name, category ); - } - - typedef std::pair PortIDs; - - PortIDs - createPortIdent (const Query& query) - { - string name ("port-" + query); // TODO get some more sensible dummy values - TODO ("port naming scheme??"); - return PortIDs (name, "mpeg"); // dummy stream type - } - } + /****** NOTE: not really implemented yet. What follows is partially a hack to build simple tests *******/ - StructFactory Struct::create; ///< storage for the static StructFactory instance + + /** storage for the static StructFactory instance */ + StructFactory Struct::create; + + + /** using private implementation detail class */ + StructFactory::StructFactory () + : impl_(new StructFactoryImpl(*this)) + { } - /** Factory method for Structural Asset instances. .... + /** Factory method for Structural Asset instances. + * First tries to relove the asset by issuing an capability query. + * If unsuccessfull, use some internally specialized ctor call. * @todo work out the struct asset naming scheme! * @return an Struct smart ptr linked to the internally registered smart ptr * created as a side effect of calling the concrete Struct subclass ctor. */ - template<> - shared_ptr - StructFactory::operator() (const Query& query) + template + shared_ptr + StructFactory::operator() (const Query& capabilities) { - TODO ("actually evaluate the query..."); - Track* pT = new Track (createTrackIdent (query)); - return AssetManager::instance().wrap (*pT); + QueryHandler& typeHandler = ConfigRules::instance(); + shared_ptr res = typeHandler.resolve (capabilities); + + if (res) + return res; + + // create new one, since the + // ConfigQuery didn't yield any result + STRU* pS = impl_->fabricate(capabilities); + return AssetManager::instance().wrap (*pS); } - /** Similar instance for Port Query.... - * @todo better a generic implementation utilizing ConfigQuery.... - */ - template<> - shared_ptr - StructFactory::operator() (const Query& query) - { - TODO ("actually evaluate the query..."); - PortIDs ids (createPortIdent (query)); - return operator() (ids.first, ids.second); - } /** Factory method for creating Ports explicitly. @@ -122,4 +108,27 @@ namespace asset +} // namespace asset + + + + + /**************************************************/ + /* explicit instantiations of the factory methods */ + /**************************************************/ + +#include "proc/asset/struct.hpp" +#include "proc/asset/procpatt.hpp" +#include "proc/asset/track.hpp" +#include "proc/asset/port.hpp" + + +namespace asset + { + + template shared_ptr StructFactory::operator() (const Query& query); + template shared_ptr StructFactory::operator() (const Query& query); + template PProcPatt StructFactory::operator() (const Query& query); + + } // namespace asset diff --git a/src/proc/asset/struct.hpp b/src/proc/asset/struct.hpp index 18554f770..76b8b2e42 100644 --- a/src/proc/asset/struct.hpp +++ b/src/proc/asset/struct.hpp @@ -40,11 +40,14 @@ #include "proc/asset.hpp" #include "common/query.hpp" #include "common/factory.hpp" +#include "common/singleton.hpp" -#include +#include +#include using std::string; using std::wstring; +using boost::scoped_ptr; namespace asset @@ -53,6 +56,7 @@ namespace asset class Struct; class StructFactory; + class StructFactoryImpl; class Port; @@ -102,14 +106,21 @@ namespace asset */ class StructFactory : public cinelerra::Factory { + scoped_ptr impl_; + + protected: + StructFactory (); + friend class Struct; + + public: typedef shared_ptr PType; template - shared_ptr operator() (const Query& query); ////////////TODO define actual operation + shared_ptr operator() (const Query& query); ////////////TODO actually do something sensible here shared_ptr operator() (string portID, string streamID); - + }; diff --git a/src/proc/asset/structfactoryimpl.hpp b/src/proc/asset/structfactoryimpl.hpp new file mode 100644 index 000000000..50b45c21f --- /dev/null +++ b/src/proc/asset/structfactoryimpl.hpp @@ -0,0 +1,161 @@ +/* + STRUCTFACTORYIMPL.hpp - crating structural assets (impl details) + + Copyright (C) CinelerraCV + 2007, Hermann Vosseler + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + + +/** @file structfactoryimpl.hpp + ** Private implementation details of creating various structural assets. + ** @internal to be used by struct.cpp + ** + ** @see ConfigQuery + ** + */ + + +#ifndef ASSET_STRUCTFACTORYIMPL_H +#define ASSET_STRUCTFACTORYIMPL_H + + +#include "common/configrules.hpp" +#include "common/error.hpp" + +#include + +using boost::format; + +using asset::Query; +using cinelerra::query::CINELERRA_ERROR_CAPABILITY_QUERY; + + +namespace asset + { + + + template + struct Traits + { + static Symbol namePrefix; + static Symbol catFolder; + }; + + template<> Symbol Traits::namePrefix = "track-"; + template<> Symbol Traits::catFolder = "tracks"; + + template<> Symbol Traits::namePrefix = "port-"; + template<> Symbol Traits::catFolder = "ports"; + + template<> Symbol Traits::namePrefix = "patt-"; + template<> Symbol Traits::catFolder = "build-templates"; + + + + + /** + * Implementation deatils, esp. 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 + */ + class StructFactoryImpl + { + + /** @internal derive a sensible asset ident tuple when creating + * structural asset instances based on a capability query + * @todo define the actual naming scheme of struct assets + */ + template + const Asset::Ident + createIdent (const Query& query) + { + string name (Traits::namePrefix + query); // TODO something sensible here; append number, sanitize etc. + TODO ("struct asset naming scheme??"); + Category cat (STRUCT, Traits::catFolder); + return Asset::Ident (name, cat ); + } + + typedef std::pair PortIDs; + + PortIDs + createPortIdent (const Query& query) + { + string name (Traits::namePrefix + query); // TODO get some more sensible dummy values + TODO ("port naming scheme??"); + TODO ("actually extract the port stream type from the query..."); + return PortIDs (name, "data"); // dummy stream type + } + + + + + + /** used for issuing recursive create calls to top level */ + StructFactory& recursive_create_; + + public: + StructFactoryImpl (StructFactory& interface) + : recursive_create_(interface) + { } + + + + /** make a new structural asset instance. + * default/fallback impl. throws. + */ + template + STRU* fabricate (const Query& caps) + { + throw cinelerra::error::Config ( str(format("The following Query could not be resolved: %s.") % caps) + , CINELERRA_ERROR_CAPABILITY_QUERY ); + } + + }; + + + /* ============= specialisations =========================== */ + + template<> + Track* + StructFactoryImpl::fabricate (const Query& caps) + { + TODO ("actually extract properties/capabilities from the query..."); + return new Track (createIdent (caps)); + } + + template<> + ProcPatt* + StructFactoryImpl::fabricate (const Query& caps) + { + TODO ("actually extract properties/capabilities from the query..."); + return new ProcPatt (createIdent (caps)); + } + + template<> + Port* + StructFactoryImpl::fabricate (const Query& caps) + { + PortIDs ids (createPortIdent (caps)); + return recursive_create_ (ids.first, ids.second).get(); + } + + + + +} // namespace asset +#endif diff --git a/src/proc/asset/track.hpp b/src/proc/asset/track.hpp index c4b6886c1..def842250 100644 --- a/src/proc/asset/track.hpp +++ b/src/proc/asset/track.hpp @@ -39,7 +39,7 @@ namespace asset { protected: Track (const Asset::Ident& idi); - friend class StructFactory; + friend class StructFactoryImpl; }; diff --git a/src/proc/mobject/session/defsmanager.cpp b/src/proc/mobject/session/defsmanager.cpp index 5880bc1b3..71e7f8549 100644 --- a/src/proc/mobject/session/defsmanager.cpp +++ b/src/proc/mobject/session/defsmanager.cpp @@ -48,7 +48,7 @@ namespace mobject /** initialize the most basic internal defaults. */ DefsManager::DefsManager () throw() { - + TODO ("setup basic defaults of the session"); } diff --git a/wiki/renderengine.html b/wiki/renderengine.html index 8ab162beb..31914ac20 100644 --- a/wiki/renderengine.html +++ b/wiki/renderengine.html @@ -2349,8 +2349,10 @@ We need a way of addressing existing [[ports|Port]]. Besides, as the Ports and T //Note, we have yet to specify how exactly the building and rendering will work together with the backend. There are several possibilities how to structure the Playlist// -
-
Ports play an central role within the Proc Layer, because for everything placed and handled within the EDL, the final goal is to get it transformed into data which can be retrieved at some port. Ports are special facilities, rather like inventory, separate and not treated like all the other objects.
+
+
{{red{''NOTE'': I am considering to rename "Port" &rarr; "Pipe"}}}
+
+Ports play an central role within the Proc Layer, because for everything placed and handled within the EDL, the final goal is to get it transformed into data which can be retrieved at some port. Ports are special facilities, rather like inventory, separate and not treated like all the other objects.
 We don't distinguish between "input" and "output" ports &mdash; rather, ports are thought to be ''hooks for making connections to''. By following this line of thought, each port has an input side and an output side and is in itself something like a ''Bus'' or the starting point for building a ''processing chain''. Other processing entities like effects and transitions can be placed (attached) at the port, resulting them to be appended to form this chain. Likewise, we can place [[wiring requests|WiringRequest]] to the port, meaning we want it connected to another destination port. The [[Builder]] may generate further wiring requests to fulfil the placement of other entities.
 Thus Ports are the basic building blocks of the whole render network. We distinguish ''global available'' Ports, which are like the sum groups of a mixing console, and the ''lokal port'' or [[source port|ClipSourcePort]] of the individual clips, which exist only within the duration of the corresponding clip. The design //limits the possible kinds of ports // to these two types &mdash; thus we can build local processing chains at clips and global processing chains at the global ports of the session and that's all we can do. (because of the flexibility which comes with the concept of [[placements|Placement]], this is no real limitation)