openETCS
case study for the European Train Control System developed for the authors dissertation
|
EVC state machine class. More...
#include <EVCStateMachine.h>
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::CDMISubject * | GetCurrentDMI () 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 | |
CEVCState * | m_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 |
EVC state machine class.
Definition at line 71 of file EVCStateMachine.h.
oETCS::DF::CEVCStateMachine::CEVCStateMachine | ( | ) | throw () |
general constructor
Definition at line 778 of file EVCStateMachine.cpp.
|
virtual |
destructor
Definition at line 796 of file EVCStateMachine.cpp.
References oETCS::DF::CEVCStateMachine::CEVCState::IsRunning(), m_AvailableStates, m_Flows, m_Language, m_pCurrentState, oETCS::DF::CEVCStateMachine::CEVCState::m_Transitions, and oETCS::DF::CEVCStateMachine::CEVCState::Stop().
void oETCS::DF::CEVCStateMachine::AddFlow | ( | oETCS::DF::CAbstractFlow *const | pFlow | ) | throw () |
registers a flow object with this state machine
[in] | pFlow | pointer 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
[in] | pFunctionBlock | pointer 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
[in] | pLanguage | pointer 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
[in] | pState | pointer 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().
void oETCS::DF::CEVCStateMachine::AddTransition | ( | oETCS::DF::CEVCTransition *const | pTransition | ) | throw () |
registers an EVC transition object with thids state machine
[in] | pTransition | pointer 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
[in] | pDMIObserver | pointer 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
[in] | pDMIObserver | pointer 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
Definition at line 983 of file EVCStateMachine.cpp.
References m_pCurrentState.
Referenced by oETCS::DF::CCondition::Calculate(), and oETCS::UT::CEVCStateMachine::TestEVCState().
oETCS::DF::CDMISubject * oETCS::DF::CEVCStateMachine::GetCurrentDMI | ( | ) | throw () |
gets a pointer to the current 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().
std::vector< oETCS::DF::CEVCStateMachine::CEVCState * > oETCS::DF::CEVCStateMachine::GetStates | ( | ) | const throw () |
gets a vector with pointers to all EVC states
Definition at line 1007 of file EVCStateMachine.cpp.
References m_AvailableStates.
Referenced by oETCS::UT::CEVCStateMachine::TestEVCState(), and oETCS::UT::CControlFlow::TestState().
std::vector< oETCS::DF::CEVCTransition * > oETCS::DF::CEVCStateMachine::GetTransitions | ( | ) | const throw () |
gets a vector with pointers to all EVC transitions
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.
Definition at line 1184 of file EVCStateMachine.cpp.
References m_Observers.
Referenced by oETCS::DF::CDMIOutput::Calculate(), and oETCS::DF::CEVCStateMachine::CEVCState::Start().
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.
[in] | pStartState | pointer to EVC state object to start with (must be local vector) |
[in] | ApplicationLevel | literal 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().
|
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().
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().
|
friend |
Definition at line 629 of file EVCStateMachine.h.
|
private |
vector with pointers all available EVC state objects
Definition at line 569 of file EVCStateMachine.h.
Referenced by AddState(), GetStates(), Start(), and ~CEVCStateMachine().
|
private |
flag for started EVC state machine
Definition at line 562 of file EVCStateMachine.h.
Referenced by Start(), StateThread(), and Stop().
|
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().
|
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().
|
private |
vector of all CFunctionBlock objects used in the EVC state machine
Definition at line 583 of file EVCStateMachine.h.
Referenced by AddFunctionBlock(), oETCS::DF::CEVCStateMachine::CEVCState::CDataFlow::IsActiveFlow(), and oETCS::DF::CEVCStateMachine::CEVCState::CDataFlow::IsActiveFunctionBlock().
|
private |
vector with pointers to all available language objects
Definition at line 611 of file EVCStateMachine.h.
Referenced by AddLanguage(), and ~CEVCStateMachine().
|
private |
vector of pointers to registered observers
Definition at line 618 of file EVCStateMachine.h.
Referenced by AttachObserver(), DetachObserver(), and Notify().
|
private |
pointer to the active state
Definition at line 597 of file EVCStateMachine.h.
Referenced by oETCS::DF::CEVCStateMachine::CEVCState::DataFlowThread(), oETCS::DF::CEVCStateMachine::CEVCState::CDataFlow::Execute(), GetActiveState(), GetCurrentDMI(), Start(), StateThread(), Stop(), and ~CEVCStateMachine().
|
private |
pointer to thread object for EVC state object execution
Definition at line 604 of file EVCStateMachine.h.
|
private |
vector with pointers to all transitions between EVC states
Definition at line 576 of file EVCStateMachine.h.
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/.