Geant4  10.02.p03
G4StateManager Class Reference

#include <G4StateManager.hh>

Collaboration diagram for G4StateManager:

Public Member Functions

 ~G4StateManager ()
 
G4ApplicationState GetCurrentState () const
 
G4ApplicationState GetPreviousState () const
 
G4bool SetNewState (G4ApplicationState requestedState)
 
G4bool SetNewState (G4ApplicationState requestedState, const char *msg)
 
G4bool RegisterDependent (G4VStateDependent *aDependent, G4bool bottom=false)
 
G4bool DeregisterDependent (G4VStateDependent *aDependent)
 
G4VStateDependentRemoveDependent (const G4VStateDependent *aDependent)
 
G4String GetStateString (G4ApplicationState aState) const
 
void SetSuppressAbortion (G4int i)
 
G4int GetSuppressAbortion () const
 
const char * GetMessage () const
 
void SetExceptionHandler (G4VExceptionHandler *eh)
 
G4VExceptionHandlerGetExceptionHandler () const
 

Static Public Member Functions

static G4StateManagerGetStateManager ()
 

Protected Member Functions

 G4StateManager ()
 

Private Member Functions

 G4StateManager (const G4StateManager &right)
 
G4StateManageroperator= (const G4StateManager &right)
 
G4int operator== (const G4StateManager &right) const
 
G4int operator!= (const G4StateManager &right) const
 

Private Attributes

G4ApplicationState theCurrentState
 
G4ApplicationState thePreviousState
 
std::vector< G4VStateDependent * > theDependentsList
 
G4VStateDependenttheBottomDependent
 
G4int suppressAbortion
 
const char * msgptr
 
G4VExceptionHandlerexceptionHandler
 

Static Private Attributes

static G4ThreadLocal G4StateManagertheStateManager = 0
 

Detailed Description

Definition at line 60 of file G4StateManager.hh.

Constructor & Destructor Documentation

◆ G4StateManager() [1/2]

G4StateManager::G4StateManager ( )
protected

Definition at line 44 of file G4StateManager.cc.

49  msgptr(0),
51 {
52 #ifdef G4MULTITHREADED
54 #endif
55 }
G4ApplicationState theCurrentState
G4ApplicationState thePreviousState
G4VExceptionHandler * exceptionHandler
G4VStateDependent * theBottomDependent
const char * msgptr
void G4iosInitialization()
Definition: G4ios.cc:85
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~G4StateManager()

G4StateManager::~G4StateManager ( )

Definition at line 57 of file G4StateManager.cc.

58 {
59  G4VStateDependent* state=0;
60 
61  while (theDependentsList.size()>0)
62  {
63  state = theDependentsList.back();
64  theDependentsList.pop_back();
65  for (std::vector<G4VStateDependent*>::iterator
66  i=theDependentsList.begin(); i!=theDependentsList.end();)
67  {
68  if (*i==state)
69  {
70  i = theDependentsList.erase(i);
71  }
72  else
73  {
74  ++i;
75  }
76  }
77  if ( state ) { delete state; }
78  }
79 #ifdef G4MULTITHREADED_DEACTIVATE
81 #endif
82 }
std::vector< G4VStateDependent * > theDependentsList
void G4iosFinalization()
Definition: G4ios.cc:86
Here is the call graph for this function:

◆ G4StateManager() [2/2]

G4StateManager::G4StateManager ( const G4StateManager right)
private

Definition at line 89 of file G4StateManager.cc.

95  msgptr(right.msgptr),
97 {
98 }
G4ApplicationState theCurrentState
G4ApplicationState thePreviousState
G4VExceptionHandler * exceptionHandler
std::vector< G4VStateDependent * > theDependentsList
G4VStateDependent * theBottomDependent
const char * msgptr

Member Function Documentation

◆ DeregisterDependent()

G4bool G4StateManager::DeregisterDependent ( G4VStateDependent aDependent)

Definition at line 160 of file G4StateManager.cc.

161 {
162  G4VStateDependent* tmp = 0;
163  for (std::vector<G4VStateDependent*>::iterator i=theDependentsList.begin();
164  i!=theDependentsList.end();)
165  {
166  if (**i==*aDependent)
167  {
168  tmp = *i;
169  i = theDependentsList.erase(i);
170  }
171  else
172  {
173  ++i;
174  }
175  }
176  return (tmp != 0);
177 }
Float_t tmp
std::vector< G4VStateDependent * > theDependentsList
Here is the caller graph for this function:

◆ GetCurrentState()

G4ApplicationState G4StateManager::GetCurrentState ( ) const

Definition at line 180 of file G4StateManager.cc.

181 {
182  return theCurrentState;
183 }
G4ApplicationState theCurrentState
Here is the caller graph for this function:

◆ GetExceptionHandler()

G4VExceptionHandler* G4StateManager::GetExceptionHandler ( ) const
inline
Here is the caller graph for this function:

◆ GetMessage()

const char* G4StateManager::GetMessage ( ) const
inline

◆ GetPreviousState()

G4ApplicationState G4StateManager::GetPreviousState ( ) const

Definition at line 186 of file G4StateManager.cc.

187 {
188  return thePreviousState;
189 }
G4ApplicationState thePreviousState
Here is the caller graph for this function:

◆ GetStateManager()

G4StateManager * G4StateManager::GetStateManager ( )
static

Definition at line 131 of file G4StateManager.cc.

132 {
133  if (!theStateManager)
134  {
136  }
137  return theStateManager;
138 }
static G4ThreadLocal G4StateManager * theStateManager
Here is the call graph for this function:

◆ GetStateString()

G4String G4StateManager::GetStateString ( G4ApplicationState  aState) const

Definition at line 247 of file G4StateManager.cc.

248 {
249  G4String stateName;
250  switch(aState)
251  {
252  case G4State_PreInit:
253  stateName = "PreInit"; break;
254  case G4State_Init:
255  stateName = "Init"; break;
256  case G4State_Idle:
257  stateName = "Idle"; break;
258  case G4State_GeomClosed:
259  stateName = "GeomClosed"; break;
260  case G4State_EventProc:
261  stateName = "EventProc"; break;
262  case G4State_Quit:
263  stateName = "Quit"; break;
264  case G4State_Abort:
265  stateName = "Abort"; break;
266  default:
267  stateName = "Unknown"; break;
268  }
269  return stateName;
270 }
Here is the caller graph for this function:

◆ GetSuppressAbortion()

G4int G4StateManager::GetSuppressAbortion ( ) const
inline

◆ operator!=()

G4int G4StateManager::operator!= ( const G4StateManager right) const
private

Definition at line 123 of file G4StateManager.cc.

124 {
125  return (this != &right);
126 }

◆ operator=()

G4StateManager & G4StateManager::operator= ( const G4StateManager right)
private

Definition at line 101 of file G4StateManager.cc.

102 {
103  if (&right == this) { return *this; }
104 
110  msgptr = right.msgptr;
112 
113  return *this;
114 }
G4ApplicationState theCurrentState
G4ApplicationState thePreviousState
G4VExceptionHandler * exceptionHandler
std::vector< G4VStateDependent * > theDependentsList
G4VStateDependent * theBottomDependent
const char * msgptr

◆ operator==()

G4int G4StateManager::operator== ( const G4StateManager right) const
private

Definition at line 117 of file G4StateManager.cc.

118 {
119  return (this == &right);
120 }

◆ RegisterDependent()

G4bool G4StateManager::RegisterDependent ( G4VStateDependent aDependent,
G4bool  bottom = false 
)

Definition at line 141 of file G4StateManager.cc.

142 {
143  G4bool ack=true;
144  if(!bottom)
145  {
146  theDependentsList.push_back(aDependent);
147  }
148  else
149  {
151  {
153  }
154  theBottomDependent = aDependent;
155  }
156  return ack;
157 }
std::vector< G4VStateDependent * > theDependentsList
G4VStateDependent * theBottomDependent
bool G4bool
Definition: G4Types.hh:79
Here is the caller graph for this function:

