Since time is continuous, it may be difficult to know the exact time stamp of a desired message. The QualifiedTime class provides a way to tailor how a time stamp is interpreted by the message query. More...
#include <QualifiedTime.hh>
Public Types | |
enum class | Qualifier : int64_t { INCLUSIVE = 0 , EXCLUSIVE } |
The Qualifier determines the behavior of how a message is selected. More... | |
using | Time = std::chrono::nanoseconds |
Convenient typedef for our time representation. Note that any std::chrono::duration type can be implicitly converted to this type. E.g. you can pass a. | |
Public Member Functions | |
QualifiedTime () | |
Default constructor. The time will be treated as indeterminate. This means that the QualifiedTime object will be taken to indicate that no time has been specified at all. | |
QualifiedTime (const QualifiedTime &_other) | |
Copy constructor. | |
template<typename Rep , typename Period > | |
QualifiedTime (const std::chrono::duration< Rep, Period > &_time, Qualifier _qualifier=Qualifier::INCLUSIVE) | |
Construct a qualified time specifier. This allows implicit conversion from any std::chrono::duration type. | |
QualifiedTime (const Time &_time, Qualifier _qualifier=Qualifier::INCLUSIVE) | |
Construct a qualified time specifier. | |
QualifiedTime (QualifiedTime &&_old)=default | |
move constructor | |
~QualifiedTime () | |
Destructor. | |
void | Clear () |
Set this QualifiedTime object to be indeterminate. | |
const Qualifier * | GetQualifier () const |
Get the qualifier for this qualified time, unless the time is indeterminate. | |
const Time * | GetTime () const |
Get the time stamp for this qualified time, unless the time is indeterminate. | |
bool | IsIndeterminate () const |
Indicates whether this QualifiedTime object is indeterminate. | |
bool | operator!= (const QualifiedTime &_other) const |
Inequality operator. | |
QualifiedTime & | operator= (const QualifiedTime &_other) |
Copy assignment operator. | |
QualifiedTime & | operator= (QualifiedTime &&)=default |
move assignment operator | |
bool | operator== (const QualifiedTime &_other) const |
Equality operator. | |
void | SetTime (const Time &_time, Qualifier _qualifier=Qualifier::INCLUSIVE) |
Set the time that this QualifiedTime object represents. | |
Detailed Description
Since time is continuous, it may be difficult to know the exact time stamp of a desired message. The QualifiedTime class provides a way to tailor how a time stamp is interpreted by the message query.
Note that the value of this time object may be interpreted as a relative time or as an absolute time stamp depending on the context in which it gets used.
Member Typedef Documentation
◆ Time
using Time = std::chrono::nanoseconds |
Convenient typedef for our time representation. Note that any std::chrono::duration type can be implicitly converted to this type. E.g. you can pass a.
into any function that accepts this Time type.
Member Enumeration Documentation
◆ Qualifier
|
strong |
The Qualifier determines the behavior of how a message is selected.
Enumerator | |
---|---|
INCLUSIVE | This point in time should be seen as a closed (inclusive) time marker. When used in a QualifiedTimeRange, the range will include this exact point in time. |
EXCLUSIVE | This point in time should be seen as an open (exclusive) time marker. When used in a QualifiedTimeRange, the range will NOT include this exact point in time, but it will include everything leading up to it. |
Constructor & Destructor Documentation
◆ QualifiedTime() [1/5]
QualifiedTime | ( | const Time & | _time, |
Qualifier | _qualifier = Qualifier::INCLUSIVE |
||
) |
Construct a qualified time specifier.
- Parameters
-
[in] _time The time stamp that is used as the focal point of this qualified time. [in] _qualifier The qualifier that determines the exact interpretation of the _time value.
◆ QualifiedTime() [2/5]
|
inline |
Construct a qualified time specifier. This allows implicit conversion from any std::chrono::duration type.
- Parameters
-
[in] _time The time stamp that is used as the focal point of this qualified time. [in] _qualifier The qualifier that determines the exact interpretation of the _time value.
◆ QualifiedTime() [3/5]
QualifiedTime | ( | ) |
Default constructor. The time will be treated as indeterminate. This means that the QualifiedTime object will be taken to indicate that no time has been specified at all.
- See also
- IsIndeterminate()
◆ QualifiedTime() [4/5]
QualifiedTime | ( | const QualifiedTime & | _other | ) |
Copy constructor.
- Parameters
-
[in] _other Another QualifiedTime
◆ QualifiedTime() [5/5]
|
default |
move constructor
- Parameters
-
[in] _old the instance being moved into this one
◆ ~QualifiedTime()
~QualifiedTime | ( | ) |
Destructor.
Member Function Documentation
◆ Clear()
void Clear | ( | ) |
Set this QualifiedTime object to be indeterminate.
- See also
- IsIndeterminate()
◆ GetQualifier()
const Qualifier * GetQualifier | ( | ) | const |
Get the qualifier for this qualified time, unless the time is indeterminate.
- Returns
- A pointer to the qualifier that is specified by this QualifiedTime object, or a nullptr if this QualifiedTime is indeterminate.
◆ GetTime()
const Time * GetTime | ( | ) | const |
Get the time stamp for this qualified time, unless the time is indeterminate.
- Returns
- A pointer to the time value that is specified by this QualifiedTime object, or a nullptr if this QualifiedTime is indeterminate.
◆ IsIndeterminate()
bool IsIndeterminate | ( | ) | const |
Indicates whether this QualifiedTime object is indeterminate.
When an indeterminate time is used as the end of a range, it implies that the range should go on endlessly. When used as the beginning of a range, it means that the range should extend as far into the past as possible.
- Returns
- true if this QualifiedTime is indeterminate, or false if it does have a determined time.
◆ operator!=()
bool operator!= | ( | const QualifiedTime & | _other | ) | const |
Inequality operator.
- Parameters
-
[in] _other Another QualifiedTime
- Returns
- Opposite value of operator==(const QualifiedTime &)
◆ operator=() [1/2]
QualifiedTime & operator= | ( | const QualifiedTime & | _other | ) |
Copy assignment operator.
- Parameters
-
[in] _other Another QualifiedTime
- Returns
- Reference to this object
◆ operator=() [2/2]
|
default |
move assignment operator
- Returns
- Reference to this object
◆ operator==()
bool operator== | ( | const QualifiedTime & | _other | ) | const |
Equality operator.
- Parameters
-
[in] _other Another QualifiedTime
- Returns
- True if the times are equal. When either time is indeterminate, this will always return false, similar to the behavior of NaN comparisons.
◆ SetTime()
void SetTime | ( | const Time & | _time, |
Qualifier | _qualifier = Qualifier::INCLUSIVE |
||
) |
Set the time that this QualifiedTime object represents.
- Parameters
-
[in] _time The time stamp that is used as the focal point of this qualified time. [in] _qualifier The qualifier that determines the exact interpretation of the _time value.
The documentation for this class was generated from the following file: