Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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::G4StateManager ( )
protected

Definition at line 43 of file G4StateManager.cc.

44 : theCurrentState(G4State_PreInit),
45 thePreviousState(G4State_PreInit),
46 theBottomDependent(0),
47 suppressAbortion(0),
48 msgptr(0),
49 exceptionHandler(0)
50{
51}
@ G4State_PreInit

Referenced by GetStateManager().

◆ ~G4StateManager()

G4StateManager::~G4StateManager ( )

Definition at line 53 of file G4StateManager.cc.

54{
55 G4VStateDependent* state=0;
56
57 while (theDependentsList.size()>0)
58 {
59 state = theDependentsList.back();
60 theDependentsList.pop_back();
61 for (std::vector<G4VStateDependent*>::iterator
62 i=theDependentsList.begin(); i!=theDependentsList.end();)
63 {
64 if (*i==state)
65 {
66 i = theDependentsList.erase(i);
67 }
68 else
69 {
70 ++i;
71 }
72 }
73 if ( state ) { delete state; }
74 }
75}

Member Function Documentation

◆ DeregisterDependent()

G4bool G4StateManager::DeregisterDependent ( G4VStateDependent aDependent)

Definition at line 153 of file G4StateManager.cc.

154{
155 G4VStateDependent* tmp = 0;
156 for (std::vector<G4VStateDependent*>::iterator i=theDependentsList.begin();
157 i!=theDependentsList.end();)
158 {
159 if (**i==*aDependent)
160 {
161 tmp = *i;
162 i = theDependentsList.erase(i);
163 }
164 else
165 {
166 ++i;
167 }
168 }
169 return (tmp != 0);
170}

Referenced by G4VStateDependent::~G4VStateDependent().

◆ GetCurrentState()

◆ GetExceptionHandler()

G4VExceptionHandler * G4StateManager::GetExceptionHandler ( ) const
inline

Referenced by G4Exception().

◆ GetMessage()

const char * G4StateManager::GetMessage ( ) const
inline

◆ GetPreviousState()

G4ApplicationState G4StateManager::GetPreviousState ( ) const

Definition at line 179 of file G4StateManager.cc.

180{
181 return thePreviousState;
182}

◆ GetStateManager()

G4StateManager * G4StateManager::GetStateManager ( )
static

Definition at line 124 of file G4StateManager.cc.

125{
126 if (!theStateManager)
127 {
128 theStateManager = new G4StateManager;
129 }
130 return theStateManager;
131}

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

◆ GetStateString()

G4String G4StateManager::GetStateString ( G4ApplicationState  aState) const

Definition at line 240 of file G4StateManager.cc.

241{
242 G4String stateName;
243 switch(aState)
244 {
245 case G4State_PreInit:
246 stateName = "PreInit"; break;
247 case G4State_Init:
248 stateName = "Init"; break;
249 case G4State_Idle:
250 stateName = "Idle"; break;
252 stateName = "GeomClosed"; break;
254 stateName = "EventProc"; break;
255 case G4State_Quit:
256 stateName = "Quit"; break;
257 case G4State_Abort:
258 stateName = "Abort"; break;
259 default:
260 stateName = "Unknown"; break;
261 }
262 return stateName;
263}
@ G4State_EventProc
@ G4State_Init
@ G4State_Idle
@ G4State_Quit
@ G4State_Abort
@ G4State_GeomClosed

Referenced by G4UIcommandTree::CreateHTML(), G4UIGAG::G4UIGAG(), G4UIGainServer::G4UIGainServer(), G4UIGAG::SessionStart(), and G4UIGainServer::SessionStart().

◆ GetSuppressAbortion()

G4int G4StateManager::GetSuppressAbortion ( ) const
inline

◆ RegisterDependent()

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

Definition at line 134 of file G4StateManager.cc.

135{
136 G4bool ack=true;
137 if(!bottom)
138 {
139 theDependentsList.push_back(aDependent);
140 }
141 else
142 {
143 if(theBottomDependent)
144 {
145 theDependentsList.push_back(theBottomDependent);
146 }
147 theBottomDependent = aDependent;
148 }
149 return ack;
150}
bool G4bool
Definition: G4Types.hh:67

Referenced by G4VStateDependent::G4VStateDependent().

◆ RemoveDependent()

G4VStateDependent * G4StateManager::RemoveDependent ( const G4VStateDependent aDependent)

Definition at line 220 of file G4StateManager.cc.

221{
222 G4VStateDependent* tmp = 0;
223 for (std::vector<G4VStateDependent*>::iterator i=theDependentsList.begin();
224 i!=theDependentsList.end();)
225 {
226 if (**i==*aDependent)
227 {
228 tmp = *i;
229 i = theDependentsList.erase(i);
230 }
231 else
232 {
233 ++i;
234 }
235 }
236 return tmp;
237}

◆ SetExceptionHandler()

void G4StateManager::SetExceptionHandler ( G4VExceptionHandler eh)
inline

◆ SetNewState() [1/2]

◆ SetNewState() [2/2]

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

Definition at line 189 of file G4StateManager.cc.

190{
191 if(requestedState==G4State_Abort && suppressAbortion>0)
192 {
193 if(suppressAbortion==2) { return false; }
194 if(theCurrentState==G4State_EventProc) { return false; }
195 }
196 msgptr = msg;
197 size_t i=0;
198 G4bool ack = true;
199 G4ApplicationState savedState = thePreviousState;
200 thePreviousState = theCurrentState;
201 while ((ack) && (i<theDependentsList.size()))
202 {
203 ack = theDependentsList[i]->Notify(requestedState);
204 i++;
205 }
206 if(theBottomDependent)
207 {
208 ack = theBottomDependent->Notify(requestedState);
209 }
210
211 if(!ack)
212 { thePreviousState = savedState; }
213 else
214 { theCurrentState = requestedState; }
215 msgptr = 0;
216 return ack;
217}
G4ApplicationState
virtual G4bool Notify(G4ApplicationState requestedState)=0

◆ SetSuppressAbortion()

void G4StateManager::SetSuppressAbortion ( G4int  i)
inline

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