ADTF
Loading...
Searching...
No Matches
adtf::ucom::IRuntimeHook Class Referenceabstract

Alias always bringing the latest version of ant::IRuntimeHook into scope. More...

#include <runtime_intf.h>

Classes

struct  tHookInfo
 

Public Member Functions

virtual tResult RuntimeHook (const tHookInfo &sHookInfo, const iobject_ptr< IObject > &pObject)=0
 

Detailed Description

Alias always bringing the latest version of ant::IRuntimeHook into scope.

The IRuntimeHook interface provides a hook callback interface.

This mechanism allows you to react upon changes within the runtime. Use the IRuntime::RegisterHook and IRuntime::UnregisterHook methods to insert your hook into the processing chain. Hooks are called before and after an operation is performed in the runtime.

Member Function Documentation

◆ RuntimeHook()

virtual tResult adtf::ucom::ant::IRuntimeHook::RuntimeHook ( const tHookInfo & sHookInfo,
const iobject_ptr< IObject > & pObject )
pure virtual

This method will be called at specific stages during runtime operation, see IRuntime::tRuntimeHookId.

With the help of the Runtime Hook mechanism it is possible to react upon changes happening within the runtime. For a complete list of hook locations and the information provided by those hooks see IRuntime::tRuntimeHookId.

Please keep in mind that this is a very advanced interaction with the ADTF System that is rarely required. Most Problems can be easily resolved without resorting to this techinque. Always consider the following options first:

  • Use a specific initialisation order of filters to ciricumvent dependency problems.
  • Use the IService::ServiceEvent method whenever possible instead of this method.
  • If you implement hook functionality in a filter make sure that you never transmit samples when your filters Start method has not been called, i.e. transmission of samples is only allowed during the running state.

The following example shows an example IRuntimeHook implementation.

tResult cMyObject::RuntimeHook(tHookInfo* psHookInfo, const iobject_ptr<IObject>& pObject)
{
adtf::base::tADTFRunLevel::RL_Running == psHookInfo->ui32Param1)
{
LOG_INFO("Runlevel RL_Running has been reached");
}
else if (IRuntime::RHI_RunLevelPreDecrement == psHookInfo->idHook &&
adtf::base::tADTFRunLevel::RL_Running == psHookInfo->ui32Param1)
{
LOG_INFO("Runlevel is going to be decreased to RL_Application");
}
else if (IRuntime::RHI_RegisterObject == psHookInfo->idHook)
{
LOG_INFO("Object '%s' has been registered.", reinterpret_cast<const char*>(psHookInfo->pvData));
}
}
#define LOG_INFO(...)
Logs an info message.
Definition log.h:388
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
Definition result.h:29
@ RHI_RunLevelPreDecrement
Definition runtime_intf.h:217
@ RHI_RunLevelPostIncrement
Definition runtime_intf.h:213
@ RHI_RegisterObject
Definition runtime_intf.h:143
ant::iobject_ptr< T > iobject_ptr
Alias always bringing the latest version of ant::iobject_ptr into scope.
Definition object_ptr_intf.h:437
Definition runtime_intf.h:40
uint32_t ui32Param1
Depends on idHook.
Definition runtime_intf.h:42
void * pvData
optional data pointer.
Definition runtime_intf.h:44
uint32_t idHook
Defines event type (IRuntime::tRuntimeHookId)
Definition runtime_intf.h:41
Parameters
sHookInfo[in] The Hook Information what happened.
pObject[in] Optional pointer to the object the Hook Event belongs to
Returns
Standard Result Code.
Return values
ERR_CANCELEDThe hook call will break and no further hook will be called.

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