diff --git a/src/proc/asset/meta.cpp b/src/proc/asset/meta.cpp index 09a771068..3e5e15e99 100644 --- a/src/proc/asset/meta.cpp +++ b/src/proc/asset/meta.cpp @@ -24,7 +24,6 @@ #include "proc/assetmanager.hpp" #include "proc/asset/meta.hpp" #include "lib/util.hpp" -#include "include/logging.h" namespace asset { @@ -50,14 +49,15 @@ namespace asset { /** Generic factory method for Metadata Asset instances. * @param EntryID specifying the type and a human readable name-ID - * @return an Meta smart ptr linked to the internally registered smart ptr - * created as a side effect of calling the concrete Meta subclass ctor. + * @return an meta::Builder struct with the metadata parameters. After configuring + * and tweaking those parameters, the builder's \c commit() function + * will create a new (immutable) meta asset. */ template meta::Builder - MetaFactory::operator () (EntryID elementIdentity) + MetaFactory::operator() (EntryID elementIdentity) { - UNIMPLEMENTED ("Meta-Factory"); + return meta::Builder (elementIdentity.getSym()); } @@ -66,14 +66,15 @@ namespace asset { * to be augmented and further specialised. Can indeed * be an existing asset::Meta instance * @param EntryID specifying the type and a human readable name-ID - * @return an Meta smart ptr linked to the internally registered smart ptr - * created as a side effect of calling the concrete Meta subclass ctor. + * @return an meta::Builder struct with the metadata parameters. After configuring + * and tweaking those parameters, the builder's \c commit() function + * will create a new (immutable) meta asset. */ template meta::Builder MetaFactory::operator() (Descriptor const& prototype, EntryID elementIdentity) { - UNIMPLEMENTED ("Meta-Factory"); + UNIMPLEMENTED ("Meta-Factory: extend or supersede existing meta asset"); ////////////////////TICKET #746 } diff --git a/src/proc/asset/meta.hpp b/src/proc/asset/meta.hpp index 21f029c14..77e08b71a 100644 --- a/src/proc/asset/meta.hpp +++ b/src/proc/asset/meta.hpp @@ -89,7 +89,7 @@ namespace asset { class Descriptor { public: - virtual ~Descriptor(); ///< this is an ABC + virtual ~Descriptor(); ///< this is an Interface }; /** @@ -122,7 +122,7 @@ namespace asset { virtual const ID& getID() const ///< @return ID of kind Meta { - return static_cast& > (Asset::getID()); + return static_cast& > (Asset::getID()); } protected: diff --git a/src/proc/asset/meta/time-grid.cpp b/src/proc/asset/meta/time-grid.cpp index bc98fb234..dea09cb91 100644 --- a/src/proc/asset/meta/time-grid.cpp +++ b/src/proc/asset/meta/time-grid.cpp @@ -27,12 +27,13 @@ #include "lib/time/quantiser.hpp" #include "lib/time/timevalue.hpp" #include "lib/time/display.hpp" -//#include "lib/util.hpp" +#include "lib/util.hpp" //#include "include/logging.h" #include #include +using util::isnil; using boost::format; using boost::str; using std::string; @@ -114,9 +115,12 @@ namespace meta { if (!fps_) throw error::Config ("attempt to build a TimeGrid with 0 frames per second"); - format gridIdFormat("grid_%f_%s"); - string name = str(gridIdFormat % fps_ % origin_); - EntryID nameID (name); + if (isnil (id_)) + { + format gridIdFormat("grid_%f_%s"); + id_ = str(gridIdFormat % fps_ % origin_); + } + EntryID nameID (id_); TimeGrid& newGrid (*new SimpleTimeGrid(origin_, fps_, nameID)); return AssetManager::instance().wrap (newGrid); @@ -135,7 +139,8 @@ namespace meta { PGrid TimeGrid::build (Symbol gridID, FrameRate frames_per_second, Time origin) { - Builder spec; + string name(gridID); + Builder spec(name); spec.fps_ = frames_per_second; spec.origin_ = origin; diff --git a/src/proc/asset/meta/time-grid.hpp b/src/proc/asset/meta/time-grid.hpp index 77f589ca9..a56380807 100644 --- a/src/proc/asset/meta/time-grid.hpp +++ b/src/proc/asset/meta/time-grid.hpp @@ -101,6 +101,8 @@ namespace meta { template<> struct Builder { + string id_; + FrameRate fps_; Time origin_; @@ -116,8 +118,9 @@ namespace meta { * You need at least to set the framerate, * in order to create a usable TimeGrid */ - Builder() - : fps_(0) + Builder(string const& nameID ="") + : id_(nameID) + , fps_(0) , origin_(TimeValue(0)) , predecessor_() { } diff --git a/src/proc/asset/struct-scheme.hpp b/src/proc/asset/struct-scheme.hpp index f39069101..e0f7af463 100644 --- a/src/proc/asset/struct-scheme.hpp +++ b/src/proc/asset/struct-scheme.hpp @@ -64,6 +64,10 @@ namespace asset{ class Timeline; class Sequence; + namespace meta { + class TimeGrid; + } + namespace idi { @@ -78,7 +82,7 @@ namespace asset{ { static Symbol namePrefix(); static Symbol catFolder(); - static Symbol idSymbol(); + static Symbol idSymbol(); ///< used as type predicate symbol }; @@ -131,6 +135,12 @@ namespace asset{ static Symbol catFolder() { return "sequences";} static Symbol idSymbol() { return "sequence"; } }; + template<> struct StructTraits + { + static Symbol namePrefix() { return "grid"; } + static Symbol catFolder() { return "time-scales";} + static Symbol idSymbol() { return "timeGrid"; } + }; /* catch-all defaults */