34#include <NDEVR/Time.h>
35#include <NDEVR/LibAssert.h>
36#include <NDEVR/BufferBase.h>
216 return Constant<fltp08>::Invalid;
224 template<
class t_type = fltp08>
228 return Constant<fltp08>::Invalid;
239 return Constant<fltp08>::Invalid;
249 return Constant<fltp08>::Invalid;
508 return value >=
TimeSpan(0) ? value : -value;
524 template<>
constexpr TimeSpan Constant<TimeSpan>::Invalid =
TimeSpan(Constant<sint08>::Invalid);
The core String View class for the NDEVR API.
The core String class for the NDEVR API.
Stores a time span, or difference between two times, with an optional start time.
constexpr TimeSpan(const uint08 elapsed_nano_seconds)
Constructs a TimeSpan from an unsigned 64-bit nanosecond duration with no start time.
constexpr TimeSpan(const Time &start, const sint08 &elapsed_nano_seconds)
Constructs a TimeSpan from a start time and an elapsed nanosecond duration.
constexpr TimeSpan operator*(const sint08 &mult) const
Multiplies the elapsed duration by an integer factor.
constexpr TimeSpan operator/(const fltp08 &den) const
Divides the elapsed duration by a floating-point denominator.
constexpr bool operator==(const TimeSpan &time) const
Checks equality of both start time and elapsed duration.
Time m_start_time
The optional start time of this span. Invalid if not set.
constexpr sint08 elapsedNanoseconds() const
Returns the elapsed duration in nanoseconds.
constexpr TimeSpan & operator*=(const sint08 &mult)
Multiplies the elapsed duration in place by an integer factor.
constexpr void setStartTime(Time time)
Sets the start time of this span without modifying the elapsed duration.
constexpr bool operator<=(const TimeSpan &other) const
Compares elapsed durations, ignoring start time.
constexpr void setEndTime(Time time)
Sets the end time by recomputing the elapsed duration from the current start time.
constexpr bool operator>(const TimeSpan &other) const
Compares elapsed durations, ignoring start time.
constexpr fltp08 elapsedHours() const
Returns the elapsed duration in hours.
constexpr TimeSpan & operator+=(const TimeSpan &other)
Adds another span's elapsed duration to this one in place.
sint08 m_elapsed_time
The elapsed duration in nanoseconds. Can be negative for past spans.
constexpr fltp08 elapsedSeconds() const
Returns the elapsed duration in seconds.
Time endTime() const
Computes the end time by adding the elapsed duration to the start time.
constexpr t_type elapsedMilliseconds() const
Returns the elapsed duration in milliseconds.
constexpr TimeSpan & operator*=(const fltp08 &mult)
Multiplies the elapsed duration in place by a floating-point factor.
constexpr TimeSpan(sint04 elapsed_nano_seconds)
Constructs a TimeSpan from a signed 32-bit nanosecond duration with no start time.
constexpr TimeSpan(const sint08 elapsed_nano_seconds)
Constructs a TimeSpan from a signed 64-bit nanosecond duration with no start time.
constexpr TimeSpan operator-(const TimeSpan &other) const
Subtracts another span's elapsed duration from this one.
constexpr bool operator!=(const TimeSpan &time) const
Checks inequality of start time or elapsed duration.
constexpr void setElapsedHours(fltp08 elapsed_minutes)
Sets the elapsed duration in hours.
constexpr fltp08 elapsedMinutes() const
Returns the elapsed duration in minutes.
constexpr bool operator>=(const TimeSpan &other) const
Compares elapsed durations, ignoring start time.
constexpr TimeSpan(const Time &start, const fltp08 &elapsed_seconds)
Constructs a TimeSpan from a start time and an elapsed duration in seconds.
String getTimeString(const StringView &format_string) const
Formats the time span as a human-readable string using the given format.
constexpr TimeSpan(const fltp08 elapsed_seconds)
Constructs a TimeSpan from a duration in seconds with no start time.
constexpr Time startTime() const
Returns the start time of this span.
fltp08 elapsedPercent(Time time, bool clip_time) const
Computes the percentage of elapsed time at a given point within this span.
sint08 elapsedMonths() const
Returns the elapsed duration in whole months, accounting for calendar boundaries.
constexpr TimeSpan(uint04 elapsed_nano_seconds)
Constructs a TimeSpan from an unsigned 32-bit nanosecond duration with no start time.
constexpr bool operator<(const TimeSpan &other) const
Compares elapsed durations, ignoring start time.
constexpr TimeSpan & operator-=(const TimeSpan &other)
Subtracts another span's elapsed duration from this one in place.
sint08 elapsedDays() const
Returns the elapsed duration in whole days, accounting for calendar boundaries.
constexpr TimeSpan operator*(const fltp08 &mult) const
Multiplies the elapsed duration by a floating-point factor.
constexpr TimeSpan operator-() const
Negates the elapsed duration of this time span.
constexpr fltp08 operator/(const TimeSpan &time_2) const
Divides this span by another, returning the ratio of elapsed durations.
constexpr TimeSpan operator+(const TimeSpan &other) const
Adds two time spans, combining their elapsed durations.
bool contains(const Time &time) const
Checks whether the given time falls within this time span.
constexpr void setElapsedMinutes(fltp08 elapsed_minutes)
Sets the elapsed duration in minutes.
constexpr TimeSpan()
Constructs an invalid TimeSpan with no start time and an invalid elapsed duration.
constexpr void setElapsedSeconds(fltp08 elapsed_seconds)
Sets the elapsed duration in seconds.
TimeSpan(const Time &start, const Time &end)
Constructs a TimeSpan from a start and end time, computing the elapsed duration.
constexpr TimeSpan operator/(const sint08 &den) const
Divides the elapsed duration by an integer denominator.
Represents a timestamp with utilities for manipulation and conversion.
constexpr uint08 getNanoSeconds() const
Gets the time in nanoseconds since 1970.
The primary namespace for the NDEVR SDK.
static constexpr Angle< t_angle_type > & operator-=(Angle< t_angle_type > &angle, const Angle< t_angle_type > &sub)
Subtraction assignment operator for Angles.
constexpr Angle< t_angle_type > abs(const Angle< t_angle_type > &value)
Changes an input with a negative sign, to a positive sign.
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
double fltp08
Defines an alias representing an 8 byte floating-point number.
int32_t sint04
-Defines an alias representing a 4 byte, signed integer.
static constexpr Angle< t_type > operator-(const Angle< t_type > &angle_a, const Angle< t_type > &angle_b)
Subtraction operator.
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
static constexpr Angle< t_angle_type > & operator+=(Angle< t_angle_type > &angle, const Angle< t_angle_type > &add)
Addition assignment operator for Angles.
static constexpr bool IsInvalid(const Angle< t_type > &value)
Checks whether the given Angle holds an invalid value.
static constexpr Angle< t_type > operator+(const Angle< t_type > &angle_a, const Angle< t_type > &angle_b)
Addition operator.
constexpr Vector< t_dims, Angle< t_angle_type > > operator%(const Vector< t_dims, Angle< t_angle_type > > &vec_a, const Vector< t_dims, Angle< t_angle_type > > &vec_b)
Element-wise modulo operator for two Vectors of Angles.
int64_t sint08
-Defines an alias representing an 8 byte, signed integer -Can represent exact integer values -9223372...
constexpr t_to cast(const Angle< t_from > &value)
Casts an Angle from one backing type to another.
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
static const bool Float
Whether this type behaves as a floating-point value.
static const bool Buffer
Whether this type is a buffer.
static const bool Unsigned
Whether this type is unsigned.
static const uint01 Dimensions
The number of dimensions (0 for scalar types).
static constexpr ObjectInfo< TimeSpan, false, false > VectorSub()
Returns the ObjectInfo for the vector sub-element type (identity for scalars).
static const bool Primitive
Whether this type is a primitive.
static const bool String
Whether this type is a string.
static const bool Vector
Whether this type is a vector.
static const bool Color
Whether this type is a color.
static const bool Boolean
Whether this type is a boolean.
static const bool Number
Whether this type is numeric.
static const bool Pointer
Whether this type is a pointer.
static const bool Integer
Whether this type is an integer.
Information about the object.