Geant4-11
G4StateManager.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4StateManager
27//
28// Class description:
29//
30// Class responsible for handling and updating the running state
31// of the Geant4 application during its different phases.
32// The class is a singleton, it can be accessed via the public
33// method G4StateManager::GetStateManager().
34//
35// States of Geant4 are defined in G4ApplicationState.
36
37// Authors: G.Cosmo, M.Asai - November 1996
38// --------------------------------------------------------------------
39#ifndef G4StateManager_hh
40#define G4StateManager_hh 1
41
42#include "G4ApplicationState.hh"
43#include "G4String.hh"
44#include "G4Types.hh"
46#include "G4VStateDependent.hh"
47#include <vector>
48
50{
51 public:
53 // The G4StateManager class is a singleton class and the pointer
54 // to the only one existing object can be obtained by this static
55 // method.
56
58
61 G4bool operator==(const G4StateManager&) const = delete;
62 G4bool operator!=(const G4StateManager&) const = delete;
63
65 // Returns the current state
67 // Returns the previous state
68 G4bool SetNewState(const G4ApplicationState& requestedState);
69 // Set Geant4 to a new state.
70 // In case the request is illegal, false will be returned
71 // and the state of Geant4 will not be changed
72 G4bool SetNewState(const G4ApplicationState& requestedState, const char* msg);
73 // Set Geant4 to a new state.
74 // In case the request is illegal, false will be returned
75 // and the state of Geant4 will not be changed.
76 // "msg" is the information associated to the state change
78 G4bool bottom = false);
79 // Register a concrete class of G4VStateDependent.
80 // Registered concrete classes will be notified via
81 // G4VStateDependent::Notify() method when the state of Geant4 changes.
82 // False will be returned if registration fails
84 // Remove the registration.
85 // False will be returned if aDependent has not been registered
87 // Remove the registration.
88 // Removed pointer is returned
89 G4String GetStateString(const G4ApplicationState& aState) const;
90 // Utility method which returns a string of the state name
91
92 inline void SetSuppressAbortion(G4int i);
93 inline G4int GetSuppressAbortion() const;
94 inline const char* GetMessage() const;
97 static void SetVerboseLevel(G4int val);
98
99 private:
101
102 private:
106 std::vector<G4VStateDependent*> theDependentsList;
109 const char* msgptr = nullptr;
112};
113
114#include "G4StateManager.icc"
115
116#endif
G4ApplicationState
@ G4State_PreInit
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
const G4ApplicationState & GetCurrentState() const
const char * msgptr
G4VStateDependent * RemoveDependent(const G4VStateDependent *aDependent)
G4StateManager & operator=(const G4StateManager &)=delete
G4VExceptionHandler * exceptionHandler
G4StateManager(const G4StateManager &)=delete
G4VExceptionHandler * GetExceptionHandler() const
G4String GetStateString(const G4ApplicationState &aState) const
G4bool operator==(const G4StateManager &) const =delete
G4bool RegisterDependent(G4VStateDependent *aDependent, G4bool bottom=false)
G4ApplicationState theCurrentState
G4ApplicationState thePreviousState
const char * GetMessage() const
void SetSuppressAbortion(G4int i)
static G4StateManager * GetStateManager()
static G4int verboseLevel
static void SetVerboseLevel(G4int val)
static G4ThreadLocal G4StateManager * theStateManager
G4VStateDependent * theBottomDependent
std::vector< G4VStateDependent * > theDependentsList
G4int GetSuppressAbortion() const
G4bool SetNewState(const G4ApplicationState &requestedState)
G4bool operator!=(const G4StateManager &) const =delete
void SetExceptionHandler(G4VExceptionHandler *eh)
G4bool DeregisterDependent(G4VStateDependent *aDependent)
const G4ApplicationState & GetPreviousState() const
#define G4ThreadLocal
Definition: tls.hh:77