openETCS
case study for the European Train Control System developed for the authors dissertation
Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
oETCS::DF::CEVCStateMachine Class Reference

EVC state machine class. More...

#include <EVCStateMachine.h>

Collaboration diagram for oETCS::DF::CEVCStateMachine:
Collaboration graph

Classes

class  CEVCState
 EVC state class executed by the EVC state machine. More...

Public Member Functions

void AddFlow (oETCS::DF::CAbstractFlow *const pFlow) throw ()
 registers a flow object with this state machine
void AddFunctionBlock (oETCS::DF::CFunctionBlock *const pFunctionBlock) throw ()
 registers a function block object with thids state machine
void AddLanguage (oETCS::DF::CLanguage *const pLanguage) throw ()
 registers a language object with this state machine
void AddState (CEVCState *const pState) throw ()
 registers an EVC state object with thids state machine
void AddTransition (oETCS::DF::CEVCTransition *const pTransition) throw ()
 registers an EVC transition object with thids state machine
void AttachObserver (oETCS::DF::CDMIObserver *const pDMIObserver) throw ()
 attaches a new DMI observer
 CEVCStateMachine () throw ()
 general constructor
void DetachObserver (oETCS::DF::CDMIObserver *const pDMIObserver) throw ()
 detaches a new DMI observer
CEVCState *const GetActiveState () const throw ()
 gets the pointer to the active EVC state
oETCS::DF::CDMISubjectGetCurrentDMI () throw ()
 gets a pointer to the current DMI subject
::std::vector< CEVCState * > GetStates () const throw ()
 gets a vector with pointers to all EVC states
::std::vector
< oETCS::DF::CEVCTransition * > 
GetTransitions () const throw ()
 gets a vector with pointers to all EVC transitions
void Notify () throw ()
 notifies the state machine about a changed DMI subject
void Start (CEVCState *const pStartState, const std::string &ApplicationLevel) throw (::oETCS::DF::Error::CException)
 starts the execution of the EVC state machine
void Stop () throw (::oETCS::DF::Error::CException)
 stops the execution of the EVC state machine
virtual ~CEVCStateMachine () throw ()
 destructor

Private Member Functions

void StateThread () throw ()
 thread method/function for executing the current EVC state object

Private Attributes

::std::vector< CEVCState * > m_AvailableStates
 vector with pointers all available EVC state objects
bool m_bStarted
 flag for started EVC state machine
::std::string m_CurrentApplicationLevel
 literal name of the current active application level
::std::vector
< oETCS::DF::CAbstractFlow * > 
m_Flows
 vector with all CFlow objects available in EVC state machine
::std::vector
< oETCS::DF::CFunctionBlock * > 
m_FunctionBlocks
 vector of all CFunctionBlock objects used in the EVC state machine
::std::vector
< oETCS::DF::CLanguage * > 
m_Language
 vector with pointers to all available language objects
::std::vector
< oETCS::DF::CDMIObserver * > 
m_Observers
 vector of pointers to registered observers
CEVCStatem_pCurrentState
 pointer to the active state
::std::thread * m_pThread
 pointer to thread object for EVC state object execution
::std::vector
< oETCS::DF::CEVCTransition * > 
m_Transitions
 vector with pointers to all transitions between EVC states

Friends

class oETCS::DF::CLevelCondition

Detailed Description

EVC state machine class.

Definition at line 71 of file EVCStateMachine.h.

Constructor & Destructor Documentation

oETCS::DF::CEVCStateMachine::CEVCStateMachine ( ) throw ()

general constructor

Definition at line 778 of file EVCStateMachine.cpp.

oETCS::DF::CEVCStateMachine::~CEVCStateMachine ( ) throw ()
virtual

Member Function Documentation

void oETCS::DF::CEVCStateMachine::AddFlow ( oETCS::DF::CAbstractFlow *const  pFlow) throw ()

registers a flow object with this state machine

Parameters
[in]pFlowpointer to the flow object to be registered

Definition at line 918 of file EVCStateMachine.cpp.

References m_Flows.

void oETCS::DF::CEVCStateMachine::AddFunctionBlock ( oETCS::DF::CFunctionBlock *const  pFunctionBlock) throw ()

registers a function block object with thids state machine

Parameters
[in]pFunctionBlockpointer to function block object to be registered

Definition at line 850 of file EVCStateMachine.cpp.

