distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
distortos::DynamicSoftwareTimer Class Reference

DynamicSoftwareTimer class is a type-erased interface for software timer that has dynamic storage for bound function. More...

#include "distortos/DynamicSoftwareTimer.hpp"

Inheritance diagram for distortos::DynamicSoftwareTimer:
[legend]
Collaboration diagram for distortos::DynamicSoftwareTimer:
[legend]

Public Member Functions

template<typename Function , typename... Args>
 DynamicSoftwareTimer (Function &&function, Args &&... args)
 DynamicSoftwareTimer's constructor. More...
 
- Public Member Functions inherited from distortos::SoftwareTimerCommon
constexpr SoftwareTimerCommon ()
 SoftwareTimerCommon's constructor. More...
 
 ~SoftwareTimerCommon () override
 SoftwareTimerCommon's destructor. More...
 
bool isRunning () const override
 
int start (TickClock::time_point timePoint, TickClock::duration period={}) override
 Starts the timer. More...
 
int stop () override
 Stops the timer. More...
 
 SoftwareTimerCommon (const SoftwareTimerCommon &)=delete
 
 SoftwareTimerCommon (SoftwareTimerCommon &&)=default
 
const SoftwareTimerCommonoperator= (const SoftwareTimerCommon &)=delete
 
SoftwareTimerCommonoperator= (SoftwareTimerCommon &&)=delete
 
int start (TickClock::duration duration, TickClock::duration period={})
 Starts the timer. More...
 
template<typename Rep1 , typename Period1 , typename Rep2 = TickClock::rep, typename Period2 = TickClock::period>
int start (const std::chrono::duration< Rep1, Period1 > duration, const std::chrono::duration< Rep2, Period2 > period={})
 Starts the timer. More...
 
virtual int start (TickClock::time_point timePoint, TickClock::duration period={})=0
 Starts the timer. More...
 
template<typename Duration , typename Rep = TickClock::rep, typename Period = TickClock::period>
int start (const std::chrono::time_point< TickClock, Duration > timePoint, const std::chrono::duration< Rep, Period > period={})
 Starts the timer. More...
 
- Public Member Functions inherited from distortos::SoftwareTimer
virtual ~SoftwareTimer ()=default
 SoftwareTimer's destructor. More...
 
int start (TickClock::duration duration, TickClock::duration period={})
 Starts the timer. More...
 
template<typename Rep1 , typename Period1 , typename Rep2 = TickClock::rep, typename Period2 = TickClock::period>
int start (const std::chrono::duration< Rep1, Period1 > duration, const std::chrono::duration< Rep2, Period2 > period={})
 Starts the timer. More...
 
template<typename Duration , typename Rep = TickClock::rep, typename Period = TickClock::period>
int start (const std::chrono::time_point< TickClock, Duration > timePoint, const std::chrono::duration< Rep, Period > period={})
 Starts the timer. More...
 

Private Member Functions

void run () override
 "Run" function of software timer More...
 

Private Attributes

std::function< void()> boundFunction_
 bound function object More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from distortos::SoftwareTimer
static void softwareTimerRunner (SoftwareTimer &softwareTimer)
 Software timer's function runner. More...
 

Detailed Description

DynamicSoftwareTimer class is a type-erased interface for software timer that has dynamic storage for bound function.

Constructor & Destructor Documentation

◆ DynamicSoftwareTimer()

template<typename Function , typename... Args>
distortos::DynamicSoftwareTimer::DynamicSoftwareTimer ( Function &&  function,
Args &&...  args 
)

DynamicSoftwareTimer's constructor.

Template Parameters
Functionis the function that will be executed
Argsare the arguments for function
Parameters
[in]functionis a function that will be executed from interrupt context at a later time
[in]argsare arguments for function

Member Function Documentation

◆ run()

void distortos::DynamicSoftwareTimer::run ( )
overrideprivatevirtual

"Run" function of software timer

Executes bound function object.

Implements distortos::SoftwareTimer.

Member Data Documentation

◆ boundFunction_

std::function<void()> distortos::DynamicSoftwareTimer::boundFunction_
private

bound function object


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