8#ifndef META_OCEAN_IO_SERIALIZATION_DATA_TIMESTAMP_H
9#define META_OCEAN_IO_SERIALIZATION_DATA_TIMESTAMP_H
21namespace Serialization
68 inline bool isDouble()
const;
74 inline bool isInt()
const;
80 inline double asDouble()
const;
86 inline int64_t asInt()
const;
93 inline double forceDouble()
const;
99 inline bool isValid()
const;
186 valueType_(VT_DOUBLE)
188 value_.doubleValue_ = value;
212 return value_.doubleValue_;
235 return double(
asInt());
250 ocean_assert(
false &&
"Value types do not match");
271 ocean_assert(
false &&
"Value types do not match");
This class implements an output bitstream.
Definition Bitstream.h:215
This class implements a data timestamp which can hold either a double or int64_t value.
Definition DataTimestamp.h:29
int64_t asInt() const
Returns the int64 value of this timestamp.
Definition DataTimestamp.h:215
double doubleValue_
The double value.
Definition DataTimestamp.h:176
double forceDouble() const
Returns the timestamp as a double value regardless of the actual value type.
Definition DataTimestamp.h:223
union Ocean::IO::Serialization::DataTimestamp::@2 value_
The union holding the value.
static bool write(OutputBitstream &outputBitstream, const DataTimestamp &dataTimestamp)
Writes a data timestamp to an output bitstream.
double asDouble() const
Returns the double value of this timestamp.
Definition DataTimestamp.h:207
ValueType valueType_
The value type.
Definition DataTimestamp.h:182
bool isDouble() const
Returns whether this timestamp holds a double value.
Definition DataTimestamp.h:197
bool isInt() const
Returns whether this timestamp holds an int64 value.
Definition DataTimestamp.h:202
bool isValid() const
Returns whether this timestamp is valid.
Definition DataTimestamp.h:239
bool operator==(const DataTimestamp &dataTimestamp) const
Returns whether two timestamps are equal.
DataTimestamp operator+(const DataTimestamp &dataTimestamp) const
Adds two timestamps and returns the result.
Definition DataTimestamp.h:244
bool operator>=(const DataTimestamp &dataTimestamp) const
Returns whether this timestamp is greater than or equal to another timestamp.
bool operator<=(const DataTimestamp &dataTimestamp) const
Returns whether this timestamp is less than or equal to another timestamp.
bool operator>(const DataTimestamp &dataTimestamp) const
Returns whether this timestamp is greater than another timestamp.
DataTimestamp()=default
Creates a new invalid data timestamp.
DataTimestamp & operator+=(const DataTimestamp &dataTimestamp)
Adds another timestamp to this timestamp.
Definition DataTimestamp.h:265
bool operator<(const DataTimestamp &dataTimestamp) const
Returns whether this timestamp is less than another timestamp.
int64_t intValue_
The int64 value.
Definition DataTimestamp.h:178
ValueType
Definition of the value types.
Definition DataTimestamp.h:36
@ VT_DOUBLE
Double value type.
Definition DataTimestamp.h:40
@ VT_INT64
Int64 value type.
Definition DataTimestamp.h:42
@ VT_INVALID
Invalid value type.
Definition DataTimestamp.h:38
static bool read(InputBitstream &inputBitstream, DataTimestamp &dataTimestamp)
Reads a data timestamp from an input bitstream.
The namespace covering the entire Ocean framework.
Definition Accessor.h:15
AutomaticDifferentiationT< T1, TNumeric1 > operator+(const T2 &left, const AutomaticDifferentiationT< T1, TNumeric1 > &right)
Definition AutomaticDifferentiation.h:418