ADTF
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
kernel_timer

Class that wraps a kernel timer to call a method at specified intervals. More...

#include <kernel_timer.h>

Classes

struct  Impl
 
struct  ImplBase
 

Public Member Functions

 kernel_timer ()
 Default constructor.
 
 kernel_timer (const kernel_timer &)=delete
 
 kernel_timer (kernel_timer &&)
 Move constructor.
 
template<typename Callable, typename ... Args>
 kernel_timer (adtf::services::IKernel::tTimerClock eClock, const adtf::services::IKernel::tSchedulingInfo &sScheduling, const char *strName, tTimeStamp tmPeriod, tTimeStamp tmInitialDelay, Callable &&pFunc, Args &&... args)
 Constructor that creates a new timer with a given clock and scheduling parameters.
 
template<typename Callable, typename ... Args>
 kernel_timer (tTimeStamp tmMaximumExectionTime, adtf::services::IKernel::tTimerClock eClock, const adtf::services::IKernel::tSchedulingInfo &sScheduling, const char *strName, tTimeStamp tmPeriod, tTimeStamp tmInitialDelay, uint32_t nFlags, Callable &&pFunc, Args &&... args)
 Constructor that creates a new timer with a given clock, scheduling parameters and flags.
 
template<typename Callable, typename ... Args>
 kernel_timer (const char *strName, tTimeStamp tmPeriod, tTimeStamp tmInitialDelay, Callable &&pFunc, Args &&... args)
 Constructor that creates a new timer.
 
 ~kernel_timer ()
 Destructor.
 
kernel_timeroperator= (kernel_timer &&oOther)
 Move assignment operator.
 
void Swap (kernel_timer &oOther)
 Swaps two timers.
 
bool Stoppable () const
 Whether or not the timer is stoppable, i.e.
 
tResult Stop ()
 Stop the timer.
 
tResult SetScheduling (const adtf::services::IKernel::tSchedulingInfo &sScheduling)
 Changes the scheduling parameters of the timer.
 
tResult GetScheduling (adtf::services::IKernel::tSchedulingInfo &sScheduling) const
 Retrieves the scheduling parameters of the thread.
 

Private Types

typedef std::shared_ptr< ImplBaseshared_base_type
 

Private Member Functions

template<typename Callable>
std::shared_ptr< Impl< Callable > > MakeCallable (Callable &&pFunc)
 
tResult Create (const char *strName, const adtf::services::IKernel::tSchedulingInfo &sScheduling, adtf::services::IKernel::tTimerClock eClock, tTimeStamp tmPeriod, tTimeStamp tmInitialDelay)
 
tResult Create (const char *strName, const adtf::services::IKernel::tSchedulingInfo &sScheduling, adtf::services::IKernel::tTimerClock eClock, tTimeStamp tmPeriod, tTimeStamp tmInitialDelay, tTimeStamp tmMaximumExecutionTime, uint32_t nFlags)
 

Private Attributes

shared_base_type m_pCallable
 

Detailed Description

Class that wraps a kernel timer to call a method at specified intervals.

Definition at line 19 of file kernel_timer.h.

Member Typedef Documentation

◆ shared_base_type

typedef std::shared_ptr<ImplBase> shared_base_type
private

Definition at line 24 of file kernel_timer.h.

Constructor & Destructor Documentation

◆ kernel_timer() [1/3]

template<typename Callable, typename ... Args>
kernel_timer ( adtf::services::IKernel::tTimerClock eClock,
const adtf::services::IKernel::tSchedulingInfo & sScheduling,
const char * strName,
tTimeStamp tmPeriod,
tTimeStamp tmInitialDelay,
Callable && pFunc,
Args &&... args )
inline

Constructor that creates a new timer with a given clock and scheduling parameters.

Definition at line 73 of file kernel_timer.h.

References kernel_timer().

◆ kernel_timer() [2/3]

template<typename Callable, typename ... Args>
kernel_timer ( tTimeStamp tmMaximumExectionTime,
adtf::services::IKernel::tTimerClock eClock,
const adtf::services::IKernel::tSchedulingInfo & sScheduling,
const char * strName,
tTimeStamp tmPeriod,
tTimeStamp tmInitialDelay,
uint32_t nFlags,
Callable && pFunc,
Args &&... args )
inline

Constructor that creates a new timer with a given clock, scheduling parameters and flags.

Definition at line 88 of file kernel_timer.h.

References kernel_timer().

◆ kernel_timer() [3/3]

template<typename Callable, typename ... Args>
kernel_timer ( const char * strName,
tTimeStamp tmPeriod,
tTimeStamp tmInitialDelay,
Callable && pFunc,
Args &&... args )
inline

Constructor that creates a new timer.

Definition at line 104 of file kernel_timer.h.

References kernel_timer().

◆ ~kernel_timer()

Destructor.

This will stop the timer.

Member Function Documentation

◆ GetScheduling()

tResult GetScheduling ( adtf::services::IKernel::tSchedulingInfo & sScheduling) const

Retrieves the scheduling parameters of the thread.

Parameters
[in]sSchedulingThe scheduling parameters.
Returns
Standard result.

◆ MakeCallable()

template<typename Callable>
std::shared_ptr< Impl< Callable > > MakeCallable ( Callable && pFunc)
inlineprivate

Definition at line 49 of file kernel_timer.h.

◆ operator=()

kernel_timer & operator= ( kernel_timer && oOther)

Move assignment operator.

Parameters
[in,out]oOtherThe object that should be moved.
Returns
A reference to this.

References kernel_timer().

◆ SetScheduling()

tResult SetScheduling ( const adtf::services::IKernel::tSchedulingInfo & sScheduling)

Changes the scheduling parameters of the timer.

Parameters
[in]sSchedulingThe new scheduling parameters.
Returns
Standard result.

◆ Stop()

tResult Stop ( )

Stop the timer.

Mind that the destructor calls this method, so there is no need to call this method directly.

Returns
Standard result.

◆ Stoppable()

bool Stoppable ( ) const

Whether or not the timer is stoppable, i.e.

currently running.

Returns
Whether or not the timer is stoppable, i.e. currently running.

◆ Swap()

void Swap ( kernel_timer & oOther)

Swaps two timers.

Parameters
[in,out]oOtherThe second timer.

References kernel_timer().

Member Data Documentation

◆ m_pCallable

shared_base_type m_pCallable
private

Definition at line 54 of file kernel_timer.h.