8#ifndef META_OCEAN_IO_SERIALIZATION_DATA_TIMESTAMP_H
9#define META_OCEAN_IO_SERIALIZATION_DATA_TIMESTAMP_H
21namespace Serialization
71 inline bool isDouble()
const;
77 inline bool isInt()
const;
83 inline double asDouble()
const;
89 inline int64_t asInt()
const;
96 inline double forceDouble()
const;
102 inline bool isValid()
const;
189 valueType_(VT_DOUBLE)
191 value_.doubleValue_ = value;
215 return value_.doubleValue_;
238 return double(
asInt());
253 ocean_assert(
false &&
"Value types do not match");
274 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:32
int64_t asInt() const
Returns the int64 value of this timestamp.
Definition DataTimestamp.h:218
double doubleValue_
The double value.
Definition DataTimestamp.h:179
double forceDouble() const
Returns the timestamp as a double value regardless of the actual value type.
Definition DataTimestamp.h:226
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:210
ValueType valueType_
The value type.
Definition DataTimestamp.h:185
bool isDouble() const
Returns whether this timestamp holds a double value.
Definition DataTimestamp.h:200
bool isInt() const
Returns whether this timestamp holds an int64 value.
Definition DataTimestamp.h:205
bool isValid() const
Returns whether this timestamp is valid.
Definition DataTimestamp.h:242
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:247
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:268
bool operator<(const DataTimestamp &dataTimestamp) const
Returns whether this timestamp is less than another timestamp.
int64_t intValue_
The int64 value.
Definition DataTimestamp.h:181
ValueType
Definition of the value types.
Definition DataTimestamp.h:39
@ VT_DOUBLE
Double value type.
Definition DataTimestamp.h:43
@ VT_INT64
Int64 value type.
Definition DataTimestamp.h:45
@ VT_INVALID
Invalid value type.
Definition DataTimestamp.h:41
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:417