ADTF
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
level_machine< Subclass, LevelType, START_LEVEL >

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

#include <level_machine.h>

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.
 

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.
 

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 Typedef Documentation

◆ tChangeMethod

template<typename Subclass, typename LevelType, LevelType START_LEVEL>
typedef tResult(Subclass::* tChangeMethod) ()
protected

Defintion of function type called within the handler implementation.

Definition at line 46 of file level_machine.h.

Member Enumeration Documentation

◆ tDirection

template<typename Subclass, typename LevelType, LevelType START_LEVEL>
enum tDirection : uint8_t
protected

Direction of entering a new Level.

Enumerator
Inc 

entering a Level by increasing m_eLevel

Dec 

entering a Level by decreasing m_eLevel

Definition at line 34 of file level_machine.h.

Member Function Documentation

◆ ChangeLevel()

template<typename Subclass, typename LevelType, LevelType START_LEVEL>
template<typename ... InnerHandlers>
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 Dec, Inc, m_eLevel, RETURN_IF_FAILED, and RETURN_NOERROR.

◆ GetLevel()

template<typename Subclass, typename LevelType, LevelType START_LEVEL>
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 m_eLevel.

Member Data Documentation

◆ m_eLevel

template<typename Subclass, typename LevelType, LevelType START_LEVEL>
LevelType m_eLevel = START_LEVEL
private

The current Level.

Definition at line 29 of file level_machine.h.

Referenced by ChangeLevel(), and GetLevel().