diff --git a/src/lib/time/display.hpp b/src/lib/time/display.hpp index 2c829d9fc..27c202da5 100644 --- a/src/lib/time/display.hpp +++ b/src/lib/time/display.hpp @@ -34,14 +34,12 @@ namespace lib { namespace time { - - /** writes time value, formatted as HH:MM:SS:mmm - * @see lumiera_tmpbuf_print_time */ - inline std::ostream& - operator<< (std::ostream& os, Time const& t) - { - return os << std::string(t); - } + + /* === shortcuts for diagnostic output === */ + + /** writes time value, formatted as HH:MM:SS:mmm */ + inline std::ostream& operator<< (std::ostream& os, Time const& t) { return os << string(t); } + inline std::ostream& operator<< (std::ostream& os, TCode const& t) { return os << string(t); } diff --git a/src/lib/time/timecode.hpp b/src/lib/time/timecode.hpp index f536dac2e..6cc526d79 100644 --- a/src/lib/time/timecode.hpp +++ b/src/lib/time/timecode.hpp @@ -27,6 +27,7 @@ #include "lib/time/timevalue.hpp" #include "lib/time/formats.hpp" +//#include //#include #include @@ -48,9 +49,14 @@ namespace time { public: virtual ~TCode(); - virtual string show() const =0; - virtual string describe() const =0; - virtual Time getTime() const =0; + operator string() const { return show(); } + string describe() const { return tcID(); } + Time getTime() const { return Time(calc()); } + + protected: + virtual string show() const =0; + virtual string tcID() const =0; + virtual TimeValue calc() const =0; }; @@ -66,6 +72,10 @@ namespace time { class FrameNr : public TCode { + + virtual string show() const ; + virtual string tcID() const ; + virtual TimeValue calc() const ; public: FrameNr (QuTime const& quantisedTime); @@ -82,6 +92,10 @@ namespace time { : public TCode { + virtual string show() const ; + virtual string tcID() const ; + virtual TimeValue calc() const ; + public: SmpteTC (QuTime const& quantisedTime); @@ -100,6 +114,10 @@ namespace time { : public TCode { + virtual string show() const ; + virtual string tcID() const ; + virtual TimeValue calc() const ; + public: HmsTC (QuTime const& quantisedTime); @@ -118,13 +136,20 @@ namespace time { : public TCode { + virtual string show() const ; + virtual string tcID() const ; + virtual TimeValue calc() const ; + public: Secs (QuTime const& quantisedTime); operator FSecs() const; }; + + /** writes time value, formatted as HH:MM:SS:mmm */ + }} // lib::time #endif diff --git a/tests/lib/time/time-quantisation-test.cpp b/tests/lib/time/time-quantisation-test.cpp index 8ef868412..50d9d9127 100644 --- a/tests/lib/time/time-quantisation-test.cpp +++ b/tests/lib/time/time-quantisation-test.cpp @@ -23,8 +23,9 @@ #include "lib/test/run.hpp" #include "lib/test/test-helper.hpp" -#include "lib/time/timequant.hpp" #include "proc/asset/meta/time-grid.hpp" +#include "lib/time/timequant.hpp" +#include "lib/time/display.hpp" #include "lib/util.hpp" #include @@ -114,7 +115,7 @@ namespace test{ { cout << timecodeValue.describe() << " time = "<< timecodeValue.getTime() - << " code = "<< timecodeValue.show() + << " code = "<< timecodeValue << endl; }