References m_FunctionBlocks.

void oETCS::DF::CEVCStateMachine::AddLanguage ( oETCS::DF::CLanguage *const  pLanguage) throw ()

registers a language object with this state machine

Parameters
[in]pLanguagepointer to the language object to be registered

Definition at line 901 of file EVCStateMachine.cpp.

References m_Language.

void oETCS::DF::CEVCStateMachine::AddState ( CEVCState *const  pState) throw ()

registers an EVC state object with thids state machine

Parameters
[in]pStatepointer to EVC state object to be registered

Definition at line 867 of file EVCStateMachine.cpp.

References m_AvailableStates.

Referenced by oETCS::DF::CEVCStateMachine::CEVCState::CEVCState().

Here is the caller graph for this function:

void oETCS::DF::CEVCStateMachine::AddTransition ( oETCS::DF::CEVCTransition *const  pTransition) throw ()

registers an EVC transition object with thids state machine

Parameters
[in]pTransitionpointer to EVC transition object to be registered

Definition at line 884 of file EVCStateMachine.cpp.

References oETCS::DF::CEVCStateMachine::CEVCState::m_Transitions.

void oETCS::DF::CEVCStateMachine::AttachObserver ( oETCS::DF::CDMIObserver *const  pDMIObserver) throw ()

attaches a new DMI observer

Parameters
[in]pDMIObserverpointer to the observer

Definition at line 935 of file EVCStateMachine.cpp.

References m_Observers.

void oETCS::DF::CEVCStateMachine::DetachObserver ( oETCS::DF::CDMIObserver *const  pDMIObserver) throw ()

detaches a new DMI observer

Parameters
[in]pDMIObserverpointer to the observer

Definition at line 952 of file EVCStateMachine.cpp.

References m_Observers.

oETCS::DF::CEVCStateMachine::CEVCState *const oETCS::DF::CEVCStateMachine::GetActiveState ( ) const throw ()

gets the pointer to the active EVC state

Returns
pointer to active EVC state object

Definition at line 983 of file EVCStateMachine.cpp.

References m_pCurrentState.

Referenced by oETCS::DF::CCondition::Calculate(), and oETCS::UT::CEVCStateMachine::TestEVCState().

Here is the caller graph for this function:

oETCS::DF::CDMISubject * oETCS::DF::CEVCStateMachine::GetCurrentDMI ( ) throw ()

gets a pointer to the current DMI subject

Returns
pointer to the DMI subject

Definition at line 1019 of file EVCStateMachine.cpp.

References oETCS::DF::CEVCStateMachine::CEVCState::GetCurrentDataFlow(), and m_pCurrentState.

Referenced by oETCS::DF::CDMIQWidget::UpdateSlot().

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< oETCS::DF::CEVCStateMachine::CEVCState * > oETCS::DF::CEVCStateMachine::GetStates ( ) const throw ()

gets a vector with pointers to all EVC states

Returns
vector with pointers to all EVC state objects

Definition at line 1007 of file EVCStateMachine.cpp.

References m_AvailableStates.

Referenced by oETCS::UT::CEVCStateMachine::TestEVCState(), and oETCS::UT::CControlFlow::TestState().

Here is the caller graph for this function:

std::vector< oETCS::DF::CEVCTransition * > oETCS::DF::CEVCStateMachine::GetTransitions ( ) const throw ()

gets a vector with pointers to all EVC transitions

Returns
vector with pointers to all EVC transition objects

Definition at line 995 of file EVCStateMachine.cpp.

References oETCS::DF::CEVCStateMachine::CEVCState::m_Transitions.

void oETCS::DF::CEVCStateMachine::Notify ( ) throw ()

notifies the state machine about a changed DMI subject

Updates all registerd observers.

Remarks
Should only be called by CDMIInput and CDMIOutput objects.

Definition at line 1184 of file EVCStateMachine.cpp.

References m_Observers.

Referenced by oETCS::DF::CDMIOutput::Calculate(), and oETCS::DF::CEVCStateMachine::CEVCState::Start().

Here is the caller graph for this function:

void oETCS::DF::CEVCStateMachine::Start ( CEVCState *const  pStartState,
const std::string &  ApplicationLevel 
) throw (::oETCS::DF::Error::CException)

starts the execution of the EVC state machine

Starts the the EVC state machine in a non-blocking manner.

