ADTF
Loading...
Searching...
No Matches
adtf::base::runnable< DEFAULT_ACTIVATION_TYPE, ANT_INTERFACE, FLASH_OR_ANT_INTERFACE, CALLABLE > Class Template Reference

#include <runnable.h>

Inherits adtf::ucom::catwo::object< Bases >.

Public Member Functions

 runnable ()=delete
 CTOR.
 
 runnable (CALLABLE &&fcRunFunc) noexcept
 
template<typename CALLABLE_WITH_TIMSTAMP, typename CALLABLE_TYPE = CALLABLE, std::enable_if_t< std::is_same_v< std::decay_t< CALLABLE_TYPE >, flash::IRunnable::tRunFunction > &&std::is_invocable_r_v< tResult, std::decay_t< CALLABLE_WITH_TIMSTAMP >, tTimeStamp >, bool > = true>
 runnable (CALLABLE_WITH_TIMSTAMP &&fcRunFunc) noexcept
 
 runnable (CALLABLE &&fcRunFunc, ant::IRunnable::tActivationType ui32ActivationType) noexcept
 
 ~runnable () override=default
 DTOR.
 
tResult Run (tTimeStamp tmTimeofActivation, ant::IRunnable::tActivationType ui32ActivationType, const void *pvUserData, size_t nUserDataSize) override
 
tResult Run (tNanoSeconds tmTimeofActivation, ant::IRunnable::tActivationType ui32ActivationType, const void *pvUserData, size_t nUserDataSize) override
 
ant::IRunnable::tActivationType GetActivationType () const override
 
- Public Member Functions inherited from adtf::ucom::catwo::object< Bases >
tResult GetInterface (const char *i_strIID, void *&o_pInterface) override
 Query interfaces on an object.
 
tResult GetInterface (const char *i_strIID, const void *&o_pInterface) const override
 Provides const correct interface querying.
 
void Destroy () const override
 Switch from non-virtual destructor to virtual destructor.
 
- Public Member Functions inherited from adtf::ucom::ant::IObject
 ADTF_IID (IObject, "object.ant.ucom.adtf.iid")
 

Protected Attributes

std::decay_t< CALLABLE > m_fcRunFunc
 given function to call on Run
 

Additional Inherited Members

- Protected Member Functions inherited from adtf::ucom::ant::IObject
 ~IObject ()=default
 Protected destructor --> Only the final implementation can be destroyed!
 

Detailed Description

template<ant::IRunnable::tActivationType DEFAULT_ACTIVATION_TYPE = ant::IRunnable::RUN_UNSPECIFIED, typename ANT_INTERFACE = ant::IRunnable, typename FLASH_OR_ANT_INTERFACE = flash::IRunnable, typename CALLABLE = flash::IRunnable::tRunFunction>
class adtf::base::runnable< DEFAULT_ACTIVATION_TYPE, ANT_INTERFACE, FLASH_OR_ANT_INTERFACE, CALLABLE >

Runnable template implementation for runnable interface. The given callable can have one of the following signatures:

- tResult(void)
- tResult(tTimeStamp)
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
tActivationType
Definition runnable_intf.h:45
A timestamp with nanosecond precision.
Definition chrono.h:23
Template Parameters
DEFAULT_ACTIVATION_TYPEThe default activation type for the runnable, which will be used if not specified within CTOR.
ANT_INTERFACEThe ant::IRunnable interface to expose, ant::IRunnable or any derived type.
FLASH_INTERFACEThe flash::IRunnable interface to expose, flash::IRunnable or any derived type.
CALLABLEThe type of the callable to be executed on Run, must be invocable with either of the defined signatures

Constructor & Destructor Documentation

◆ runnable() [1/3]

template<ant::IRunnable::tActivationType DEFAULT_ACTIVATION_TYPE = ant::IRunnable::RUN_UNSPECIFIED, typename ANT_INTERFACE = ant::IRunnable, typename FLASH_OR_ANT_INTERFACE = flash::IRunnable, typename CALLABLE = flash::IRunnable::tRunFunction>
adtf::base::runnable< DEFAULT_ACTIVATION_TYPE, ANT_INTERFACE, FLASH_OR_ANT_INTERFACE, CALLABLE >::runnable ( CALLABLE && fcRunFunc)
inlinenoexcept

CTOR with callable and default activation type

Parameters
fcRunFunccallable function object with expected signature.

◆ runnable() [2/3]

template<ant::IRunnable::tActivationType DEFAULT_ACTIVATION_TYPE = ant::IRunnable::RUN_UNSPECIFIED, typename ANT_INTERFACE = ant::IRunnable, typename FLASH_OR_ANT_INTERFACE = flash::IRunnable, typename CALLABLE = flash::IRunnable::tRunFunction>
template<typename CALLABLE_WITH_TIMSTAMP, typename CALLABLE_TYPE = CALLABLE, std::enable_if_t< std::is_same_v< std::decay_t< CALLABLE_TYPE >, flash::IRunnable::tRunFunction > &&std::is_invocable_r_v< tResult, std::decay_t< CALLABLE_WITH_TIMSTAMP >, tTimeStamp >, bool > = true>
adtf::base::runnable< DEFAULT_ACTIVATION_TYPE, ANT_INTERFACE, FLASH_OR_ANT_INTERFACE, CALLABLE >::runnable ( CALLABLE_WITH_TIMSTAMP && fcRunFunc)
inlinenoexcept

