Gazebo Transport

API Reference

13.4.0
QualifiedTime Class Reference

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. More...
 

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. More...
 
 QualifiedTime (const QualifiedTime &_other)
 Copy constructor. More...
 
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. More...
 
 QualifiedTime (const Time &_time, Qualifier _qualifier=Qualifier::INCLUSIVE)
 Construct a qualified time specifier. More...
 
 QualifiedTime (QualifiedTime &&_old)=default
 move constructor More...
 
 ~QualifiedTime ()
 Destructor. More...
 
void Clear ()
 Set this QualifiedTime object to be indeterminate. More...
 
const QualifierGetQualifier () const
 Get the qualifier for this qualified time, unless the time is indeterminate. More...
 
const TimeGetTime () const
 Get the time stamp for this qualified time, unless the time is indeterminate. More...
 
bool IsIndeterminate () const
 Indicates whether this QualifiedTime object is indeterminate. More...
 
bool operator!= (const QualifiedTime &_other) const
 Inequality operator. More...
 
QualifiedTimeoperator= (const QualifiedTime &_other)
 Copy assignment operator. More...
 
QualifiedTimeoperator= (QualifiedTime &&)=default
 move assignment operator More...
 
bool operator== (const QualifiedTime &_other) const
 Equality operator. More...
 
void SetTime (const Time &_time, Qualifier _qualifier=Qualifier::INCLUSIVE)
 Set the time that this QualifiedTime object represents. More...
 

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

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

enum Qualifier : int64_t
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]_timeThe time stamp that is used as the focal point of this qualified time.
[in]_qualifierThe qualifier that determines the exact interpretation of the _time value.

◆ QualifiedTime() [2/5]

QualifiedTime ( const std::chrono::duration< Rep, Period > &  _time,
Qualifier  _qualifier = Qualifier::INCLUSIVE 
)
inline

Construct a qualified time specifier. This allows implicit conversion from any std::chrono::duration type.

Parameters
[in]_timeThe time stamp that is used as the focal point of this qualified time.
[in]_qualifierThe qualifier that determines the exact interpretation of the _time value.

◆ QualifiedTime() [3/5]

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]_otherAnother QualifiedTime

◆ QualifiedTime() [5/5]

QualifiedTime ( QualifiedTime &&  _old)
default

move constructor

Parameters
[in]_oldthe instance being moved into this one

◆ ~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]_otherAnother QualifiedTime
Returns
Opposite value of operator==(const QualifiedTime &)

◆ operator=() [1/2]

QualifiedTime& operator= ( const QualifiedTime _other)

Copy assignment operator.

Parameters
[in]_otherAnother QualifiedTime
Returns
Reference to this object

◆ operator=() [2/2]

QualifiedTime& operator= ( QualifiedTime &&  )
default

move assignment operator

Returns
Reference to this object

◆ operator==()

bool operator== ( const QualifiedTime _other) const

Equality operator.

Parameters
[in]_otherAnother 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]_timeThe time stamp that is used as the focal point of this qualified time.
[in]_qualifierThe qualifier that determines the exact interpretation of the _time value.

The documentation for this class was generated from the following file: