openETCS
case study for the European Train Control System developed for the authors dissertation
|
EVC state class executed by the EVC state machine. More...
#include <EVCStateMachine.h>
Classes | |
class | CDataFlow |
data flow class for executing data flows and embedded control flows More... |
Public Member Functions | |
void | AddDataFlow (const std::string &ApplicationLevel, CDataFlow *const pDataFlow) throw () |
register a new data flow object | |
void | AddTransition (oETCS::DF::CTransition *const pTransition) throw () |
register a new transition object | |
CEVCState (CEVCStateMachine *const pParent) throw () | |
general constructor | |
::std::vector< CDataFlow * > | GetCurrentDataFlow () const throw () |
gets the current data flow | |
::std::vector < oETCS::DF::CTransition * > | GetTransitions () const throw () |
gets all transisiton objects in this state | |
bool | IsActiveFlow (oETCS::DF::CAbstractFlow *const pFlow) const throw () |
returns true, if a CFlowobjects is active in an EVC state | |
bool | IsActiveFunctionBlock (oETCS::DF::CFunctionBlock *const pFunctionBlock) const throw () |
returns true, if a CFunctionBlock objects is active in an EVC state | |
bool | IsRunning () const throw () |
returns the running flag | |
void | Start () throw (::oETCS::DF::Error::CException) |
starts the permanent execution of the related data flow | |
void | Stop () throw () |
stops the execution the data flow by the underlying CFunctionBlock objects | |
virtual | ~CEVCState () throw () |
destructor |
Public Attributes | |
CEVCStateMachine *const | m_pParent |
pointer to the parent EVC state machine |
Private Member Functions | |
void | DataFlowThread (const unsigned int &iIndex) throw () |
thread method/function for executing one data flow |
Private Attributes | |
::std::condition_variable | m_Barrier |
condition variable as barrier for data flow syncronisation | |
bool | m_bStateLevelSwitch |
flag for a state and/or level switch within the EVC state machine | |
::std::vector< CDataFlow * > | m_CurrentDataFlow |
vector of pointers to the currently executed data flows | |
::std::vector < ::oETCS::DF::Error::CException > | m_DataFlowExceptions |
vector of exception thrown by data flow exections within threads | |
::std::map< std::string,::std::vector < CDataFlow * > > | m_DataFlows |
map of vectors of data flows in a certain EVC state indexed by the related application level | |
unsigned int | m_iLockedThreads |
number of currently locked threads. | |
::std::vector< ::std::thread * > | m_Threads |
vector of thread objects for data flow execution | |
::std::vector < oETCS::DF::CTransition * > | m_Transitions |
vector with pointers to all state transition within the current data flow | |
::std::vector< const oETCS::DF::CEVCTransition * > | m_TransitionStack |
vector with pointers to EVC transition objects, which were activated |
Friends | |
class | oETCS::DF::CEVCCondition |
class | oETCS::DF::CLevelCondition |
EVC state class executed by the EVC state machine.
Is a nested class to gain direct access to its parent class.
Definition at line 79 of file EVCStateMachine.h.
oETCS::DF::CEVCStateMachine::CEVCState::CEVCState | ( | CEVCStateMachine *const | pParent | ) | throw () |
general constructor
Parameterises the EVC state with all constant members. The EVC state object takes over the posession of all variables/memory passed by pointer.
[in] | pParent | pointer to the parent EVC state machine object |
Definition at line 223 of file EVCStateMachine.cpp.
References oETCS::DF::CEVCStateMachine::AddState(), and m_pParent.
|
virtual |
destructor
Definition at line 245 of file EVCStateMachine.cpp.
References IsRunning(), m_DataFlows, m_Transitions, and Stop().
void oETCS::DF::CEVCStateMachine::CEVCState::AddDataFlow | ( | const std::string & | ApplicationLevel, |
CDataFlow *const | pDataFlow | ||
) | throw () |
register a new data flow object
[in] | ApplicationLevel | literal name of the related application level |
[in] | pDataFlow | pointer to the data flow object to be registered |
Definition at line 570 of file EVCStateMachine.cpp.
References m_DataFlows.
void oETCS::DF::CEVCStateMachine::CEVCState::AddTransition | ( | oETCS::DF::CTransition *const | pTransition | ) | throw () |
register a new transition object
[in] | pTransition | pointer to the transition object to be registered |
Definition at line 587 of file EVCStateMachine.cpp.
References m_Transitions.
|
private |
thread method/function for executing one data flow
[in] | iIndex | index corresponding to the vector referenced by m_pCurrentDataFlow |
Definition at line 604 of file EVCStateMachine.cpp.
References __DATA_FLOW_SAMPLE_TIME__, m_Barrier, oETCS::DF::CEnteredTrigger::m_bEnteredState, m_bStateLevelSwitch, m_CurrentDataFlow, m_DataFlowExceptions, m_iLockedThreads, oETCS::DF::CEVCStateMachine::m_pCurrentState, m_pParent, m_Threads, and m_TransitionStack.
Referenced by Start().
std::vector< oETCS::DF::CEVCStateMachine::CEVCState::CDataFlow * > oETCS::DF::CEVCStateMachine::CEVCState::GetCurrentDataFlow | ( | ) | const throw () |
gets the current data flow
Definition at line 558 of file EVCStateMachine.cpp.
References m_CurrentDataFlow.
Referenced by oETCS::DF::CCondition::Calculate(), and oETCS::DF::CEVCStateMachine::GetCurrentDMI().
std::vector< oETCS::DF::CTransition * > oETCS::DF::CEVCStateMachine::CEVCState::GetTransitions | ( | ) | const throw () |
gets all transisiton objects in this state
Definition at line 546 of file EVCStateMachine.cpp.
References m_Transitions.
Referenced by oETCS::DF::CCondition::Calculate().
bool oETCS::DF::CEVCStateMachine::CEVCState::IsActiveFlow | ( | oETCS::DF::CAbstractFlow *const | pFlow | ) | const throw () |
returns true, if a CFlowobjects is active in an EVC state
[in] | pFlow | pointer to the concrete CFlow object to be testetd |
Definition at line 520 of file EVCStateMachine.cpp.
References m_CurrentDataFlow.
bool oETCS::DF::CEVCStateMachine::CEVCState::IsActiveFunctionBlock | ( | oETCS::DF::CFunctionBlock *const | pFunctionBlock | ) | const throw () |
returns true, if a CFunctionBlock objects is active in an EVC state
[in] | pFunctionBlock | pointer to a function block object to be testetd |
Definition at line 494 of file EVCStateMachine.cpp.
References m_CurrentDataFlow.
Referenced by oETCS::DF::CEVCStateMachine::CEVCState::CDataFlow::IsActiveFunctionBlock().
bool oETCS::DF::CEVCStateMachine::CEVCState::IsRunning | ( | ) | const throw () |
returns the running flag
Definition at line 482 of file EVCStateMachine.cpp.
References m_CurrentDataFlow.
Referenced by Start(), oETCS::DF::CEVCStateMachine::Start(), Stop(), oETCS::DF::CEVCStateMachine::Stop(), ~CEVCState(), and oETCS::DF::CEVCStateMachine::~CEVCStateMachine().
void oETCS::DF::CEVCStateMachine::CEVCState::Start | ( | ) | throw (::oETCS::DF::Error::CException) |
starts the permanent execution of the related data flow
If the number of independent CDataFLow objects for the current application level is greater than 1, this method will start for each additional group a additinal thread, while this method always is blocking. If a CEVCState is executed under the same parent CEVCStateMachine object, this will be stopped before by its CEVCState::Stop() method.
Definition at line 290 of file EVCStateMachine.cpp.
References DataFlowThread(), IsRunning(), oETCS::DF::CEnteredTrigger::m_bEnteredState, m_bStateLevelSwitch, oETCS::DF::CEVCStateMachine::m_CurrentApplicationLevel, m_CurrentDataFlow, m_DataFlowExceptions, m_DataFlows, m_iLockedThreads, m_pParent, m_Threads, and oETCS::DF::CEVCStateMachine::Notify().
Referenced by oETCS::DF::CEVCStateMachine::StateThread().
void oETCS::DF::CEVCStateMachine::CEVCState::Stop | ( | ) | throw () |
stops the execution the data flow by the underlying CFunctionBlock objects
In the case of more than 1 group of independent CDatatFlow objects this method terminates all related threads by wating for the current execution sample to finish.
Definition at line 438 of file EVCStateMachine.cpp.
References IsRunning(), m_bStateLevelSwitch, and m_Threads.
Referenced by oETCS::DF::CEVCStateMachine::Stop(), ~CEVCState(), and oETCS::DF::CEVCStateMachine::~CEVCStateMachine().
|
friend |
Definition at line 394 of file EVCStateMachine.h.
|
friend |
Definition at line 395 of file EVCStateMachine.h.
|
private |
condition variable as barrier for data flow syncronisation
Definition at line 369 of file EVCStateMachine.h.
Referenced by DataFlowThread().
|
private |
flag for a state and/or level switch within the EVC state machine
Definition at line 318 of file EVCStateMachine.h.
Referenced by DataFlowThread(), oETCS::DF::CEVCStateMachine::CEVCState::CDataFlow::Execute(), Start(), and Stop().
|
private |
vector of pointers to the currently executed data flows
Definition at line 362 of file EVCStateMachine.h.
Referenced by DataFlowThread(), GetCurrentDataFlow(), IsActiveFlow(), IsActiveFunctionBlock(), IsRunning(), and Start().
|
private |
vector of exception thrown by data flow exections within threads
Definition at line 383 of file EVCStateMachine.h.
Referenced by DataFlowThread(), and Start().
|
private |
map of vectors of data flows in a certain EVC state indexed by the related application level
Each vector holds a set of CDataFlow objects for a certain application level, which are independent from each other and therefore can be executed in parallel.
Definition at line 348 of file EVCStateMachine.h.
Referenced by AddDataFlow(), Start(), and ~CEVCState().
|
private |
number of currently locked threads.
Used in combination of m_Barrier to syncronise all data flow threads.
Definition at line 327 of file EVCStateMachine.h.
Referenced by DataFlowThread(), and Start().
CEVCStateMachine* const oETCS::DF::CEVCStateMachine::CEVCState::m_pParent |
pointer to the parent EVC state machine
Definition at line 336 of file EVCStateMachine.h.
Referenced by CEVCState(), DataFlowThread(), oETCS::DF::CEVCStateMachine::CEVCState::CDataFlow::Execute(), and Start().
|
private |
vector of thread objects for data flow execution
Definition at line 376 of file EVCStateMachine.h.
Referenced by DataFlowThread(), Start(), and Stop().
|
private |
vector with pointers to all state transition within the current data flow
Definition at line 355 of file EVCStateMachine.h.
Referenced by AddTransition(), oETCS::DF::CEVCStateMachine::AddTransition(), GetTransitions(), oETCS::DF::CEVCStateMachine::GetTransitions(), ~CEVCState(), and oETCS::DF::CEVCStateMachine::~CEVCStateMachine().
|
private |
vector with pointers to EVC transition objects, which were activated
Definition at line 390 of file EVCStateMachine.h.
Referenced by DataFlowThread().
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/.