ADTF
kernel_timer

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

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. More...
 
kernel_timeroperator= (kernel_timer &&oOther)
 Move assignment operator. More...
 
void Swap (kernel_timer &oOther)
 Swaps two timers. More...
 
bool Stoppable () const
 Whether or not the timer is stoppable, i.e. More...
 
tResult Stop ()
 Stop the timer. More...
 
tResult SetScheduling (const adtf::services::IKernel::tSchedulingInfo &sScheduling)
 Changes the scheduling parameters of the timer. More...
 
tResult GetScheduling (adtf::services::IKernel::tSchedulingInfo &sScheduling) const
 Retrieves the scheduling parameters of the thread. More...
 

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.

Constructor & Destructor Documentation

◆ ~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.

◆ operator=()

kernel_timer& operator= ( kernel_timer &&  oOther)

Move assignment operator.

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

◆ 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.

Referenced by kernel_timeout::Start().

◆ Swap()

void Swap ( kernel_timer oOther)

Swaps two timers.

Parameters
[in,out]oOtherThe second timer.