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

#include "lib/time/timevalue.hpp"

Description

basic constant internal time value.

These time values provide the implementation base for all further time types. They can be created by wrapping up a raw micro tick value (gavl_time_t), are totally ordered, but besides that, they are opaque and non-mutable.

Note
clients should prefer to use Time instances, which explicitly denote an Lumiera internal time value and are easier to use.
See also
TimeVar when full arithmetics are required

Definition at line 133 of file timevalue.hpp.

Public Member Functions

 TimeValue (gavl_time_t val)
 
 TimeValue (TimeValue const &o)
 copy initialisation allowed
 
bool isRegular () const
 
 operator std::string () const
 

Static Public Member Functions

static TimeValue buildRaw_ (gavl_time_t)
 

Static Public Attributes

static const gavl_time_t SCALE = GAVL_TIME_SCALE
 Number of micro ticks (µs) per second as basic time scale.
 

Friends

gavl_time_t _raw (TimeValue const &time)
 
HashVal hash_value (TimeValue const &)
 derive a hash from the µ-tick value More...
 
class Mutation
 some subclasses may receive modification messages
 
bool operator< (TimeValue const &t1, TimeValue const &t2)
 
bool operator< (TimeValue const &t1, gavl_time_t t2)
 
bool operator== (TimeValue const &t1, TimeValue const &t2)
 
bool operator== (TimeValue const &t1, gavl_time_t t2)
 
bool operator> (TimeValue const &t1, gavl_time_t t2)
 

Protected Member Functions

 TimeValue (TimeValue const &origin, TimeValue const &target)
 
TimeValueoperator= (TimeValue const &o)
 Assigning of time values is not allowed, but derived classed might allow that.
 

Static Protected Member Functions

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

gavl_time_t t_
 the raw (internal) time value used to implement the time types
 

Constructor & Destructor Documentation

◆ TimeValue() [1/2]

TimeValue ( TimeValue const &  origin,
TimeValue const &  target 
)
inlineprotected

for Offset and Duration entities built on top

Definition at line 161 of file timevalue.hpp.

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

Referenced by QuTime::castInto().

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

◆ TimeValue() [2/2]

TimeValue ( gavl_time_t  val)
inlineexplicit
Parameters
valtime given in µ ticks here

Definition at line 171 of file timevalue.hpp.

References TimeValue::limitedTime().

+ Here is the call graph for this function:

Member Function Documentation

◆ limitedTime()

gavl_time_t limitedTime ( gavl_time_t  raw)
inlinestaticprotected

explicit limit of allowed time range

applies a limiter on the provided raw time value to keep it within the arbitrary boundaries defined by (Time::MAX, Time::MIN). While Time entities are not a "safeInt" implementation, we limit new values to lower the likelihood of wrap-around

Definition at line 744 of file timevalue.hpp.

Referenced by TimeValue::TimeValue().

+ Here is the caller graph for this function:

◆ buildRaw_()

TimeValue buildRaw_ ( gavl_time_t  raw)
static

backdoor to sneak in a raw time value bypassing any normalisation and limiting

Definition at line 236 of file time.cpp.

References FrameRate::PAL, and FrameRate::STEP.

Referenced by Offset::Offset(), Offset::stretchedByFloatFactor(), Offset::stretchedByRationalFactor(), and Time::Time().

+ Here is the caller graph for this function:

◆ operator std::string()

operator std::string ( ) const

diagnostics

◆ isRegular()

bool isRegular ( ) const
inline
Returns
is in-domain, not a boundary value

Definition at line 771 of file timevalue.hpp.

References Time::MAX.

Referenced by LoadController::markLagSample(), and LoadController::tendedNext().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ _raw

gavl_time_t _raw ( TimeValue const &  time)
friend

to pass Time values to C functions

Definition at line 181 of file timevalue.hpp.

Referenced by lib::time::__framerate_approximation(), TimeSpan::conform(), lib::time::hash_value(), and Offset::Offset().

◆ hash_value

HashVal hash_value ( TimeValue const &  time)
friend

derive a hash from the µ-tick value

Returns
rotation of the raw value to produce a suitable spacing for consecutive time
Remarks
picked up by Boost-hash, or std. hashtables with the help of hash-standard.h
See also
https://stackoverflow.com/a/31488147

Definition at line 725 of file timevalue.hpp.

+ Inheritance diagram for TimeValue:
+ Collaboration diagram for TimeValue:

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