integrate check for supported formats into Quantiser

This commit is contained in:
Fischlurch 2011-01-16 22:19:48 +01:00
parent 92c4516cae
commit 71a80d3df6
3 changed files with 16 additions and 7 deletions

View file

@ -178,7 +178,7 @@ namespace time {
template<class F>
size_t
typeID()
typeID() const
{
return TypedContext<Supported>::ID<F>::get();
}
@ -210,7 +210,7 @@ namespace time {
/** check if a specific Format is supported */
template<class F>
bool
check()
check() const
{
return flags_[typeID<F>()];
}

View file

@ -78,12 +78,20 @@ namespace time {
class Quantiser
: public Grid
{
protected:
format::Supported supportedFormats_;
Quantiser()
: supportedFormats_(format::SupportStandardTimecode())
{ }
public:
template<class FMT>
bool supports() const;
bool
supports() const
{
return supportedFormats_.check<FMT>();
}
//------Grid-API----------------------------------------------
@ -116,11 +124,11 @@ namespace time {
FixedFrameQuantiser (FrameRate const& frames_per_second, TimeValue referencePoint =TimeValue(0));
FixedFrameQuantiser (Duration const& frame_duration, TimeValue referencePoint =TimeValue(0));
long gridPoint (TimeValue const&) const;
TimeValue gridAlign (TimeValue const&) const;
TimeValue timeOf (long gridPoint) const;
TimeValue timeOf (FSecs, int =0) const;
};

View file

@ -82,7 +82,7 @@ namespace time {
inline bool
QuTime::supports() const
{
return false; ////////////////TODO;
return quantiser_->supports<FMT>();
}
@ -100,6 +100,7 @@ namespace time {
QuTime::castInto (TC& timecode) const
{
typedef typename TC::Format Format;
REQUIRE (supports<Format>());
Format::rebuild (timecode, *quantiser_, TimeValue(*this));
}