ADTF
level_machine< Subclass, LevelType, START_LEVEL >

Generator template to create a Basic Level Machine implmentation. More...

Inheritance diagram for level_machine< Subclass, LevelType, START_LEVEL >:
[legend]

Classes

struct  dispatcher
 Internal dispatcher to find handler for level chnage. More...
 
struct  dispatcher< Handler, InnerHandlers... >
 Internal dispatcher to get the handler method for level chnage. More...
 
struct  handler
 Definition of handler method. More...
 

Public Member Functions

template<typename ... InnerHandlers>
tResult ChangeLevel (LevelType eLevel)
 Change Level raise or decrease the Level level by level and call the given hendler methods. More...
 

Protected Types

enum  tDirection : uint8_t { Inc = 0 , Dec = 1 }
 Direction of entering a new Level. More...
 
typedef tResult(Subclass::* tChangeMethod) ()
 Defintion of function type called within the handler implementation.
 

Protected Member Functions

virtual ~level_machine ()=default
 DTOR.
 
LevelType GetLevel () const
 Returns the current Level of the levelMachine. More...
 

Private Attributes

LevelType m_eLevel = START_LEVEL
 The current Level.
 

Detailed Description

template<typename Subclass, typename LevelType, LevelType START_LEVEL>
class adtf::ucom::ant::level_machine< Subclass, LevelType, START_LEVEL >

Generator template to create a Basic Level Machine implmentation.

Template Parameters
SubclassParent Class the implementation is used for
LevelTypeLevel decltype for the level machine
START_LEVELintial level after constructing

Definition at line 25 of file level_machine.h.

Member Enumeration Documentation

◆ tDirection

enum tDirection : uint8_t
protected

Direction of entering a new Level.

Enumerator
Inc 

entering a Level by increasing level_machine::m_eLevel

Dec 

entering a Level by decreasing level_machine::m_eLevel

Definition at line 34 of file level_machine.h.

Member Function Documentation

◆ ChangeLevel()

tResult ChangeLevel ( LevelType  eLevel)
inline

Change Level raise or decrease the Level level by level and call the given hendler methods.

Template Parameters
InnerHandlersLevel Change handler methods
Returns
Return the Error Code of teh called Methods
Return values
ERR_NOERRORNot error occured.

Definition at line 121 of file level_machine.h.

References level_machine< Subclass, LevelType, START_LEVEL >::Dec, level_machine< Subclass, LevelType, START_LEVEL >::Inc, level_machine< Subclass, LevelType, START_LEVEL >::m_eLevel, RETURN_IF_FAILED, and RETURN_NOERROR.

◆ GetLevel()

LevelType GetLevel ( ) const
inlineprotected

Returns the current Level of the levelMachine.

Returns
The Level defined in LevelType

Definition at line 74 of file level_machine.h.

References level_machine< Subclass, LevelType, START_LEVEL >::m_eLevel.