bipedal locomotion framework
A suite of libraries for achieving bipedal locomotion on humanoid robots
BipedalLocomotion::System::IClock Class Referenceabstract

IClock is the interface to the clock. More...

#include <System/include/BipedalLocomotion/System/IClock.h>

Public Member Functions

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

Protected Member Functions

 IClock ()=default
 The constructor is protected. More...
 

Detailed Description

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

virtual std::chrono::nanoseconds now()=0
Get the current time.
System::IClock & clock()
Get the clock singleton.
Definition: Clock.cpp:11

Constructor & Destructor Documentation

◆ IClock()

BipedalLocomotion::System::IClock::IClock ( )
protecteddefault

The constructor is protected.

Please create the clock with ClockBulder.

Member Function Documentation

◆ now()

virtual 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.
Note
BipedalLocomotion::clock().now().count() returns a double containing the seconds since epoch.

Implemented in BipedalLocomotion::System::YarpClock, BipedalLocomotion::System::RosClock, and BipedalLocomotion::System::StdClock.

◆ sleepFor()

virtual void BipedalLocomotion::System::IClock::sleepFor ( const std::chrono::nanoseconds &  sleepDuration)
pure virtual

Blocks the execution of the current thread for at least the specified sleepDuration.

Parameters
timeduration to sleep

Implemented in BipedalLocomotion::System::YarpClock, BipedalLocomotion::System::RosClock, and BipedalLocomotion::System::StdClock.

◆ sleepUntil()

virtual 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
timeto block until

Implemented in BipedalLocomotion::System::YarpClock, BipedalLocomotion::System::RosClock, and BipedalLocomotion::System::StdClock.


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