Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
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 [-Duration::MAX ... +Duration::MAX]

Definition at line 365 of file timevalue.hpp.

Static Public Attributes

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

Public Member Functions

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

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
TimeValueoperator= (TimeValue const &o)
 Assigning of time values is not allowed, but derived classed might allow that.
 
 TimeValue (TimeValue const &origin, TimeValue const &target)
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ Offset() [1/5]

Offset ( TimeValue const &  distance = Time::ZERO)
inlineexplicit

Definition at line 800 of file timevalue.hpp.

◆ Offset() [2/5]

Offset ( FSecs const &  delta_in_secs)
explicit

Definition at line 162 of file time.cpp.

◆ Offset() [3/5]

Offset ( Offset const &  )
default

◆ Offset() [4/5]

Offset ( FrameCnt  count,
FrameRate const &  fps 
)

offset by the given number of frames.

Definition at line 389 of file time.cpp.

◆ Offset() [5/5]

Offset ( TimeValue const &  origin,
TimeValue const &  target 
)
inline

Definition at line 390 of file timevalue.hpp.

Member Function Documentation

◆ operator=()

Offset & operator= ( Offset const &  o)
inlineprotected

generally immutable, but derived classes allow some limited mutation through special API calls

Definition at line 373 of file timevalue.hpp.

References TimeValue::operator=().

+ Here is the call graph for this function:

◆ abs()

Duration abs ( ) const
inline

interpret the distance given by this offset as a time duration

Definition at line 847 of file timevalue.hpp.

Referenced by TimeValue_test::buildDuration(), and TimeValue_test::createOffsets().

+ Here is the caller graph for this function:

◆ 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 357 of file time.cpp.

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

Referenced by lib::time::operator*().

+ Here is the call graph for this function:
+ Here is the caller 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 368 of file time.cpp.

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

Referenced by lib::time::operator*().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator std::string()

operator std::string ( ) const
explicit

diagnostics, indicating ∆

◆ operator-()

Offset operator- ( ) const
inline

flip offset direction

Definition at line 461 of file timevalue.hpp.

Member Data Documentation

◆ ZERO

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

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