Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
Control< TI > Class Template Reference

#include "lib/time/control.hpp"

Description

template<class TI>
class lib::time::Control< TI >

Frontend/Interface: controller-element to retrieve and change running time values.

time::Control is a mediator element, which can be attached to some time value entities as mutation, and at the same time allows to register listeners. When configured this way, changes may be fed to the function operator(s). These changes will be imposed to the connected target and the result propagated to the listeners.

See also
time::Mutation
time::TimeSpan::accept(Mutation const&)

Definition at line 125 of file control.hpp.

Public Member Functions

void operator() (TI const &) const
 impose a new value to the connected target.
 
void operator() (Offset const &) const
 impose an offset to the connected target.
 
void operator() (int) const
 nudge the connected target by the given offset steps, using either the target's own grid (when quantised), or a 'natural' nudge grid
 
template<class SIG >
void connectChangeNotification (SIG const &toNotify)
 install a callback functor to be invoked as notification for any changes imposed onto the observed time entity.
 
void disconnect ()
 disconnect from observed entity and cease any change notification
 
- Public Member Functions inherited from Mutation
virtual ~Mutation ()
 

Private Member Functions

virtual void change (Duration &) const
 
virtual void change (TimeSpan &) const
 
virtual void change (QuTime &) const
 

Private Attributes

mutation::Propagator< TI > notifyListeners_
 

Additional Inherited Members

- Static Public Member Functions inherited from Mutation
static EncapsulatedMutation changeTime (Time)
 Convenience factory to yield a simple Mutation changing the absolute start time.
 
static EncapsulatedMutation changeDuration (Duration)
 Convenience factory: simple Mutation to adjust the duration or length of a timespan.
 
static EncapsulatedMutation adjust (Offset)
 Convenience factory: simple Mutation to adjust the duration or length of a timespan.
 
static EncapsulatedMutation materialise (QuTime const &)
 Convenience factory: materialise the given quantised time into an explicit fixed internal time value, according to the underlying time grid; impose the resulting value then as new time point or start point to the target.
 
static EncapsulatedMutation nudge (int adjustment)
 build a time mutation to nudge the target time value by an offset, defined as number of steps on an implicit nudge grid.
 
static EncapsulatedMutation nudge (int adjustment, Symbol gridID)
 build a time mutation to nudge the target time value in steps based on a pre-defined grid.
 
- Protected Member Functions inherited from Mutator< TI >
void ensure_isArmed () const
 
template<class TAR >
void bind_to (TAR &target) const
 
void unbind ()
 
- Static Protected Member Functions inherited from Mutation
static TimeValueimposeChange (TimeValue &, TimeValue const &)
 
static TimeValueimposeChange (TimeValue &, Offset const &)
 
static TimeValueimposeChange (TimeValue &, int)
 
static TimeValueimposeChange (QuTime &, int)
 
- Protected Attributes inherited from Mutator< TI >
ValueSetter setVal_
 
Ofsetter offset_
 
Nudger nudge_
 

Member Function Documentation

◆ change() [1/3]

template<class TI >
void change ( Duration targetDuration) const
privatevirtual

Implements Mutation.

Definition at line 230 of file control.hpp.

◆ change() [2/3]

template<class TI >
void change ( TimeSpan targetInterval) const
privatevirtual

Implements Mutation.

Definition at line 237 of file control.hpp.

◆ change() [3/3]

template<class TI >
void change ( QuTime targetQuTime) const
privatevirtual

Implements Mutation.

Definition at line 244 of file control.hpp.

◆ operator()() [1/3]

template<class TI >
void operator() ( TI const &  newValue) const

impose a new value to the connected target.

If applicable, the target will afterwards reflect that change, and listeners will be notified, passing the target's new state.

Exceptions
error::Stateif not connected to a target
Note
the actual change in the target also depends on the concrete target type and the type of the change. By default, the time value is changed; this may include grid alignment.

Definition at line 168 of file control.hpp.

◆ operator()() [2/3]

template<class TI >
void operator() ( Offset const &  adjustment) const

impose an offset to the connected target.

If applicable, the target will be adjusted by the time offset, and listeners will be notified.

Exceptions
error::Stateif not connected to a target

Definition at line 182 of file control.hpp.

◆ operator()() [3/3]

template<class TI >
void operator() ( int  offset_by_steps) const

nudge the connected target by the given offset steps, using either the target's own grid (when quantised), or a 'natural' nudge grid

Exceptions
error::Stateif not connected to a target

Definition at line 196 of file control.hpp.

◆ connectChangeNotification()

template<class TI >
template<class SIG >
void connectChangeNotification ( SIG const &  toNotify)

install a callback functor to be invoked as notification for any changes imposed onto the observed time entity.

Parameters
toNotifyobject with operator()(TI const&)

Definition at line 215 of file control.hpp.

References Offset::ZERO.

Referenced by TestCase< TAR, SRC, BASE >::performTestSequence(), and TimeControl_test::verifyBasics().

+ Here is the caller graph for this function:

◆ disconnect()

template<class TI >
void disconnect ( )

disconnect from observed entity and cease any change notification

Definition at line 206 of file control.hpp.

Member Data Documentation

◆ notifyListeners_

template<class TI >
mutation::Propagator<TI> notifyListeners_
private

Definition at line 128 of file control.hpp.

+ Inheritance diagram for Control< TI >:
+ Collaboration diagram for Control< TI >:

The documentation for this class was generated from the following file: