fill in the missing parts to create a grid asset

This commit is contained in:
Fischlurch 2011-01-15 13:10:02 +01:00
parent ee0dcf3ba0
commit 8bc5bf88c9
5 changed files with 37 additions and 18 deletions

View file

@ -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<class MA>
meta::Builder<MA>
MetaFactory::operator () (EntryID<MA> elementIdentity)
MetaFactory::operator() (EntryID<MA> elementIdentity)
{
UNIMPLEMENTED ("Meta-Factory");
return meta::Builder<MA> (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<class MA>
meta::Builder<MA>
MetaFactory::operator() (Descriptor const& prototype, EntryID<MA> elementIdentity)
{
UNIMPLEMENTED ("Meta-Factory");
UNIMPLEMENTED ("Meta-Factory: extend or supersede existing meta asset"); ////////////////////TICKET #746
}

View file

@ -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<Meta>& getID() const ///< @return ID of kind Meta
{
return static_cast<const ID<Meta>& > (Asset::getID());
return static_cast<const ID<Meta>& > (Asset::getID());
}
protected:

View file

@ -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 <boost/format.hpp>
#include <string>
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<TimeGrid> nameID (name);
if (isnil (id_))
{
format gridIdFormat("grid_%f_%s");
id_ = str(gridIdFormat % fps_ % origin_);
}
EntryID<TimeGrid> 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<TimeGrid> spec;
string name(gridID);
Builder<TimeGrid> spec(name);
spec.fps_ = frames_per_second;
spec.origin_ = origin;

View file

@ -101,6 +101,8 @@ namespace meta {
template<>
struct Builder<TimeGrid>
{
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_()
{ }

View file

@ -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<meta::TimeGrid>
{
static Symbol namePrefix() { return "grid"; }
static Symbol catFolder() { return "time-scales";}
static Symbol idSymbol() { return "timeGrid"; }
};
/* catch-all defaults */