mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
|
Common wrapper representing the functionality of the ros::Timer. More...
#include <timer.h>
Public Types | |
using | callback_t = std::function< void(const ros::TimerEvent &)> |
Public Member Functions | |
virtual void | stop ()=0 |
stop the timer | |
virtual void | start ()=0 |
start the timer | |
virtual void | setPeriod (const ros::Duration &duration, const bool reset=true)=0 |
set the timer period/duration More... | |
virtual void | setCallback (const std::function< void(const ros::TimerEvent &)> &callback)=0 |
change the callback method More... | |
virtual bool | running ()=0 |
returns true if callbacks should be called More... | |
MRSTimer (const MRSTimer &)=default | |
MRSTimer (MRSTimer &&)=default | |
MRSTimer & | operator= (const MRSTimer &)=default |
MRSTimer & | operator= (MRSTimer &&)=default |
Common wrapper representing the functionality of the ros::Timer.
The implementation can then use either ros::Timer (the ROSTimer class) or threads and synchronization primitives from the C++ standard library (the ThreadTimer class). Both these variants implement the same interface.
|
pure virtual |
returns true if callbacks should be called
Implemented in mrs_lib::ThreadTimer, and mrs_lib::ROSTimer.
|
pure virtual |
change the callback method
Usable e.g. for running thread with a specific parameter if you bind it using std::bind
callback | callback method to be called. |
Implemented in mrs_lib::ThreadTimer, and mrs_lib::ROSTimer.
|
pure virtual |
set the timer period/duration
duration | |
reset |
Implemented in mrs_lib::ThreadTimer, and mrs_lib::ROSTimer.