argos::CRate Class Reference

#include <rate.h>

Public Member Functions

 CRate (Real f_rate)
 Class constructor. More...
 
 ~CRate ()
 Class destructor. More...
 
UInt64 ElapsedUS () const
 Returns the time elapsed since the last sleep in microseconds. More...
 
Real ElapsedS () const
 Returns the time elapsed since the last sleep in seconds. More...
 
void Sleep ()
 Sleeps for the appropriate time to complete the period. More...
 
Real GetRate () const
 Returns the rate. More...
 
void SetRate (Real f_rate)
 Sets the rate and resets the internal clock. More...
 

Detailed Description

Definition at line 27 of file rate.h.

Constructor & Destructor Documentation

◆ CRate()

CRate::CRate ( Real  f_rate)

Class constructor.

Parameters
f_rateThe number of ticks per second.

Definition at line 9 of file rate.cpp.

◆ ~CRate()

argos::CRate::~CRate ( )
inline

Class destructor.

Definition at line 40 of file rate.h.

Member Function Documentation

◆ ElapsedS()

Real CRate::ElapsedS ( ) const

Returns the time elapsed since the last sleep in seconds.

Definition at line 29 of file rate.cpp.

◆ ElapsedUS()

UInt64 CRate::ElapsedUS ( ) const

Returns the time elapsed since the last sleep in microseconds.

Definition at line 16 of file rate.cpp.

◆ GetRate()

Real argos::CRate::GetRate ( ) const
inline

Returns the rate.

Definition at line 62 of file rate.h.

◆ SetRate()

void CRate::SetRate ( Real  f_rate)

Sets the rate and resets the internal clock.

Parameters
f_rateThe number of ticks per second.

Definition at line 62 of file rate.cpp.

◆ Sleep()

void CRate::Sleep ( )

Sleeps for the appropriate time to complete the period.

If the period was exceeded before this call, this method does not sleep and, instead, write a warning on the log.

Definition at line 38 of file rate.cpp.