YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
yarp::os::Timer Class Reference

#include <yarp/os/Timer.h>

Classes

class  PrivateImpl
 

Public Types

typedef std::function< bool(const yarp::os::YarpTimerEvent &)> TimerCallback
 

Public Member Functions

 Timer (const Timer &)=delete
 
Timer operator= (const Timer &)=delete
 
 Timer (const yarp::os::TimerSettings &settings, const TimerCallback &callback, bool newThread, std::mutex *mutex=nullptr)
 Timer constructor.
 
template<class T >
 Timer (const yarp::os::TimerSettings &settings, bool(T::*callback)(const yarp::os::YarpTimerEvent &), T *object, bool newThread, std::mutex *mutex=nullptr)
 Timer constructor.
 
template<class T >
 Timer (const yarp::os::TimerSettings &settings, bool(T::*callback)(const yarp::os::YarpTimerEvent &) const, const T *object, bool newThread, std::mutex *mutex=nullptr)
 const version.
 
virtual ~Timer ()
 
void setSettings (const yarp::os::TimerSettings &settings)
 setSettings
 
const yarp::os::TimerSettings getSettings ()
 getSettings
 
virtual bool start ()
 
virtual bool step ()
 
virtual void stop ()
 
virtual bool isRunning ()
 

Detailed Description

Definition at line 96 of file Timer.h.

Member Typedef Documentation

◆ TimerCallback

Definition at line 99 of file Timer.h.

Constructor & Destructor Documentation

◆ Timer() [1/4]

yarp::os::Timer::Timer ( const Timer )
delete

◆ Timer() [2/4]

Timer::Timer ( const yarp::os::TimerSettings settings,
const TimerCallback callback,
bool  newThread,
std::mutex *  mutex = nullptr 
)

Timer constructor.

Parameters
settingsthe timer settings. see TimerSettings documentation
callbackthe pointer to the function to call. the signature should be "bool foo(const yarp::os::YarpTimerEvent&)" and if it return false the timer will stop
mutexif not nullptr will be locked before calling callback and released just after
newThreadwhether the timer should be executed in a dedicated thread or with all the timers with newThread == false (in any case they will not run in the main thread)

Definition at line 272 of file Timer.cpp.

◆ Timer() [3/4]

template<class T >
yarp::os::Timer::Timer ( const yarp::os::TimerSettings settings,
bool(T::*)(const yarp::os::YarpTimerEvent &)  callback,
T *  object,
bool  newThread,
std::mutex *  mutex = nullptr 
)
inline

Timer constructor.

Parameters
settingsthe timer settings. see TimerSettings documentation
callbackthe pointer to the member method to call
objectthe pointer to the object
mutexif not nullptr will be locked before calling callback and released just after
newThreadwhether the timer should be executed in a his own thread or with all the timers with newThread == false (in any case they will not run in the main thread)

Definition at line 132 of file Timer.h.

◆ Timer() [4/4]

template<class T >
yarp::os::Timer::Timer ( const yarp::os::TimerSettings settings,
bool(T::*)(const yarp::os::YarpTimerEvent &) const  callback,
const T *  object,
bool  newThread,
std::mutex *  mutex = nullptr 
)
inline

const version.

Definition at line 146 of file Timer.h.

◆ ~Timer()

Timer::~Timer ( )
virtual

Definition at line 364 of file Timer.cpp.

Member Function Documentation

◆ getSettings()

const TimerSettings Timer::getSettings ( )

getSettings

Returns
the current settings

Definition at line 354 of file Timer.cpp.

◆ isRunning()

bool Timer::isRunning ( )
virtual

Definition at line 359 of file Timer.cpp.

◆ operator=()

Timer yarp::os::Timer::operator= ( const Timer )
delete

◆ setSettings()

void Timer::setSettings ( const yarp::os::TimerSettings settings)

setSettings

Parameters
settingsthe new settings

Definition at line 349 of file Timer.cpp.

◆ start()

bool Timer::start ( )
virtual

Definition at line 279 of file Timer.cpp.

◆ step()

bool Timer::step ( )
virtual

Definition at line 285 of file Timer.cpp.

◆ stop()

void Timer::stop ( )
virtual

Definition at line 290 of file Timer.cpp.


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