Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4StateManager Class Reference

#include <G4StateManager.hh>

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 ()
 

Detailed Description

Definition at line 60 of file G4StateManager.hh.

Constructor & Destructor Documentation

G4StateManager::G4StateManager ( )
protected

Definition at line 44 of file G4StateManager.cc.

45  : theCurrentState(G4State_PreInit),
46  thePreviousState(G4State_PreInit),
47  theBottomDependent(0),
48  suppressAbortion(0),
49  msgptr(0),
50  exceptionHandler(0)
51 {
52 #ifdef G4MULTITHREADED
54 #endif
55 }
void G4iosInitialization()
Definition: G4ios.cc:85

Here is the call graph for this function:

Here is the caller graph for this function:

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 }
void G4iosFinalization()
Definition: G4ios.cc:86

Here is the call graph for this function:

Member Function Documentation

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 }

Here is the caller graph for this function:

G4ApplicationState G4StateManager::GetCurrentState ( ) const

Definition at line 180 of file G4StateManager.cc.

181 {
182  return theCurrentState;
183 }

Here is the caller graph for this function:

G4VExceptionHandler* G4StateManager::GetExceptionHandler ( ) const
inline

Here is the caller graph for this function:

const char* G4StateManager::GetMessage ( ) const
inline
G4ApplicationState G4StateManager::GetPreviousState ( ) const

Definition at line 186 of file G4StateManager.cc.

187 {
188  return thePreviousState;
189 }

Here is the caller graph for this function:

G4StateManager * G4StateManager::GetStateManager ( )
static

Definition at line 131 of file G4StateManager.cc.

132 {
133  if (!theStateManager)
134  {
135  theStateManager = new G4StateManager;
136  }
137  return theStateManager;
138 }

Here is the call graph for this function:

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:

G4int G4StateManager::GetSuppressAbortion ( ) const
inline
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  {
150  if(theBottomDependent)
151  {
152  theDependentsList.push_back(theBottomDependent);
153  }
154  theBottomDependent = aDependent;
155  }
156  return ack;
157 }
bool G4bool
Definition: G4Types.hh:79

Here is the caller graph for this function:

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 }
void G4StateManager::SetExceptionHandler ( G4VExceptionHandler eh)
inline

Here is the caller graph for this function:

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:

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;
206  G4ApplicationState savedState = thePreviousState;
207  thePreviousState = theCurrentState;
208  while ((ack) && (i<theDependentsList.size()))
209  {
210  ack = theDependentsList[i]->Notify(requestedState);
211  i++;
212  }
213  if(theBottomDependent)
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 }
virtual G4bool Notify(G4ApplicationState requestedState)=0
bool G4bool
Definition: G4Types.hh:79
G4ApplicationState

Here is the call graph for this function:

void G4StateManager::SetSuppressAbortion ( G4int  i)
inline

Here is the caller graph for this function:


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