101 #ifndef LIB_TIME_CONTROL_POLICY_H 102 #define LIB_TIME_CONTROL_POLICY_H 107 #include <boost/utility/enable_if.hpp> 108 #include <type_traits> 109 #include <functional> 117 using boost::disable_if;
120 using std::placeholders::_1;
133 return is_same<T, Duration>::value;
140 return is_same<T, TimeSpan>::value;
145 maybeMaterialise (T
const& non_grid_aligned_TimeValue)
147 return non_grid_aligned_TimeValue;
150 #ifdef LIB_TIME_TIMEQUANT_H 152 maybeMaterialise (
QuTime const& alignedTime)
154 PQuant const& grid(alignedTime);
155 return QuTime(grid->materialise(alignedTime), grid);
157 #endif //--quantised-time-support 166 template<
class TI,
class TAR>
170 buildChangedValue (TAR
const& target)
179 buildChangedValue (TAR
const& target)
188 buildChangedValue (
Duration const& targetDuration)
190 return TimeSpan (Time::ZERO, targetDuration);
197 buildChangedValue (
TimeSpan const& target)
202 #ifdef LIB_TIME_TIMEQUANT_H 207 buildChangedValue (TAR
const& target)
209 return QuTime (target
218 buildChangedValue (QuTime
const& target)
223 #endif //--quantised-time-support 236 template<
class TI,
class TAR>
246 imposeChange (target, maybeMaterialise(change));
247 return Link::buildChangedValue (maybeMaterialise(target));
251 useLengthAsChange (TAR& target,
TimeSpan const& change)
253 return processValueChange(target, change.duration());
259 imposeChange (target.duration(), change);
266 imposeChange (target.duration(), change.duration());
267 imposeChange (target,change.start());
274 return Link::buildChangedValue(target);
294 template<
class TI,
class SRC,
class TAR>
297 static function<TI(SRC const&)>
298 buildChangeHandler (TAR& target)
310 : __or_< is_same<T,Duration>
318 : __or_< is_same<T,Duration>
319 , is_same<T,TimeSpan>
331 template<
class TI,
class SRC>
332 struct Policy<TI,SRC, typename disable_if< canMutateDuration<SRC>,
335 static function<TI(SRC const&)>
336 buildChangeHandler (
Duration& target)
352 static function<Duration(Duration const&)>
353 buildChangeHandler (TAR&)
355 return bind ( ignore_change_and_return_Zero );
359 ignore_change_and_return_Zero()
368 static function<TI(TimeSpan const&)>
369 buildChangeHandler (
Duration& target)
381 static function<TI(Duration const&)>
382 buildChangeHandler (
TimeSpan& target)
391 static function<TimeSpan(TimeSpan const&)>
392 buildChangeHandler (
TimeSpan& target)
static TI dontChange(TAR &target)
static TI processValueChange(TAR &target, SRC const &change)
Modifying time and timecode values.
Interface: an opaque change imposed onto some time value.
static const Duration NIL
constant to indicate "no duration"
Implementation namespace for support and library code.
PQuant getDefaultGridFallback()
Policy how to impose changes onto a connected target time value entity This policy will be parametris...
Duration is the internal Lumiera time metric.
Policy to tie the various detail policies together for providing actual value change operations...
Implementation policy: how to build a new notification value of type TI, given a target time value en...
A time interval anchored at a specific point in time.
a family of time value like entities and their relationships.
grid aligned time specification, referring to a specific scale.