StateMachine< Identifier, Packet >::FunIface Class Reference

Main interface for the needs of a state function. More...

#include <stateMachine.hpp>

Public Member Functions

 ~FunIface ()
 
void freePkt ()
 Free the packet after the batch is processed, do not send it. More...
 
Packet * getPkt ()
 Get an additional packet buffer. More...
 
void transition (StateID newState)
 Transition to another state. More...
 
void transitionNow (StateID newState)
 Immediately transition to another state. More...
 
void setTimeout (std::chrono::milliseconds timeout, timeoutFun fun)
 Set a timeout, after which a transition will happen. More...
 

Friends

class StateMachine< Identifier, Packet >
 

Detailed Description

template<class Identifier, class Packet>
class StateMachine< Identifier, Packet >::FunIface

Main interface for the needs of a state function.

Definition at line 123 of file stateMachine.hpp.

Constructor & Destructor Documentation

◆ ~FunIface()

template<class Identifier, class Packet>
StateMachine< Identifier, Packet >::FunIface::~FunIface ( )
inline

Definition at line 142 of file stateMachine.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ freePkt()

template<class Identifier, class Packet>
void StateMachine< Identifier, Packet >::FunIface::freePkt ( )
inline

Free the packet after the batch is processed, do not send it.

Definition at line 181 of file stateMachine.hpp.

◆ getPkt()

template<class Identifier, class Packet>
Packet* StateMachine< Identifier, Packet >::FunIface::getPkt ( )
inline

Get an additional packet buffer.

Returns
The new packet buffer

Definition at line 187 of file stateMachine.hpp.

◆ setTimeout()

template<class Identifier, class Packet>
void StateMachine< Identifier, Packet >::FunIface::setTimeout ( std::chrono::milliseconds  timeout,
timeoutFun  fun 
)
inline

Set a timeout, after which a transition will happen.

Parameters
timeoutTime in milliseconds, until timeout will occur
funFunction to execute, if timeout occurs

Definition at line 219 of file stateMachine.hpp.

◆ transition()

template<class Identifier, class Packet>
void StateMachine< Identifier, Packet >::FunIface::transition ( StateID  newState)
inline

Transition to another state.

The new state will be used, as soon as the next packet for this connection is inbound.

Parameters
newStateThe state to transition to

Definition at line 198 of file stateMachine.hpp.

◆ transitionNow()

template<class Identifier, class Packet>
void StateMachine< Identifier, Packet >::FunIface::transitionNow ( StateID  newState)
inline

Immediately transition to another state.

The new state will be called with the appropriate function, as soon as the current function returns. There is a check, if the endstate is reached. The new function call will receive the same packet as the function calling transitionNow().

Parameters
newStateThe state to transition to

Definition at line 210 of file stateMachine.hpp.

Friends And Related Function Documentation

◆ StateMachine< Identifier, Packet >

template<class Identifier, class Packet>
friend class StateMachine< Identifier, Packet >
friend

Definition at line 125 of file stateMachine.hpp.


The documentation for this class was generated from the following file: