diff --git a/doc/devel/uml/fig142725.png b/doc/devel/uml/fig142725.png index 08a0e46ef..6e8c570d8 100644 Binary files a/doc/devel/uml/fig142725.png and b/doc/devel/uml/fig142725.png differ diff --git a/src/lib/time/digxel.hpp b/src/lib/time/digxel.hpp index 7d4e37d3a..a1fd73b15 100644 --- a/src/lib/time/digxel.hpp +++ b/src/lib/time/digxel.hpp @@ -92,10 +92,10 @@ namespace time { * @todo WIP-WIP-WIP */ class Digxel - : public boost::totally_ordered > > +// : public boost::totally_ordered > > { typedef const char* CBuf; @@ -103,29 +103,23 @@ namespace time { virtual ~Digxel (); ///< this is an ABC operator int() const { return getIntValue(); } - operator double() const { return getDoubleValue(); } CBuf show() { return getFormatted(); } - void operator= (int i) { return changeTo(i); } - void operator= (double d){ return changeTo(d); } - // Supporting totally_ordered - bool operator< (Digxel const& o) const { return double(*this) < double(o); } - bool operator== (Digxel const& o) const { return double(*this) == double(o); } - bool operator== (int i) const { return int(*this) == i ; } - bool operator< (int i) const { return int(*this) < i ; } - bool operator> (int i) const { return int(*this) > i ; } - bool operator== (double d) const { return double(*this) == d ; } - bool operator< (double d) const { return double(*this) < d ; } - bool operator> (double d) const { return double(*this) > d ; } +// // Supporting totally_ordered +// bool operator< (Digxel const& o) const { return double(*this) < double(o); } +// bool operator== (Digxel const& o) const { return double(*this) == double(o); } +// bool operator== (int i) const { return int(*this) == i ; } +// bool operator< (int i) const { return int(*this) < i ; } +// bool operator> (int i) const { return int(*this) > i ; } +// bool operator== (double d) const { return double(*this) == d ; } +// bool operator< (double d) const { return double(*this) < d ; } +// bool operator> (double d) const { return double(*this) > d ; } protected: virtual int getIntValue() const =0; - virtual double getDoubleValue() const =0; virtual CBuf getFormatted() =0; - virtual void changeTo (int i) =0; - virtual void changeTo (double d) =0; }; namespace digxel { @@ -225,29 +219,23 @@ namespace time { return ValTrait::asInt (value_); } - double - getDoubleValue() const - { - return ValTrait::asDouble (value_); - } - CBuf getFormatted() { UNIMPLEMENTED("call formatting or cache"); } - - void - changeTo (int i) - { - UNIMPLEMENTED("mutate INT"); - } - - void - changeTo (double d) - { - UNIMPLEMENTED("mutate FLOAT"); - } +// +// void +// changeTo (int i) +// { +// UNIMPLEMENTED("mutate INT"); +// } +// +// void +// changeTo (double d) +// { +// UNIMPLEMENTED("mutate FLOAT"); +// } public: diff --git a/src/lib/time/formats.hpp b/src/lib/time/formats.hpp index daea02508..ffb46a868 100644 --- a/src/lib/time/formats.hpp +++ b/src/lib/time/formats.hpp @@ -118,7 +118,46 @@ namespace time { static const Frames FRAMES; static const Smpte SMPTE; static const Hms HMS; + + } + // ====== forward declarationss of concrete Timecode types + + class FrameNr; + class SmpteTC; + class HmsTC; + class Secs; + namespace format { + + template + struct Traits; + + template<> + struct Traits + { + typedef FrameNr TimeCode; + }; + + template<> + struct Traits + { + typedef SmpteTC TimeCode; + }; + + template<> + struct Traits + { + typedef HmsTC TimeCode; + }; + + template<> + struct Traits + { + typedef Secs TimeCode; + }; + + + }}} // lib::time::format #endif diff --git a/src/lib/time/timecode.cpp b/src/lib/time/timecode.cpp index b739f411f..24c00de5b 100644 --- a/src/lib/time/timecode.cpp +++ b/src/lib/time/timecode.cpp @@ -34,6 +34,7 @@ namespace time { Format::~Format() { } // emit VTable here.... + TCode::~TCode() { } /** */ diff --git a/src/lib/time/timecode.hpp b/src/lib/time/timecode.hpp index 18d57e52d..f536dac2e 100644 --- a/src/lib/time/timecode.hpp +++ b/src/lib/time/timecode.hpp @@ -38,20 +38,19 @@ namespace time { /** - * fixed format time specification. - * @param FMT the actual timecode format to use + * Interface: fixed format timecode specification. * @see time::Format * @todo WIP-WIP-WIP */ - template class TCode { public: + virtual ~TCode(); - string describe() const; - - + virtual string show() const =0; + virtual string describe() const =0; + virtual Time getTime() const =0; }; @@ -65,12 +64,11 @@ namespace time { * FrameNr values interchangeable with integral numbers. */ class FrameNr - : public TCode + : public TCode { public: FrameNr (QuTime const& quantisedTime); - FrameNr (TCode const&); operator long() const; }; @@ -81,12 +79,11 @@ namespace time { * */ class SmpteTC - : public TCode + : public TCode { public: SmpteTC (QuTime const& quantisedTime); - SmpteTC (TCode const&); int getSecs () const; int getMins () const; @@ -96,5 +93,38 @@ namespace time { + /** + * + */ + class HmsTC + : public TCode + { + + public: + HmsTC (QuTime const& quantisedTime); + + double getMillis () const; + int getSecs () const; + int getMins () const; + int getHours () const; + }; + + + + /** + * + */ + class Secs + : public TCode + { + + public: + Secs (QuTime const& quantisedTime); + + operator FSecs() const; + }; + + + }} // lib::time #endif diff --git a/src/lib/time/timequant.hpp b/src/lib/time/timequant.hpp index 499c5ae43..25cd9b40f 100644 --- a/src/lib/time/timequant.hpp +++ b/src/lib/time/timequant.hpp @@ -56,7 +56,8 @@ namespace time { bool supports() const; template - TCode formatAs() const; + typename format::Traits::TimeCode + formatAs() const; }; diff --git a/tests/lib/time/time-quantisation-test.cpp b/tests/lib/time/time-quantisation-test.cpp index eb5acf171..8ef868412 100644 --- a/tests/lib/time/time-quantisation-test.cpp +++ b/tests/lib/time/time-quantisation-test.cpp @@ -95,21 +95,27 @@ namespace test{ CHECK ( qVal.supports()); CHECK ( qVal.supports()); - TCode smpteTCode = qVal.formatAs(); + SmpteTC smpteTCode = qVal.formatAs(); showTimeCode (smpteTCode); - TCode frameTCode = qVal.formatAs(); + HmsTC pureTimeCode = qVal.formatAs(); + showTimeCode (pureTimeCode); + + FrameNr frameTCode = qVal.formatAs(); showTimeCode (frameTCode); - FrameNr count(frameTCode); -// CHECK (string(count) == frameTCode.part[0])); + Secs seconds = qVal.formatAs(); + showTimeCode (seconds); } template void showTimeCode (TC timecodeValue) { -// cout << timecodeValue.describe() << " = " << join (timecodeValue.part(), ":") << endl; + cout << timecodeValue.describe() + << " time = "<< timecodeValue.getTime() + << " code = "<< timecodeValue.show() + << endl; } @@ -140,7 +146,7 @@ namespace test{ TimeGrid::build("special_funny_grid", 1); // provide the grid's definition (1 frame per second) - int cnt = 0;//////funny.formatAs().part["count"]; + int cnt = funny.formatAs(); // and now performing quantisation is OK SmpteTC smpte (funny); // also converting into SMPTE (which implies frame quantisation) CHECK (0 == smpte.getFrames()); // we have 1fps, thus the frame part is always zero! diff --git a/uml/lumiera/128517 b/uml/lumiera/128517 index dcd28563e..21aba95a2 100644 --- a/uml/lumiera/128517 +++ b/uml/lumiera/128517 @@ -1,6 +1,6 @@ format 58 "CommonLib" // CommonLib - revision 23 + revision 24 modified_by 5 "hiv" // class settings //class diagram settings @@ -956,14 +956,23 @@ ${inlines} b parent class_ref 134917 // Time end - classrelation 208901 // - relation 198021 ---> + classrelation 212613 // + relation 201733 ---> + a role_name "" protected + cpp default " ${comment}${static}${mutable}${volatile}${const}${type}* ${name}${value}; +" + classrelation_ref 212613 // + b parent class_ref 170885 // FrameNr + end + + classrelation 212741 // + relation 201861 ---> stereotype "yield" a role_name "" protected cpp default " ${comment}${static}${mutable}${volatile}${const}${type}* ${name}${value}; " - classrelation_ref 208901 // - b parent class_ref 170629 // TCode + classrelation_ref 212741 // + b parent class_ref 172677 // SmpteTC end end @@ -1099,9 +1108,6 @@ ${inlines} class 170629 "TCode" visibility package - nformals 1 - formal name "F" type "class" explicit_default_value "" - explicit_extends "" cpp_decl "${comment}${template}class ${name}${inherit} { ${members} }; @@ -1121,13 +1127,6 @@ ${inlines} b parent class_ref 170629 // TCode end - classrelation 208773 // - relation 197893 -_-> - a default - cpp default "#include in source" - classrelation_ref 208773 // - b parent class_ref 170757 // Format - end end class 170757 "Format" @@ -1147,9 +1146,6 @@ ${inlines} class 170885 "FrameNr" visibility package - nactuals 1 - actual class class_ref 170629 // TCode - rank 0 explicit_value "" cpp_decl "${comment}${template}class ${name}${inherit} { ${members} }; @@ -1282,9 +1278,6 @@ ${inlines} class 172677 "SmpteTC" visibility package - nactuals 1 - actual class class_ref 170629 // TCode - rank 0 explicit_value "" cpp_decl "${comment}${template}class ${name}${inherit} { ${members} }; @@ -1303,6 +1296,30 @@ ${inlines} classrelation_ref 211461 // b parent class_ref 170629 // TCode end + + classrelation 212869 // parts () + relation 201989 *--> + a role_name "parts" multiplicity "4" protected + cpp default " ${comment}${static}${mutable}${volatile}${const}${type} ${name}${value}; +" + classrelation_ref 212869 // parts () + b parent class_ref 173829 // Digxel + end + end + + class 173829 "Digxel" + visibility package + cpp_decl "${comment}${template}class ${name}${inherit} + { +${members} }; +${inlines} +" + java_decl "" + php_decl "" + python_2_2 python_decl "" + idl_decl "" + explicit_switch_type "" + end end diff --git a/uml/lumiera/142725.diagram b/uml/lumiera/142725.diagram index 70a003dcd..18a84f06e 100644 --- a/uml/lumiera/142725.diagram +++ b/uml/lumiera/142725.diagram @@ -38,7 +38,7 @@ classcanvas 131589 class_ref 170501 // QuTimeSpan end classcanvas 131973 class_ref 170629 // TCode draw_all_relations default hide_attributes default hide_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_infonote default shadow default show_stereotype_properties default - xyz 248 450 2000 + xyz 319 434 2000 end classcanvas 132101 class_ref 170757 // Format draw_all_relations default hide_attributes default hide_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_infonote default shadow default show_stereotype_properties default @@ -46,7 +46,7 @@ classcanvas 132101 class_ref 170757 // Format end classcanvas 132997 class_ref 170885 // FrameNr draw_all_relations default hide_attributes default hide_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_infonote default shadow default show_stereotype_properties default - xyz 243 545 2000 + xyz 314 507 2000 end classcanvas 133253 class_ref 171013 // CompoundGrid draw_all_relations default hide_attributes default hide_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_infonote default shadow default show_stereotype_properties default @@ -58,25 +58,29 @@ classcanvas 133509 class_ref 172165 // Offset end classcanvas 135045 class_ref 137093 // Meta draw_all_relations default hide_attributes default hide_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_infonote default shadow default show_stereotype_properties default - xyz 514 237 2000 + xyz 514 237 2005 end note 135429 "Asset System" xyzwh 504 197 2000 66 47 classcanvas 135557 class_ref 172293 // Frames draw_all_relations default hide_attributes default hide_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_infonote default shadow default show_stereotype_properties default - xyz 392 507 1995 + xyz 392 507 1979 end classcanvas 135685 class_ref 172421 // Smpte draw_all_relations default hide_attributes default hide_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_infonote default shadow default show_stereotype_properties default - xyz 446 533 2010 + xyz 446 533 1994 end classcanvas 136069 class_ref 172549 // Hms draw_all_relations default hide_attributes default hide_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_infonote default shadow default show_stereotype_properties default - xyz 421 523 2005 + xyz 421 523 1984 end classcanvas 136325 class_ref 172677 // SmpteTC draw_all_relations default hide_attributes default hide_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_infonote default shadow default show_stereotype_properties default - xyz 308 546 2000 + xyz 242 507 2000 +end +classcanvas 137349 class_ref 173829 // Digxel + draw_all_relations default hide_attributes default hide_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_infonote default shadow default show_stereotype_properties default + xyz 191 548 2000 end relationcanvas 128517 relation_ref 195205 // geometry VHV unfixed @@ -120,20 +124,9 @@ relationcanvas 131717 relation_ref 197637 // no_role_a no_role_b no_multiplicity_a no_multiplicity_b end -relationcanvas 132485 relation_ref 197893 // - from ref 131973 z 1999 to point 290 450 - line 132869 z 1999 to ref 132101 - no_role_a no_role_b - no_multiplicity_a no_multiplicity_b -end -relationcanvas 132613 relation_ref 198021 // - from ref 129669 z 1999 stereotype "<>" xyz 275 415 3000 to ref 131973 - no_role_a no_role_b - no_multiplicity_a no_multiplicity_b -end relationcanvas 132741 relation_ref 198149 // decenter_end 595 - from ref 130181 z 1999 stereotype "<>" xyz 360 414 3000 to ref 132101 + from ref 130181 z 1999 stereotype "<>" xyz 360 413 3000 to ref 132101 no_role_a no_role_b no_multiplicity_a no_multiplicity_b end @@ -194,10 +187,29 @@ relationcanvas 136197 relation_ref 200453 // end relationcanvas 136453 relation_ref 200581 // geometry VHV - from ref 136325 z 1999 to point 334 522 - line 136581 z 1999 to point 268 522 + from ref 136325 z 1999 to point 268 487 + line 136581 z 1999 to point 339 487 line 136709 z 1999 to ref 131973 no_role_a no_role_b no_multiplicity_a no_multiplicity_b end +relationcanvas 136837 relation_ref 201733 // + from ref 129669 z 1999 to ref 132997 + no_role_a no_role_b + no_multiplicity_a no_multiplicity_b +end +relationcanvas 136965 relation_ref 201861 // + decenter_end 754 + from ref 129669 z 1999 stereotype "<>" xyz 244 416 3000 to point 295 437 + line 137093 z 1999 to ref 136325 + no_role_a no_role_b + no_multiplicity_a no_multiplicity_b +end +relationcanvas 137477 relation_ref 201989 // + geometry HVr + from ref 136325 z 1999 to point 268 565 + line 137605 z 1999 to ref 137349 + role_a_pos 245 554 3000 no_role_b + multiplicity_a_pos 245 573 3000 no_multiplicity_b +end end diff --git a/uml/lumiera/5.session b/uml/lumiera/5.session index a3d4a7eab..09a1aa0c4 100644 --- a/uml/lumiera/5.session +++ b/uml/lumiera/5.session @@ -5,7 +5,7 @@ diagrams objectdiagram_ref 138885 // ModelAssetRelations 730 488 100 4 0 0 active classdiagram_ref 142725 // Time flavours - 595 629 100 4 0 0 + 595 646 100 4 0 0 end show_stereotypes selected diff --git a/uml/lumiera/lumiera.prj b/uml/lumiera/lumiera.prj index 1380666d0..f1dc5de9f 100644 --- a/uml/lumiera/lumiera.prj +++ b/uml/lumiera/lumiera.prj @@ -1,6 +1,6 @@ format 58 "lumiera" - revision 67 + revision 68 modified_by 5 "hiv" cpp_root_dir "../../src/" diff --git a/wiki/renderengine.html b/wiki/renderengine.html index 5f0185605..63faf288a 100644 --- a/wiki/renderengine.html +++ b/wiki/renderengine.html @@ -6561,7 +6561,7 @@ Thus no server and no network connection is needed. Simply open the file in your * see [[Homepage|http://tiddlywiki.com]], [[Wiki-Markup|http://tiddlywiki.org/wiki/TiddlyWiki_Markup]] -
+
The term &raquo;Time&laquo; spans a variety of vastly different entities. Within a NLE we get to deal with various //flavours of time values.//
 ;continuous time
 :without any additional assumptions, ''points in time'' can be specified with arbitrary precision.
@@ -6616,6 +6616,8 @@ __delayed quantisation__: with this approach, the information loss is delayed as
 
 !!!discussion
 For Lumiera, the static typing approach is of limited value -- it excels when values belonging to different scales are actually treated differently. There are such cases, but rather on the data handling level, e.g. sound samples are always handled block wise. But regarding time values, the unifying aspect is more important, which leads to prefering a dynamic (run time typed) approach, while //erasing// the special differences most of the time. Yet the dynamic and open nature of the Lumiera high-level model favours the delayed quantisation pattern; the same values may require different quantisation depending on the larger model context an object is encountered in. This solution might be to general and heavy weight at times though. Thus, for important special cases, the accessors should return tagged values, preferably even with differing static type. Time codes can be integrated this way, but most notably the ''frame numbers'' used for addressing throughout the backend, can be implemented as such specifically typed tagged values; the tag here denotes the quantiser and thus the underlying grid -- it should be implemented as hash-ID for smooth integration with code written in plain C.
+
+At the level of individual timecode formats, we're lacking a common denominator; thus it is preferrable to work with different concrete timecode classes through //generic programming.// This way, each timecode format can expose operations specific only to the given format. Especially, different timecode formats expose different //component fields,// modelled by the generic ''Digxel'' concept. There is a common baseclass ~TCode though, which can be used for //type erasure.//
 &rarr; more on [[usage situations|TimeUsage]]