Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
ara::com::someip::sd::fsm::TimerSetState< T > Class Template Referenceabstract

Server's or client's service timer set state. More...

#include <timer_set_state.h>

Inheritance diagram for ara::com::someip::sd::fsm::TimerSetState< T >:
ara::com::helper::MachineState< T > ara::com::someip::sd::fsm::InitialWaitState< helper::SdClientState > ara::com::someip::sd::fsm::RepetitionState< helper::SdClientState > ara::com::someip::sd::fsm::InitialWaitState< T > ara::com::someip::sd::fsm::RepetitionState< T > ara::com::someip::sd::fsm::ClientInitialWaitState ara::com::someip::sd::fsm::ClientRepetitionState

Public Member Functions

 TimerSetState (const TimerSetState &)=delete
 
TimerSetStateoperator= (const TimerSetState &)=delete
 
virtual void Activate (T previousState) override
 Activate the state. More...
 
void ServiceStopped () noexcept
 Inform the state that the server's service is stopped.
 
void SetNextState (T nextState) noexcept
 Set next state. More...
 
- Public Member Functions inherited from ara::com::helper::MachineState< T >
 MachineState (const MachineState &)=delete
 
MachineStateoperator= (const MachineState &)=delete
 
GetState () const noexcept
 Get the machine state. More...
 
void Register (AbstractStateMachine< T > *finiteStateMachine) noexcept
 Register the state to a finite state machine (FSM) More...
 

Protected Member Functions

bool WaitFor (std::chrono::milliseconds duration)
 Wait for certian period of time. More...
 
bool WaitFor (int duration)
 Wait for certian period of time. More...
 
void Interrupt () noexcept
 Interrupt the timer. More...
 
virtual void SetTimer ()=0
 Set the phase time on state activation. More...
 
 TimerSetState (T nextState, T stoppedState, std::function< void()> onTimerExpired)
 Constructor. More...
 
void Deactivate (T nextState) override
 Deactivating the current state before transiting to the next state. More...
 
- Protected Member Functions inherited from ara::com::helper::MachineState< T >
void Transit (T nextState)
 Transit to the next state. More...
 
 MachineState (T state) noexcept
 Constructor. More...
 

Protected Attributes

const std::function< void()> OnTimerExpired
 Delegate which is invoked by timer's thread when the timer is expired.
 

Detailed Description

template<typename T>
class ara::com::someip::sd::fsm::TimerSetState< T >

Server's or client's service timer set state.

Template Parameters
TServer's or client state enumeration type
Note
The state is not copyable

Constructor & Destructor Documentation

◆ TimerSetState()

template<typename T >
ara::com::someip::sd::fsm::TimerSetState< T >::TimerSetState ( nextState,
stoppedState,
std::function< void()>  onTimerExpired 
)
inlineprotected

Constructor.

Parameters
nextStateNext state after initial wait phase expiration
stoppedStateDefault stopped state after put a stop to the service
onTimerExpiredDelegate to be invoked by timer's thread when the timer is expired

Member Function Documentation

◆ Activate()

template<typename T >
virtual void ara::com::someip::sd::fsm::TimerSetState< T >::Activate ( previousState)
inlineoverridevirtual

Activate the state.

Parameters
previousStatePrevious state before transiting to this state

Implements ara::com::helper::MachineState< T >.

◆ Deactivate()

template<typename T >
void ara::com::someip::sd::fsm::TimerSetState< T >::Deactivate ( nextState)
inlineoverrideprotectedvirtual

Deactivating the current state before transiting to the next state.

Parameters
nextStateNext state coming after deactivation

Implements ara::com::helper::MachineState< T >.

◆ Interrupt()

template<typename T >
void ara::com::someip::sd::fsm::TimerSetState< T >::Interrupt ( )
inlineprotectednoexcept

Interrupt the timer.

Remarks
If the timer is interrupted, it should transit to the next state.

◆ SetNextState()

template<typename T >
void ara::com::someip::sd::fsm::TimerSetState< T >::SetNextState ( nextState)
inlinenoexcept

Set next state.

Parameters
nextStateNew next state

◆ SetTimer()

◆ WaitFor() [1/2]

template<typename T >
bool ara::com::someip::sd::fsm::TimerSetState< T >::WaitFor ( int  duration)
inlineprotected

Wait for certian period of time.

Parameters
durationWaiting duration in milliseconds
Returns
True if waiting is interrupted; otherwise false if timeout occurs

◆ WaitFor() [2/2]

template<typename T >
bool ara::com::someip::sd::fsm::TimerSetState< T >::WaitFor ( std::chrono::milliseconds  duration)
inlineprotected

Wait for certian period of time.

Parameters
durationWaiting duration
Returns
True if waiting is interrupted; otherwise false if timeout occurs