Lumiera  0.pre.03
»edit your freedom«
mutation.hpp File Reference

Go to the source code of this file.

Description

Modifying time and timecode values.

Basically, time values are designed to be immutable. Under some circumstances we need a means to change existing time values though. Moreover, actually performing these changes gets quite involved at the implementation level, due to time / timecode values being quantised (grid aligned). To keep this implementation logic separate from the simple time values, and to allow for later extensions and more elaborate change schemes, we choose the visitor pattern for implementing these time mutating operations.

usage situations

There are four basic usage situations causing an existing time value to be mutated:

  • dragging an object or object boundary (resizing)
  • nudging
  • placing an object (e.g. a clip)
  • update of a timecode display in the GUI

All these include sending a change message to the original time spec, while the actual content of the change message determines the concrete behaviour. Especially, when the target time to be changed or the message content are quantised, an interference between multiple time grids may be happen, possibly resulting in a re-quantisation of the message into the target object's own time grid.

Note
this header is defined such as to be used with or without including the time quantisation facility, which is a more heavyweight inclusion regarding code size and compilation times. For this toggle to work, the header timequant.hpp needs to be included prior to mutation.hpp Obviously, you can't define any mutation involving quantised (grid aligned) values without this.
Warning
when defining more fancy kinds of concrete mutations using the technique with the EncapsulatedMutation to hide the implementation, then please be sure to understand the size limitation for the implementation and maybe adjust MUTATION_IMPL_SIZE accordingly.
See also
TimeMutation_test
TimeControl_test

Definition in file mutation.hpp.

#include "lib/error.hpp"
#include "lib/nocopy.hpp"
#include "lib/time/timevalue.hpp"
#include "lib/polymorphic-value.hpp"
#include "lib/symbol.hpp"

Classes

class  Mutation
 Interface: an opaque change imposed onto some time value. More...
 

Typedefs

typedef lib::polyvalue::CloneValueSupport< Mutation > ClonableMutation
 
typedef lib::PolymorphicValue< Mutation, MUTATION_IMPL_SIZE, ClonableMutation > EncapsulatedMutation
 

Enumerations

enum  { MUTATION_IMPL_SIZE = sizeof(TimeValue) }
 

Functions

 LUMIERA_ERROR_DECLARE (INVALID_MUTATION)
 Changing a time value in this way was not designated.
 

Namespaces

 lib
 Implementation namespace for support and library code.