Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions
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.

References G4iosInitialization().

Referenced by GetStateManager().

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
G4StateManager::~G4StateManager ( )

Definition at line 57 of file G4StateManager.cc.

References G4iosFinalization().

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

Member Function Documentation

G4bool G4StateManager::DeregisterDependent ( G4VStateDependent aDependent)

Definition at line 160 of file G4StateManager.cc.

Referenced by G4VStateDependent::~G4VStateDependent().

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 }
G4ApplicationState G4StateManager::GetCurrentState ( ) const
G4VExceptionHandler* G4StateManager::GetExceptionHandler ( ) const
inline

Referenced by G4Exception().

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

Definition at line 186 of file G4StateManager.cc.

Referenced by export_G4StateManager().

187 {
188  return thePreviousState;
189 }
G4StateManager * G4StateManager::GetStateManager ( )
static

Definition at line 131 of file G4StateManager.cc.

References G4StateManager().

Referenced by G4RunManager::AbortEvent(), G4RunManager::AbortRun(), G4MTRunManager::AbortRun(), HadrontherapyInteractionParameters::BeamOn(), IORTInteractionParameters::BeamOn(), G4ErrorPropagatorManager::CloseGeometry(), G4RunManager::ConfirmBeamOnCondition(), G4TheRayTracer::CreateBitMap(), G4UIcommandTree::CreateHTML(), G4RunManagerKernel::DefineWorldVolume(), export_G4StateManager(), pyG4Exception::f2_G4Exception(), G4EventManager::G4EventManager(), G4Exception(), G4ParticleDefinition::G4ParticleDefinition(), G4RunManagerKernel::G4RunManagerKernel(), G4UIGAG::G4UIGAG(), G4UIGainServer::G4UIGainServer(), G4VExceptionHandler::G4VExceptionHandler(), G4VStateDependent::G4VStateDependent(), G4UIcontrolMessenger::GetCurrentValue(), G4DNAMolecularMaterial::GetDensityTableFor(), G4DNAMolecularMaterial::GetNumMolPerVolTableFor(), G4ErrorPropagatorManager::InitGeant4e(), G4RunManager::Initialize(), G4RunManagerKernel::InitializePhysics(), G4UIcommand::IsAvailable(), G4VUIshell::MakePrompt(), G4UItcsh::MakePrompt(), G4ExceptionHandler::Notify(), G4UImanager::Notify(), G4ErrorPropagatorManager::PrintG4State(), G4VSceneHandler::ProcessScene(), G4ErrorPropagator::PropagateOneStep(), PyG4ExceptionHandler::PyG4ExceptionHandler(), G4VModularPhysicsList::RegisterPhysics(), G4ParticleTable::Remove(), G4IonTable::Remove(), G4VModularPhysicsList::RemovePhysics(), G4VModularPhysicsList::ReplacePhysics(), G4RunManagerKernel::RunInitialization(), G4RunManagerKernel::RunTermination(), G4MaterialScanner::Scan(), G4UIGAG::SessionStart(), G4UIGainServer::SessionStart(), G4UIcontrolMessenger::SetNewValue(), G4ParticlePropertyTable::SetParticleProperty(), G4VelocityTable::SetVelocityTableProperties(), G4TheRayTracer::Trace(), G4TheMTRayTracer::Trace(), G4RunManagerKernel::UpdateRegion(), G4RunManagerKernel::WorkerDefineWorldVolume(), G4ParticleDefinition::~G4ParticleDefinition(), G4RunManager::~G4RunManager(), G4RunManagerKernel::~G4RunManagerKernel(), and G4VStateDependent::~G4VStateDependent().

132 {
133  if (!theStateManager)
134  {
135  theStateManager = new G4StateManager;
136  }
137  return theStateManager;
138 }
G4String G4StateManager::GetStateString ( G4ApplicationState  aState) const

Definition at line 247 of file G4StateManager.cc.

References G4State_Abort, G4State_EventProc, G4State_GeomClosed, G4State_Idle, G4State_Init, G4State_PreInit, and G4State_Quit.

Referenced by G4UIcommandTree::CreateHTML(), export_G4StateManager(), G4UIGAG::G4UIGAG(), G4UIGainServer::G4UIGainServer(), G4UIGAG::SessionStart(), G4UIGainServer::SessionStart(), G4TheMTRayTracer::Trace(), and G4RunManagerKernel::WorkerDefineWorldVolume().

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 }
G4int G4StateManager::GetSuppressAbortion ( ) const
inline
G4bool G4StateManager::RegisterDependent ( G4VStateDependent aDependent,
G4bool  bottom = false 
)

Definition at line 141 of file G4StateManager.cc.

Referenced by G4VStateDependent::G4VStateDependent().

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
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
G4bool G4StateManager::SetNewState ( G4ApplicationState  requestedState)
G4bool G4StateManager::SetNewState ( G4ApplicationState  requestedState,
const char *  msg 
)

Definition at line 196 of file G4StateManager.cc.

References G4State_Abort, G4State_EventProc, and G4VStateDependent::Notify().

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
void G4StateManager::SetSuppressAbortion ( G4int  i)
inline

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