comments on public methods of XFState

This commit is contained in:
Rémi Heredero 2023-11-26 21:19:51 +01:00
parent 0d07b98cfd
commit 23830ca3d8

View File

@ -21,15 +21,52 @@ class XFBehavior;
class XFState {
friend class XFBehavior;
public:
/**
* Create and initialise a State for the behavior.
* Have to be initialized in the constructor of the behavior.
* @param behavior Pointer to the behavior class. Use the keyword this
*/
XFState(XFBehavior* behavior);
~XFState() = default;
/**
* Use for set next state of the Initial State.
* To be use only for stInitial.
* @param state Pointer to the next state
*/
inline void setNextState(XFState* state) { setNextState(XFEvent::Initial, XFEvent::XFEventType::Initial, state); };
/**
* Set the conditional state of an custom event.
* @param evid Id of the event for set the next State
* @param state Pointer to the next state
*/
inline void setNextState(const int evid, XFState* state) { setNextState(evid, XFEvent::XFEventType::Event, state); };
/**
* Set a new timer with a certain duration on every entry of this state.
* Set next state after
* @param time Time duration of the timeout
* @param nextState Pointer to the next state
*/
inline void setTimeout(int time, XFState* nextState) { setNextState(XFEvent::Timeout, time, XFEvent::XFEventType::Timeout, nextState); };
/**
* Callback typedef
*/
typedef void (XFBehavior::*callback)(const XFEvent* ev);
/**
* Register the method for the entry callback.
* @param cbEntry Callback automatically called when the state is onEntry
*/
inline void registerOnEntry(callback cbEntry) { cbEntry_ = cbEntry; };
/**
* Register the method for the exit callback
* @param cbExit Callback automatically called when the state is onExit
*/
inline void registerOnExit(callback cbExit) { cbExit_ = cbExit; };
protected: