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;
170 valueType_(VT_DOUBLE)
172 value_.doubleValue_ = value;
196 return value_.doubleValue_;
219 return double(
asInt());
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:199
double doubleValue_
The double value.
Definition DataTimestamp.h:160
double forceDouble() const
Returns the timestamp as a double value regardless of the actual value type.
Definition DataTimestamp.h:207
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:191
ValueType valueType_
The value type.
Definition DataTimestamp.h:166
bool isDouble() const
Returns whether this timestamp holds a double value.
Definition DataTimestamp.h:181
bool isInt() const
Returns whether this timestamp holds an int64 value.
Definition DataTimestamp.h:186
bool isValid() const
Returns whether this timestamp is valid.
Definition DataTimestamp.h:223
bool operator==(const DataTimestamp &dataTimestamp) const
Returns whether two timestamps are equal.
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.
bool operator<(const DataTimestamp &dataTimestamp) const
Returns whether this timestamp is less than another timestamp.
int64_t intValue_
The int64 value.
Definition DataTimestamp.h:162
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