Lumiera  0.pre.03
»edit your freedom«
Offset Class Reference

#include "lib/time/timevalue.hpp"

Description

Offset measures a distance in time.

It may be used to relate two points in time, or to create a modification for time-like entities. Similar to (basic) time values, offsets can be compared, but are otherwise opaque and immutable. Yet they allow to build derived values, including

  • the absolute (positive) distance for this offset: abs
  • a combined offset by chaining another offset
    Note
    on construction, Offset values are checked and limited to be within [-DurationMAX ... +DurationMAX]

Definition at line 367 of file timevalue.hpp.

Public Member Functions

 Offset (TimeValue const &distance=Time::ZERO)
 
 Offset (FSecs const &delta_in_secs)
 
 Offset (FrameCnt count, FrameRate const &fps)
 offset by the given number of frames. More...
 
 Offset (TimeValue const &origin, TimeValue const &target)
 
Duration abs () const
 interpret the distance given by this offset as a time duration
 
 operator std::string () const
 
Offset operator- () const
 flip offset direction
 
Offset stretchedByFloatFactor (double) const
 
Offset stretchedByRationalFactor (boost::rational< int64_t >) const
 
- Public Member Functions inherited from TimeValue
 TimeValue (gavl_time_t val)
 
 TimeValue (TimeValue const &o)
 copy initialisation allowed
 
bool isRegular () const
 
 operator std::string () const
 

Static Public Attributes

static const Offset ZERO
 
- Static Public Attributes inherited from TimeValue
static const gavl_time_t SCALE = GAVL_TIME_SCALE
 Number of micro ticks (µs) per second as basic time scale.
 

Protected Member Functions

Offsetoperator= (Offset const &o)
 generally immutable, but derived classes allow some limited mutation through special API calls
 
- Protected Member Functions inherited from TimeValue
 TimeValue (TimeValue const &origin, TimeValue const &target)
 
TimeValueoperator= (TimeValue const &o)
 Assigning of time values is not allowed, but derived classed might allow that.
 

Additional Inherited Members

- Static Public Member Functions inherited from TimeValue
static TimeValue buildRaw_ (gavl_time_t)
 
- Static Protected Member Functions inherited from TimeValue
static gavl_time_t limitedDelta (gavl_time_t origin, gavl_time_t target)
 safe calculation of explicitly limited time offset
 
static gavl_time_t limitedTime (gavl_time_t raw)
 explicit limit of allowed time range More...
 
- Protected Attributes inherited from TimeValue
gavl_time_t t_
 the raw (internal) time value used to implement the time types
 

Constructor & Destructor Documentation

◆ Offset()

Offset ( FrameCnt  count,
FrameRate const &  fps 
)

offset by the given number of frames.

Definition at line 355 of file time.cpp.

References TimeValue::_raw, Offset::abs(), TimeValue::buildRaw_(), lumiera_framecount_to_time(), Time::MAX, Duration::MAX, and Duration::NIL.

+ Here is the call graph for this function:

Member Function Documentation

◆ stretchedByRationalFactor()

Offset stretchedByRationalFactor ( boost::rational< int64_t >  factor) const

stretch offset by a possibly fractional factor, and quantise into raw (micro tick) grid

Definition at line 334 of file time.cpp.

References TimeValue::buildRaw_(), and TimeValue::t_.

+ Here is the call graph for this function:

◆ stretchedByFloatFactor()

Offset stretchedByFloatFactor ( double  factor) const
Warning
loss of precision on large time values beyond double mantissa length 2^52 ≈ 4.5e15

Definition at line 345 of file time.cpp.

References TimeValue::buildRaw_(), and TimeValue::t_.

+ Here is the call graph for this function:

◆ operator std::string()

operator std::string ( ) const

diagnostics, indicating ∆

+ Inheritance diagram for Offset:
+ Collaboration diagram for Offset:

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