|
|
|||
File indexing completed on 2025-11-01 08:42:23
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // G4StateManager 0027 // 0028 // Class description: 0029 // 0030 // Class responsible for handling and updating the running state 0031 // of the Geant4 application during its different phases. 0032 // The class is a singleton, it can be accessed via the public 0033 // method G4StateManager::GetStateManager(). 0034 // 0035 // States of Geant4 are defined in G4ApplicationState. 0036 0037 // Authors: G.Cosmo, M.Asai - November 1996 0038 // -------------------------------------------------------------------- 0039 #ifndef G4StateManager_hh 0040 #define G4StateManager_hh 1 0041 0042 #include "G4ApplicationState.hh" 0043 #include "G4String.hh" 0044 #include "G4Types.hh" 0045 #include "G4VExceptionHandler.hh" 0046 #include "G4VStateDependent.hh" 0047 #include <vector> 0048 0049 class G4Run; 0050 class G4Event; 0051 0052 class G4StateManager 0053 { 0054 public: 0055 static G4StateManager* GetStateManager(); 0056 // The G4StateManager class is a singleton class and the pointer 0057 // to the only one existing object can be obtained by this static 0058 // method. 0059 0060 ~G4StateManager(); 0061 0062 G4StateManager(const G4StateManager&) = delete; 0063 G4StateManager& operator=(const G4StateManager&) = delete; 0064 G4bool operator==(const G4StateManager&) const = delete; 0065 G4bool operator!=(const G4StateManager&) const = delete; 0066 0067 const G4ApplicationState& GetCurrentState() const; 0068 // Returns the current state 0069 const G4ApplicationState& GetPreviousState() const; 0070 // Returns the previous state 0071 G4bool SetNewState(const G4ApplicationState& requestedState); 0072 // Set Geant4 to a new state. 0073 // In case the request is illegal, false will be returned 0074 // and the state of Geant4 will not be changed 0075 G4bool SetNewState(const G4ApplicationState& requestedState, const char* msg); 0076 // Set Geant4 to a new state. 0077 // In case the request is illegal, false will be returned 0078 // and the state of Geant4 will not be changed. 0079 // "msg" is the information associated to the state change 0080 G4bool RegisterDependent(G4VStateDependent* aDependent, 0081 G4bool bottom = false); 0082 // Register a concrete class of G4VStateDependent. 0083 // Registered concrete classes will be notified via 0084 // G4VStateDependent::Notify() method when the state of Geant4 changes. 0085 // False will be returned if registration fails 0086 G4bool DeregisterDependent(G4VStateDependent* aDependent); 0087 // Remove the registration. 0088 // False will be returned if aDependent has not been registered 0089 G4VStateDependent* RemoveDependent(const G4VStateDependent* aDependent); 0090 // Remove the registration. 0091 // Removed pointer is returned 0092 G4String GetStateString(const G4ApplicationState& aState) const; 0093 // Utility method which returns a string of the state name 0094 0095 void NotifyDeletion(const G4Event*); 0096 void NotifyDeletion(const G4Run*); 0097 // Notifying when an event or a run is deleted for the sake of avoiding 0098 // a state-dependent class from accessing to an obsolete event/run object. 0099 0100 inline void SetSuppressAbortion(G4int i); 0101 inline G4int GetSuppressAbortion() const; 0102 inline const char* GetMessage() const; 0103 inline void SetExceptionHandler(G4VExceptionHandler* eh); 0104 inline G4VExceptionHandler* GetExceptionHandler() const; 0105 static void SetVerboseLevel(G4int val); 0106 0107 private: 0108 G4StateManager(); 0109 0110 private: 0111 static G4ThreadLocal G4StateManager* theStateManager; 0112 G4ApplicationState theCurrentState = G4State_PreInit; 0113 G4ApplicationState thePreviousState = G4State_PreInit; 0114 std::vector<G4VStateDependent*> theDependentsList; 0115 G4VStateDependent* theBottomDependent = nullptr; 0116 G4int suppressAbortion = 0; 0117 const char* msgptr = nullptr; 0118 G4VExceptionHandler* exceptionHandler = nullptr; 0119 static G4int verboseLevel; 0120 }; 0121 0122 #include "G4StateManager.icc" 0123 0124 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|