Ignition Transport

API Reference

8.1.0
NetworkClock Class Reference

A Clock interface implementation that uses ignition::msgs::Clock messages distributed across the network. More...

#include <Clock.hh>

Public Types

enum  TimeBase : int64_t { REAL, SIM, SYS }
 Network clock time bases. More...
 

Public Member Functions

 NetworkClock (const std::string &_topicName, const TimeBase _timeBase=TimeBase::SIM)
 Constructor that sets the initial time range option. More...
 
 ~NetworkClock () override
 Destructor. More...
 
bool IsReady () const override
 Checks whether the clock is ready to be used or not. More...
 
void SetTime (const std::chrono::nanoseconds _time)
 Sets and distributes the given clock time. More...
 
std::chrono::nanoseconds Time () const override
 Gets clock time. More...
 
- Public Member Functions inherited from Clock
virtual ~Clock ()=default
 Virtual destructor. More...
 

Detailed Description

A Clock interface implementation that uses ignition::msgs::Clock messages distributed across the network.

Member Enumeration Documentation

◆ TimeBase

enum TimeBase : int64_t
strong

Network clock time bases.

Enumerator
REAL 

Use Clock message real time field as time base.

SIM 

Use Clock message sim time field as time base.

SYS 

Use Clock message sys time field as time base.

Constructor & Destructor Documentation

◆ NetworkClock()

NetworkClock ( const std::string _topicName,
const TimeBase  _timeBase = TimeBase::SIM 
)
explicit

Constructor that sets the initial time range option.

Parameters
[in]_topicNameName of the ignition::msgs::Clock type topic to be used
[in]_timeBaseTime base for this clock, defaults to simulation time

◆ ~NetworkClock()

~NetworkClock ( )
override

Destructor.

Member Function Documentation

◆ IsReady()

bool IsReady ( ) const
overridevirtual

Checks whether the clock is ready to be used or not.

Returns
True if clock is ready to be used, false otherwise

Implements Clock.

◆ SetTime()

void SetTime ( const std::chrono::nanoseconds  _time)

Sets and distributes the given clock time.

Parameters
[in]_timeThe clock time to be set
Remarks
No clock arbitration is performed

◆ Time()

std::chrono::nanoseconds Time ( ) const
overridevirtual

Gets clock time.

Returns
Current clock time, in nanoseconds

Implements Clock.


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