Parameters
[in]pStartStatepointer to EVC state object to start with (must be local vector)
[in]ApplicationLevelliteral name of the start application level (must be available in start state)

Definition at line 1049 of file EVCStateMachine.cpp.

References oETCS::DF::CEVCStateMachine::CEVCState::IsRunning(), m_AvailableStates, m_bStarted, m_CurrentApplicationLevel, m_pCurrentState, m_pThread, and StateThread().

Referenced by oETCS::UT::CEVCStateMachine::TestEVCState(), and oETCS::UT::CControlFlow::TestState().

Here is the call graph for this function:

Here is the caller graph for this function:

void oETCS::DF::CEVCStateMachine::StateThread ( ) throw ()
private

thread method/function for executing the current EVC state object

Definition at line 1204 of file EVCStateMachine.cpp.

References m_bStarted, m_CurrentApplicationLevel, m_pCurrentState, and oETCS::DF::CEVCStateMachine::CEVCState::Start().

Referenced by Start().

Here is the call graph for this function:

Here is the caller graph for this function:

void oETCS::DF::CEVCStateMachine::Stop ( ) throw (::oETCS::DF::Error::CException)

stops the execution of the EVC state machine

Definition at line 1127 of file EVCStateMachine.cpp.

References oETCS::DF::CEVCStateMachine::CEVCState::IsRunning(), m_bStarted, m_pCurrentState, m_pThread, and oETCS::DF::CEVCStateMachine::CEVCState::Stop().

Referenced by oETCS::UT::CEVCStateMachine::TestEVCState(), and oETCS::UT::CControlFlow::TestState().

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class oETCS::DF::CLevelCondition
friend

Definition at line 629 of file EVCStateMachine.h.

Member Data Documentation

::std::vector< CEVCState* > oETCS::DF::CEVCStateMachine::m_AvailableStates
private

vector with pointers all available EVC state objects

Definition at line 569 of file EVCStateMachine.h.

Referenced by AddState(), GetStates(), Start(), and ~CEVCStateMachine().

bool oETCS::DF::CEVCStateMachine::m_bStarted
private

flag for started EVC state machine

Definition at line 562 of file EVCStateMachine.h.

Referenced by Start(), StateThread(), and Stop().

::std::string oETCS::DF::CEVCStateMachine::m_CurrentApplicationLevel
private

literal name of the current active application level

Definition at line 590 of file EVCStateMachine.h.

Referenced by oETCS::DF::CEVCStateMachine::CEVCState::Start(), Start(), StateThread(), and oETCS::UT::CEVCStateMachine::TestEVCState().

::std::vector< oETCS::DF::CAbstractFlow* > oETCS::DF::CEVCStateMachine::m_Flows
private

vector with all CFlow objects available in EVC state machine

Definition at line 625 of file EVCStateMachine.h.

Referenced by AddFlow(), oETCS::DF::CEVCStateMachine::CEVCState::CDataFlow::IsActiveFlow(), and ~CEVCStateMachine().

::std::vector< oETCS::DF::CFunctionBlock* > oETCS::DF::CEVCStateMachine::m_FunctionBlocks
private
::std::vector< oETCS::DF::CLanguage* > oETCS::DF::CEVCStateMachine::m_Language
private

vector with pointers to all available language objects

Definition at line 611 of file EVCStateMachine.h.

Referenced by AddLanguage(), and ~CEVCStateMachine().

::std::vector< oETCS::DF::CDMIObserver* > oETCS::DF::CEVCStateMachine::m_Observers
private

vector of pointers to registered observers

Definition at line 618 of file EVCStateMachine.h.

Referenced by AttachObserver(), DetachObserver(), and Notify().

CEVCState* oETCS::DF::CEVCStateMachine::m_pCurrentState
private
::std::thread* oETCS::DF::CEVCStateMachine::m_pThread
private

pointer to thread object for EVC state object execution

Definition at line 604 of file EVCStateMachine.h.

Referenced by Start(), and Stop().

::std::vector< oETCS::DF::CEVCTransition* > oETCS::DF::CEVCStateMachine::m_Transitions
private

vector with pointers to all transitions between EVC states

Definition at line 576 of file EVCStateMachine.h.


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

Copyright (C) 2010-2012 Johannes Feuser (feuser@uni-bremen.de)
The openETCS library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
The openETCS library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the openETCS library. If not, see "http://www.gnu.org/licenses/.