diff --git a/src/lib/time/control.hpp b/src/lib/time/control.hpp index 2a813aff6..398d2c172 100644 --- a/src/lib/time/control.hpp +++ b/src/lib/time/control.hpp @@ -162,7 +162,7 @@ namespace time { TI Mutator::imposeNudge (TimeValue& target, int off_by_steps) { - return TI (Mutation::imposeChange (target, TimeVar(target)+Time(FSecs(off_by_steps)))); + return TI (Mutation::imposeChange (target, TimeVar(target)+Time(FSecs(off_by_steps)))); //////////////////TICKET #810 } // special cases... @@ -226,19 +226,19 @@ namespace time { } template<> QuTime - Mutator::imposeOffset (TimeValue&, Offset const&) + Mutator::imposeOffset (TimeValue& target, Offset const& off) { - throw error::Logic ("can't deliver result of the change as grid-aligned time, " - "because it's not evident which concrete grid to use" - ,LUMIERA_ERROR_UNKNOWN_GRID); //////////////////TODO: we could pick up a "default grid" from session? + return QuTime (Mutation::imposeChange (target, TimeVar(target)+off) + ,getDefaultGridFallback() //////////////////TICKET #810 + ); } template<> QuTime - Mutator::imposeNudge (TimeValue&, int) + Mutator::imposeNudge (TimeValue& target, int off_by_steps) { - throw error::Logic ("can't deliver result of the change as grid-aligned time, " - "because it's not evident which concrete grid to use" - ,LUMIERA_ERROR_UNKNOWN_GRID); + return QuTime (Mutation::imposeChange (target, TimeVar(target)+Time(FSecs(off_by_steps))) + ,getDefaultGridFallback() //////////////////TICKET #810 + ); } #endif //(End)quantisation special case diff --git a/src/lib/time/quantiser.cpp b/src/lib/time/quantiser.cpp index fcb916004..61103008c 100644 --- a/src/lib/time/quantiser.cpp +++ b/src/lib/time/quantiser.cpp @@ -51,10 +51,19 @@ namespace time { , LUMIERA_ERROR_UNKNOWN_GRID); return grid_found; } - }//(End) implementation helpers + PQuant + getDefaultGridFallback() + { + static PQuant globalDefaultGrid (new FixedFrameQuantiser(1)); + return globalDefaultGrid; ///////////////////////TICKET #810 + }; + + + + Grid::~Grid() { } // hint to emit the VTable here... diff --git a/src/lib/time/quantiser.hpp b/src/lib/time/quantiser.hpp index 06df4d3f1..d7717bb03 100644 --- a/src/lib/time/quantiser.hpp +++ b/src/lib/time/quantiser.hpp @@ -64,6 +64,17 @@ namespace time { } + + /** @todo placeholder for accessing + * a current or default session grid. + * To be implemented later. + */ + PQuant getDefaultGridFallback(); ///////////////////////TICKET #810 + + + + + /** * Facility to create grid-aligned time values. * Effectively, a quantiser exposes the value Grid API, but diff --git a/tests/lib/time/time-control-test.cpp b/tests/lib/time/time-control-test.cpp index e85fc1685..1b5cb2dd7 100644 --- a/tests/lib/time/time-control-test.cpp +++ b/tests/lib/time/time-control-test.cpp @@ -297,7 +297,7 @@ namespace test{ : BASE { void - performTestCases(TimeValue const& o, TimeValue const& c) + performTestCases(TimeValue const& org, TimeValue const& c) { cout << "Test-Case. Target=" << showType() <<" <--feed--- " << showType() @@ -305,16 +305,16 @@ namespace test{ Control controller; - TAR target = TestTarget::build(o); + TAR target = TestTarget::build(org); target.accept (controller); SRC change = TestChange::prepareChangeValue(c); controller (change); - verify_wasChanged (target, o, change); + verify_wasChanged (target, org, change); Offset offset(c); controller (offset); - verify_wasOffset (target, o, offset); + verify_wasOffset (target, org, offset); TAR oldState(target); controller (0); @@ -337,7 +337,7 @@ namespace test{ // tail recursion: further test combinations.... - BASE::performTestCases(o,c); + BASE::performTestCases(org,c); } };