◆ RemoveDependent()

G4VStateDependent * G4StateManager::RemoveDependent ( const G4VStateDependent aDependent)

Definition at line 227 of file G4StateManager.cc.

228 {
229  G4VStateDependent* tmp = 0;
230  for (std::vector<G4VStateDependent*>::iterator i=theDependentsList.begin();
231  i!=theDependentsList.end();)
232  {
233  if (**i==*aDependent)
234  {
235  tmp = *i;
236  i = theDependentsList.erase(i);
237  }
238  else
239  {
240  ++i;
241  }
242  }
243  return tmp;
244 }
Float_t tmp
std::vector< G4VStateDependent * > theDependentsList

◆ SetExceptionHandler()

void G4StateManager::SetExceptionHandler ( G4VExceptionHandler eh)
inline
Here is the caller graph for this function:

◆ SetNewState() [1/2]

G4bool G4StateManager::SetNewState ( G4ApplicationState  requestedState)

Definition at line 192 of file G4StateManager.cc.

193 { return SetNewState(requestedState,0); }
G4bool SetNewState(G4ApplicationState requestedState)
Here is the caller graph for this function:

◆ SetNewState() [2/2]

G4bool G4StateManager::SetNewState ( G4ApplicationState  requestedState,
const char *  msg 
)

Definition at line 196 of file G4StateManager.cc.

197 {
198  if(requestedState==G4State_Abort && suppressAbortion>0)
199  {
200  if(suppressAbortion==2) { return false; }
201  if(theCurrentState==G4State_EventProc) { return false; }
202  }
203  msgptr = msg;
204  size_t i=0;
205  G4bool ack = true;
208  while ((ack) && (i<theDependentsList.size()))
209  {
210  ack = theDependentsList[i]->Notify(requestedState);
211  i++;
212  }
214  {
215  ack = theBottomDependent->Notify(requestedState);
216  }
217 
218  if(!ack)
219  { thePreviousState = savedState; }
220  else
221  { theCurrentState = requestedState; }
222  msgptr = 0;
223  return ack;
224 }
G4ApplicationState theCurrentState
G4ApplicationState thePreviousState
std::vector< G4VStateDependent * > theDependentsList
virtual G4bool Notify(G4ApplicationState requestedState)=0
G4VStateDependent * theBottomDependent
const char * msgptr
bool G4bool
Definition: G4Types.hh:79
G4ApplicationState
Here is the call graph for this function:

◆ SetSuppressAbortion()

void G4StateManager::SetSuppressAbortion ( G4int  i)
inline
Here is the caller graph for this function:

Member Data Documentation

◆ exceptionHandler

G4VExceptionHandler* G4StateManager::exceptionHandler
private

Definition at line 141 of file G4StateManager.hh.

◆ msgptr

const char* G4StateManager::msgptr
private

Definition at line 140 of file G4StateManager.hh.

◆ suppressAbortion

G4int G4StateManager::suppressAbortion
private

Definition at line 139 of file G4StateManager.hh.

◆ theBottomDependent

G4VStateDependent* G4StateManager::theBottomDependent
private

Definition at line 138 of file G4StateManager.hh.

◆ theCurrentState

G4ApplicationState G4StateManager::theCurrentState
private

Definition at line 135 of file G4StateManager.hh.

◆ theDependentsList

std::vector<G4VStateDependent*> G4StateManager::theDependentsList
private

Definition at line 137 of file G4StateManager.hh.

◆ thePreviousState

G4ApplicationState G4StateManager::thePreviousState
private

Definition at line 136 of file G4StateManager.hh.

◆ theStateManager

G4ThreadLocal G4StateManager * G4StateManager::theStateManager = 0
staticprivate

Definition at line 134 of file G4StateManager.hh.


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