Руслан Урядинский / libuavcan

Dependents:   UAVCAN UAVCAN_Subscriber

Embed: (wiki syntax)

« Back to documentation index

TimerEventForwarder< Callback_ > Class Template Reference

TimerEventForwarder< Callback_ > Class Template Reference

Wrapper over TimerBase that forwards callbacks into arbitrary handlers, like functor objects, member functions or static functions. More...

#include <timer.hpp>

Inherits uavcan::TimerBase.

Public Member Functions

const Callback & getCallback () const
 Get/set the callback object.
void startOneShotWithDeadline (MonotonicTime deadline)
 Various ways to start the timer - periodically or once.
MonotonicDuration getPeriod () const
 Returns period if the timer is in periodic mode.

Detailed Description

template<typename Callback_>
class uavcan::TimerEventForwarder< Callback_ >

Wrapper over TimerBase that forwards callbacks into arbitrary handlers, like functor objects, member functions or static functions.

Callback must be set before the first event; otherwise the event will generate a fatal error.

Also take a look at MethodBinder<>, which may come useful if C++11 features are not available.

Template Parameters:
Callback_Callback type. Shall accept const reference to TimerEvent as its argument.

Definition at line 96 of file timer.hpp.


Member Function Documentation

const Callback& getCallback (  ) const

Get/set the callback object.

Callback must be set before the first event happens; otherwise the event will generate a fatal error.

Definition at line 131 of file timer.hpp.

MonotonicDuration getPeriod (  ) const [inherited]

Returns period if the timer is in periodic mode.

Returns infinite duration if the timer is in one-shot mode or stopped.

Definition at line 77 of file timer.hpp.

void startOneShotWithDeadline ( MonotonicTime  deadline ) [inherited]

Various ways to start the timer - periodically or once.

If it is running already, it will be restarted. If the deadline is in the past, the event will fire immediately. In periodic mode the timer does not accumulate error over time.

Definition at line 28 of file uc_timer.cpp.