BipedalLocomotion::System::IClock class

IClock is the interface to the clock.

The Clock is considered as a singleton. Please use the ClockBuilder to create a clock. The default clock is the System::StdClock which uses only the std methods. To get the current time you can simply use the following line of code BipedalLocomotion::clock().now();

Derived classes

class RosClock final
RosClock implements the IClock interface using ros functions.
class StdClock final
StdClock implements the IClock interface using <chrono> from c++std library.
class YarpClock final
YarpClock implements the IClock interface using yarp functions.

Constructors, destructors, conversion operators

IClock() protected defaulted
The constructor is protected.
~IClock() defaulted virtual
Destructor.

Public functions

auto now() -> std::chrono::nanoseconds pure virtual
Get the current time.
void sleepFor(const std::chrono::nanoseconds& sleepDuration) pure virtual
Blocks the execution of the current thread for at least the specified sleepDuration.
void sleepUntil(const std::chrono::nanoseconds& time) pure virtual
Blocks the execution of the current thread until specified sleepTime has been reached.
void yield() pure virtual
Provides a hint to the implementation to reschedule the execution of threads, allowing other threads to run.

Function documentation

BipedalLocomotion::System::IClock::IClock() protected defaulted

The constructor is protected.

Please create the clock with ClockBulder.

std::chrono::nanoseconds BipedalLocomotion::System::IClock::now() pure virtual

Get the current time.

Returns The current time. The output of the function depends on the concrete implementation.

void BipedalLocomotion::System::IClock::sleepUntil(const std::chrono::nanoseconds& time) pure virtual

Blocks the execution of the current thread until specified sleepTime has been reached.

Parameters
time to block until