Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

CRunState Class Reference

#include <CRunState.h>

List of all members.

Public Types

typedef enum CRunState::_RunState_ RunState
enum  _RunState_ { Inactive, Active, Paused }

Public Methods

 CRunState ()
 Default constructor.

 CRunState (const CRunState &rhs)
 Copy constructor.

 ~CRunState ()
 Destructor.

CRunState & operator= (const CRunState &rhs)
 Assignment.

int operator== (const CRunState &rhs) const
 Comparison for equality.

int operator!= (const CRunState &rhs) const
enum RunState getState () const
map< enum RunState, string > getStatesByValue () const
map< string, enum RunStategetStatesByName () const
map< enum RunState, set< RunState > > getTransitions () const
void Begin ()
void End ()
void Pause ()
void Resume ()
bool Allowed (RunState newstate)
string getStateName ()
string getStateName (enum RunState state)
void SetStateVariable (enum RunState state)

Private Attributes

enum RunState m_eState
 Value of the state.

map< enum RunState, string > m_StatesByValue
 State names looked up by state value.

map< string, enum RunStatem_StatesByName
 State Values looked up by run state.

map< enum RunState, set< RunState > > m_Transitions
 For each state, allowed transitions.


Detailed Description

Encapsulates a run state variable and all of the transitions which are allowed. See tee page labelled: Run State Diagram for allowed states and transitions as well as documented actions on state transitions.

Definition at line 307 of file CRunState.h.


Member Typedef Documentation

typedef enum CRunState::_RunState_ CRunState::RunState
 

Referenced by getState().


Member Enumeration Documentation

enum CRunState::_RunState_
 

Enumeration values:
Inactive 
Active 
Paused 

Definition at line 310 of file CRunState.h.


Constructor & Destructor Documentation

CRunState::CRunState  
 

Default constructor.

Default constructor. This is called when declarations of the form e.g.:

  • CRunState object; are performed.

Definition at line 294 of file CRunState.cpp.

References Active, Inactive, m_StatesByName, m_StatesByValue, m_Transitions, and Paused.

CRunState::CRunState const CRunState &    rhs
 

Copy constructor.

Copy construction. This is invoked when e.g. an object is passed by value to a function. The copy constructor makes a clone of the rhs object.

Definition at line 331 of file CRunState.cpp.

CRunState::~CRunState   [inline]
 

Destructor.

Definition at line 329 of file CRunState.h.


Member Function Documentation

bool CRunState::Allowed RunState    NewState
 

Determine if a transitionis allowed from the current state:

Definition at line 476 of file CRunState.cpp.

References m_eState, and m_Transitions.

Referenced by Begin(), End(), and Pause().

void CRunState::Begin  
 

If it is legal to transition from the current state to the active state this is done, otherwise a CBadTransition exception is thrown.

Definition at line 382 of file CRunState.cpp.

References Active, Allowed(), getStateName(), m_eState, m_StatesByValue, and SetStateVariable().

Referenced by CBeginCommand::operator()().

void CRunState::End  
 

If it is legal to transition from the current state to Inactive, this is done, otherwise a CBadTransitionException is thrown.

Definition at line 403 of file CRunState.cpp.

References Allowed(), getStateName(), Inactive, m_eState, m_StatesByValue, and SetStateVariable().

Referenced by CEndCommand::operator()().

enum RunState CRunState::getState   const [inline]
 

Definition at line 340 of file CRunState.h.

References m_eState, and RunState.

Referenced by CStateVariable::operator()(), and CExitCommand::operator()().

string CRunState::getStateName enum RunState    state
 

string CRunState::getStateName  
 

The current state value is translated into a string.

Parameters:

Definition at line 468 of file CRunState.cpp.

References m_eState, and m_StatesByValue.

Referenced by Begin(), End(), Pause(), and Resume().

map<string,enum RunState> CRunState::getStatesByName   const [inline]
 

Definition at line 348 of file CRunState.h.

References m_StatesByName.

map<enum RunState,string> CRunState::getStatesByValue   const [inline]
 

Definition at line 344 of file CRunState.h.

References m_StatesByValue.

map<enum RunState, set<RunState> > CRunState::getTransitions   const [inline]
 

Definition at line 352 of file CRunState.h.

References m_Transitions.

int CRunState::operator!= const CRunState &    rhs const [inline]
 

Definition at line 333 of file CRunState.h.

References operator==().

CRunState & CRunState::operator= const CRunState &    aCRunState
 

Assignment.

Assignment operation. This member function supports assignment of an object of this class to an object of the same class.

Definition at line 345 of file CRunState.cpp.

References m_eState, m_StatesByName, m_StatesByValue, and m_Transitions.

int CRunState::operator== const CRunState &    rhs const
 

Comparison for equality.

Comparison for equality: The only important member for equality comparison is the current state (m_eState).

Parameters:
rhs  - The object (state) we are comparing ourselves to.
Returns:
true on equality else false.

Definition at line 368 of file CRunState.cpp.

References m_eState.

Referenced by operator!=().

void CRunState::Pause  
 

If it is legal to transition from the current state to the Paused state this is done. Otherwise, a CBadTransition exception is thrown.

Definition at line 425 of file CRunState.cpp.

References Allowed(), getStateName(), m_eState, m_StatesByValue, Paused, and SetStateVariable().

Referenced by CPauseCommand::operator()().

void CRunState::Resume  
 

If the current state is Paused, this member transitions to Active. If not, a CBadTransition exception is thrown.

Definition at line 447 of file CRunState.cpp.

References Active, getStateName(), m_eState, m_StatesByValue, Paused, and SetStateVariable().

Referenced by CResumeCommand::operator()().

void CRunState::SetStateVariable enum RunState    state
 

Referenced by Begin(), End(), Pause(), and Resume().


Member Data Documentation

enum RunState CRunState::m_eState [private]
 

Value of the state.

Definition at line 316 of file CRunState.h.

Referenced by Allowed(), Begin(), End(), getState(), getStateName(), operator=(), operator==(), Pause(), and Resume().

map<string,enum RunState> CRunState::m_StatesByName [private]
 

State Values looked up by run state.

Definition at line 320 of file CRunState.h.

Referenced by CRunState(), getStatesByName(), and operator=().

map<enum RunState,string> CRunState::m_StatesByValue [private]
 

State names looked up by state value.

Definition at line 318 of file CRunState.h.

Referenced by Begin(), CRunState(), End(), getStateName(), getStatesByValue(), operator=(), Pause(), and Resume().

map<enum RunState, set<RunState> > CRunState::m_Transitions [private]
 

For each state, allowed transitions.

Definition at line 322 of file CRunState.h.

Referenced by Allowed(), CRunState(), getTransitions(), and operator=().


The documentation for this class was generated from the following files:
Generated on Fri Nov 8 13:37:21 2002 for Event Readout system. by doxygen1.2.16