Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
uavcan::TimerEventForwarder< Callback_ > Class Template Reference

#include <timer.hpp>

Inheritance diagram for uavcan::TimerEventForwarder< Callback_ >:
Inheritance graph
[legend]

Public Types

typedef Callback_ Callback
 

Public Member Functions

const CallbackgetCallback () const
 
void setCallback (const Callback &callback)
 
 TimerEventForwarder (INode &node)
 
 TimerEventForwarder (INode &node, const Callback &callback)
 
- Public Member Functions inherited from uavcan::TimerBase
MonotonicTime getDeadline () const
 
MonotonicDuration getPeriod () const
 
SchedulergetScheduler () const
 
bool isRunning () const
 
void startOneShotWithDeadline (MonotonicTime deadline)
 
void startOneShotWithDelay (MonotonicDuration delay)
 
void startPeriodic (MonotonicDuration period)
 
void stop ()
 
 TimerBase (INode &node)
 

Private Member Functions

virtual void handleTimerEvent (const TimerEvent &event)
 

Private Attributes

Callback callback_
 

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 Typedef Documentation

◆ Callback

template<typename Callback_ >
typedef Callback_ uavcan::TimerEventForwarder< Callback_ >::Callback

Definition at line 99 of file timer.hpp.

Constructor & Destructor Documentation

◆ TimerEventForwarder() [1/2]

template<typename Callback_ >
uavcan::TimerEventForwarder< Callback_ >::TimerEventForwarder ( INode node)
inlineexplicit

Definition at line 117 of file timer.hpp.

◆ TimerEventForwarder() [2/2]

template<typename Callback_ >
uavcan::TimerEventForwarder< Callback_ >::TimerEventForwarder ( INode node,
const Callback callback 
)
inline

Definition at line 122 of file timer.hpp.

Member Function Documentation

◆ getCallback()

template<typename Callback_ >
const Callback& uavcan::TimerEventForwarder< Callback_ >::getCallback ( ) const
inline

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.

◆ handleTimerEvent()

template<typename Callback_ >
virtual void uavcan::TimerEventForwarder< Callback_ >::handleTimerEvent ( const TimerEvent event)
inlineprivatevirtual

Implement this method in your class to receive callbacks.

Implements uavcan::TimerBase.

Definition at line 104 of file timer.hpp.

◆ setCallback()

template<typename Callback_ >
void uavcan::TimerEventForwarder< Callback_ >::setCallback ( const Callback callback)
inline

Definition at line 132 of file timer.hpp.

Member Data Documentation

◆ callback_

template<typename Callback_ >
Callback uavcan::TimerEventForwarder< Callback_ >::callback_
private

Definition at line 102 of file timer.hpp.


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


uavcan_communicator
Author(s):
autogenerated on Fri Dec 13 2024 03:10:05