8#ifndef _ADTF_UCOM_ANT_CLASSES_LEVEL_MASCHINE_HEADER_
9#define _ADTF_UCOM_ANT_CLASSES_LEVEL_MASCHINE_HEADER_
24template <
typename Sub
class,
typename LevelType, LevelType START_LEVEL>
29 LevelType m_eLevel = START_LEVEL;
54 template<LevelType level, tDirection direction, tChangeMethod method>
58 static const LevelType
eLevel = level;
85 template<
typename ...InnerHandlers>
98 template<
typename Handler,
typename ...InnerHandlers>
103 if (Handler::eLevel == eLevel && Handler::eDirection == eDir)
105 RETURN_IF_FAILED((pObj->*Handler::GetMethod())());
108 return dispatcher<InnerHandlers...>::DispatchMethod(pObj, eLevel, eDir);
120 template<
typename ...InnerHandlers>
123 if (m_eLevel < eLevel)
125 for (int64_t nNext =
static_cast<int64_t
>(m_eLevel) + 1; nNext <= static_cast<int64_t>(eLevel); ++nNext)
127 RETURN_IF_FAILED(dispatcher<InnerHandlers...>::DispatchMethod(
static_cast<Subclass*
>(
this),
static_cast<LevelType
>(nNext),
Inc));
128 m_eLevel =
static_cast<LevelType
>(nNext);
131 else if (m_eLevel > eLevel)
133 for (int64_t nNext =
static_cast<int64_t
>(m_eLevel) - 1; nNext >=
static_cast<int64_t
>(eLevel); --nNext)
135 RETURN_IF_FAILED(dispatcher<InnerHandlers...>::DispatchMethod(
static_cast<Subclass*
>(
this),
static_cast<LevelType
>(nNext),
Dec));
136 m_eLevel =
static_cast<LevelType
>(nNext);
146using ant::level_machine;
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
Definition level_machine.h:26
tResult ChangeLevel(LevelType eLevel)
Definition level_machine.h:121
LevelType GetLevel() const
Definition level_machine.h:74
tResult(Subclass::* tChangeMethod)()
Defintion of function type called within the handler implementation.
Definition level_machine.h:46
tDirection
Direction of entering a new Level.
Definition level_machine.h:35
@ Dec
entering a Level by decreasing level_machine::m_eLevel
Definition level_machine.h:39
@ Inc
entering a Level by increasing level_machine::m_eLevel
Definition level_machine.h:37
virtual ~level_machine()=default
DTOR.
Namespace for all functionality of the ADTF UCOM SDK provided since v3.0.
Definition test_runtime.h:14
Namespace for the ADTF uCOM SDK.
Definition adtf_system.h:324
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14
Definition level_machine.h:87
Definition level_machine.h:56
static const LevelType eLevel
level of the handler which is entered
Definition level_machine.h:58
static tChangeMethod GetMethod()
Definition level_machine.h:64
static const tDirection eDirection
entering direction for the eLevel of the handler
Definition level_machine.h:60