Sen API
Sen Libraries
Loading...
Searching...
No Matches
sen::kernel::TestComponent Class Reference

Convenience class for using lambdas instead of inheritance when defining test components. More...

#include <test_kernel.h>

Inheritance diagram for sen::kernel::TestComponent:

Public Types

using InitFunc = std::function<PassResult(InitApi&&)>
using RunFunc = std::function<FuncResult(RunApi&)>
using UnloadFunc = std::function<FuncResult(UnloadApi&&)>

Public Member Functions

 TestComponent ()=default
 ~TestComponent () override=default
void onInit (InitFunc func)
void onRun (RunFunc func)
void onUnload (UnloadFunc func)
PassResult init (InitApi &&api) override
 Initialize the component and perform kernel-related operations. This may include dependency resolution, and resource registration. This function will be continuously called until it returns that it's done.
FuncResult run (RunApi &api) override
 Runs the component in a dedicated thread. This function is called once and only when the kernel has reached the desired group of this component. Implementations shall end the execution thread when the stopFlag is set to true.
FuncResult unload (UnloadApi &&api) override
 Unload any self-contained resources. This function is just called once.
virtual FuncResult preload (PreloadApi &&)
 Preload the component and initialize all self-contained resources. This function is just called once.
virtual FuncResult load (LoadApi &&)
 Load the component and initialize all self-contained resources. This function is just called once.
virtual void postUnloadCleanup ()
 Do an additional (and final) clean up step after unloading the component. This function is just called once for all components and independently of the chosen group.
virtual bool isRealTimeOnly () const noexcept
 Return true here if your component is not designed to work with virtualized time.

Static Protected Member Functions

static PassResult delay (Duration time) noexcept
 Convenience function to return an operation delay request.
static PassResult done () noexcept
 Convenience function to return a finished operation result.

Detailed Description

Convenience class for using lambdas instead of inheritance when defining test components.

Member Typedef Documentation

◆ InitFunc

◆ RunFunc

◆ UnloadFunc

Constructor & Destructor Documentation

◆ TestComponent()

sen::kernel::TestComponent::TestComponent ( )
default

◆ ~TestComponent()

sen::kernel::TestComponent::~TestComponent ( )
overridedefault

Member Function Documentation

◆ onInit()

void sen::kernel::TestComponent::onInit ( InitFunc func)

◆ onRun()

void sen::kernel::TestComponent::onRun ( RunFunc func)

◆ onUnload()

void sen::kernel::TestComponent::onUnload ( UnloadFunc func)

◆ init()

PassResult sen::kernel::TestComponent::init ( InitApi && )
overridevirtual

Initialize the component and perform kernel-related operations. This may include dependency resolution, and resource registration. This function will be continuously called until it returns that it's done.

Reimplemented from sen::kernel::Component.

◆ run()

FuncResult sen::kernel::TestComponent::run ( RunApi & )
overridevirtual

Runs the component in a dedicated thread. This function is called once and only when the kernel has reached the desired group of this component. Implementations shall end the execution thread when the stopFlag is set to true.

Reimplemented from sen::kernel::Component.

◆ unload()

FuncResult sen::kernel::TestComponent::unload ( UnloadApi && )
overridevirtual

Unload any self-contained resources. This function is just called once.

Reimplemented from sen::kernel::Component.

◆ preload()

virtual FuncResult sen::kernel::Component::preload ( PreloadApi && )
inlinevirtualinherited

Preload the component and initialize all self-contained resources. This function is just called once.

◆ load()

virtual FuncResult sen::kernel::Component::load ( LoadApi && )
inlinevirtualinherited

Load the component and initialize all self-contained resources. This function is just called once.

◆ postUnloadCleanup()

virtual void sen::kernel::Component::postUnloadCleanup ( )
inlinevirtualinherited

Do an additional (and final) clean up step after unloading the component. This function is just called once for all components and independently of the chosen group.

◆ isRealTimeOnly()

virtual bool sen::kernel::Component::isRealTimeOnly ( ) const
inlinenodiscardvirtualnoexceptinherited

Return true here if your component is not designed to work with virtualized time.

◆ delay()

PassResult sen::kernel::Component::delay ( Duration time)
inlinestaticnodiscardprotectednoexceptinherited

Convenience function to return an operation delay request.

◆ done()

PassResult sen::kernel::Component::done ( )
inlinestaticnodiscardprotectednoexceptinherited

Convenience function to return a finished operation result.


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