8 #ifndef _ADTF_UCOM_ANT_CLASSES_LEVEL_MASCHINE_HEADER_
9 #define _ADTF_UCOM_ANT_CLASSES_LEVEL_MASCHINE_HEADER_
24 template <
typename Sub
class,
typename LevelType, LevelType 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)
120 template<
typename ...InnerHandlers>
125 for (int64_t nNext =
static_cast<int64_t
>(
m_eLevel) + 1; nNext <= static_cast<int64_t>(eLevel); ++nNext)
128 m_eLevel =
static_cast<LevelType
>(nNext);
133 for (int64_t nNext =
static_cast<int64_t
>(
m_eLevel) - 1; nNext >=
static_cast<int64_t
>(eLevel); --nNext)
136 m_eLevel =
static_cast<LevelType
>(nNext);
146 using ant::level_machine;
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
#define RETURN_IF_FAILED(s)
Return if expression is failed, which requires the calling function's return type to be tResult.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
A common result class usable as return value throughout.
Generator template to create a Basic Level Machine implmentation.
LevelType GetLevel() const
Returns the current Level of the levelMachine.
tResult(Subclass::* tChangeMethod)()
Defintion of function type called within the handler implementation.
LevelType m_eLevel
The current Level.
tResult ChangeLevel(LevelType eLevel)
Change Level raise or decrease the Level level by level and call the given hendler methods.
virtual ~level_machine()=default
DTOR.
tDirection
Direction of entering a new Level.
@ Inc
entering a Level by increasing level_machine::m_eLevel
@ Dec
entering a Level by decreasing level_machine::m_eLevel
Namespace for entire ADTF SDK.
Internal dispatcher to find handler for level chnage.
Definition of handler method.
static const tDirection eDirection
entering direction for the eLevel of the handler
static tChangeMethod GetMethod()
returns the method to call on level change
static const LevelType eLevel
level of the handler which is entered