Legacy CTOR with default callable of type flash::IRunnable::tRunFunction and used callable type with signature: tResult(tTimeStamp). This CTOR is required for backward compatibility.

Template Parameters
CALLABLE_WITH_TIMSTAMPThe type of callable given in CTOR that might fit the legacy signature.
CALLABLE_TYPEThe type of used storage type within this runnable.
Parameters
fcRunFunccallable function object with expected signature.

◆ runnable() [3/3]

template<ant::IRunnable::tActivationType DEFAULT_ACTIVATION_TYPE = ant::IRunnable::RUN_UNSPECIFIED, typename ANT_INTERFACE = ant::IRunnable, typename FLASH_OR_ANT_INTERFACE = flash::IRunnable, typename CALLABLE = flash::IRunnable::tRunFunction>
adtf::base::runnable< DEFAULT_ACTIVATION_TYPE, ANT_INTERFACE, FLASH_OR_ANT_INTERFACE, CALLABLE >::runnable ( CALLABLE && fcRunFunc,
ant::IRunnable::tActivationType ui32ActivationType )
inlinenoexcept

CTOR with callable and activation type to set the activation type of this runnable.

Parameters
fcRunFunccallable function object with expected signature.
ui32ActivationTypeactivation type to set at runtime

Member Function Documentation

◆ GetActivationType()

template<ant::IRunnable::tActivationType DEFAULT_ACTIVATION_TYPE = ant::IRunnable::RUN_UNSPECIFIED, typename ANT_INTERFACE = ant::IRunnable, typename FLASH_OR_ANT_INTERFACE = flash::IRunnable, typename CALLABLE = flash::IRunnable::tRunFunction>
ant::IRunnable::tActivationType adtf::base::runnable< DEFAULT_ACTIVATION_TYPE, ANT_INTERFACE, FLASH_OR_ANT_INTERFACE, CALLABLE >::GetActivationType ( ) const
inlineoverride

Returns the type of activation

Returns
the current activation type

◆ Run() [1/2]

template<ant::IRunnable::tActivationType DEFAULT_ACTIVATION_TYPE = ant::IRunnable::RUN_UNSPECIFIED, typename ANT_INTERFACE = ant::IRunnable, typename FLASH_OR_ANT_INTERFACE = flash::IRunnable, typename CALLABLE = flash::IRunnable::tRunFunction>
tResult adtf::base::runnable< DEFAULT_ACTIVATION_TYPE, ANT_INTERFACE, FLASH_OR_ANT_INTERFACE, CALLABLE >::Run ( tNanoSeconds tmTimeofActivation,
ant::IRunnable::tActivationType ui32ActivationType,
const void * pvUserData,
size_t nUserDataSize )
inlineoverride

IRunnable::Run implementation which will call m_fcRunFunc if ui32ActivationType is equal to m_ui32ActivationType. If m_ui32ActivationType is set to RUN_UNSPECIFIED the call will be always forwarded.

Parameters
[in]tmTimeofActivationTime of activation. Usually this is the StreamTime.
[in]ui32ActivationTypeThe activation type of the runnable.
[in]pvUserDataPointer to user data.
[in]nUserDataSizeSize of the user data.
Returns
The return value of m_fcRunFunc call.
See also
base::flash::IRunnable::Run

◆ Run() [2/2]

template<ant::IRunnable::tActivationType DEFAULT_ACTIVATION_TYPE = ant::IRunnable::RUN_UNSPECIFIED, typename ANT_INTERFACE = ant::IRunnable, typename FLASH_OR_ANT_INTERFACE = flash::IRunnable, typename CALLABLE = flash::IRunnable::tRunFunction>
tResult adtf::base::runnable< DEFAULT_ACTIVATION_TYPE, ANT_INTERFACE, FLASH_OR_ANT_INTERFACE, CALLABLE >::Run ( tTimeStamp tmTimeofActivation,
ant::IRunnable::tActivationType ui32ActivationType,
const void * pvUserData,
size_t nUserDataSize )
inlineoverride

IRunnable::Run implementation which will call m_fcRunFunc if ui32ActivationType is equal to m_ui32ActivationType. If m_ui32ActivationType is set to RUN_UNSPECIFIED the call will be always forwarded.

Parameters
[in]tmTimeofActivationTime of activation. Usually this is the StreamTime.
[in]ui32ActivationTypeThe activation type of the runnable.
[in]pvUserDataPointer to user data.
[in]nUserDataSizeSize of the user data.
Returns
The return value of m_fcRunFunc call.
See also
base::flash::IRunnable::Run

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