Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // G4StateManager << 27 // 26 // 28 // Class description: << 27 // >> 28 // >> 29 // ------------------------------------------------------------ >> 30 // GEANT 4 class header file >> 31 // >> 32 // >> 33 // ---------------- G4StateManager ---------------- >> 34 // >> 35 // Authors: G.Cosmo, M.Asai - November 1996 >> 36 // >> 37 // ------------------------------------------------------------- >> 38 // >> 39 // Class Description: 29 // 40 // 30 // Class responsible for handling and updating 41 // Class responsible for handling and updating the running state 31 // of the Geant4 application during its differ 42 // of the Geant4 application during its different phases. 32 // The class is a singleton, it can be accesse 43 // The class is a singleton, it can be accessed via the public 33 // method G4StateManager::GetStateManager(). 44 // method G4StateManager::GetStateManager(). 34 // 45 // 35 // States of Geant4 are defined in G4Applicati 46 // States of Geant4 are defined in G4ApplicationState. 36 47 37 // Authors: G.Cosmo, M.Asai - November 1996 << 48 // ------------------------------------------------------------- 38 // ------------------------------------------- << 39 #ifndef G4StateManager_hh << 40 #define G4StateManager_hh 1 << 41 49 42 #include "G4ApplicationState.hh" << 50 #ifndef G4StateManager_h 43 #include "G4String.hh" << 51 #define G4StateManager_h 1 >> 52 >> 53 #include <vector> 44 #include "G4Types.hh" 54 #include "G4Types.hh" 45 #include "G4VExceptionHandler.hh" << 55 #include "G4String.hh" >> 56 #include "G4ApplicationState.hh" 46 #include "G4VStateDependent.hh" 57 #include "G4VStateDependent.hh" 47 #include <vector> << 58 #include "G4VExceptionHandler.hh" 48 << 49 class G4Run; << 50 class G4Event; << 51 59 52 class G4StateManager 60 class G4StateManager 53 { 61 { 54 public: << 62 55 static G4StateManager* GetStateManager(); << 63 public: // with description 56 // The G4StateManager class is a singleton c << 64 57 // to the only one existing object can be ob << 65 static G4StateManager* GetStateManager(); 58 // method. << 66 // The G4StateManager class is a singleton class and the pointer 59 << 67 // to the only one existing object can be obtained by this static 60 ~G4StateManager(); << 68 // method. 61 << 69 62 G4StateManager(const G4StateManager&) = dele << 70 ~G4StateManager(); 63 G4StateManager& operator=(const G4StateManag << 71 64 G4bool operator==(const G4StateManager&) con << 72 const G4ApplicationState& GetCurrentState() const; 65 G4bool operator!=(const G4StateManager&) con << 73 // Returns the current state 66 << 74 const G4ApplicationState& GetPreviousState() const; 67 const G4ApplicationState& GetCurrentState() << 75 // Returns the previous state 68 // Returns the current state << 76 G4bool SetNewState(const G4ApplicationState& requestedState); 69 const G4ApplicationState& GetPreviousState() << 77 // Set Geant4 to a new state. 70 // Returns the previous state << 78 // In case the request is irregal, false will be returned 71 G4bool SetNewState(const G4ApplicationState& << 79 // and the state of Geant4 will not be changed. 72 // Set Geant4 to a new state. << 80 G4bool SetNewState(const G4ApplicationState& requestedState, 73 // In case the request is illegal, false wil << 81 const char* msg); 74 // and the state of Geant4 will not be chang << 82 // Set Geant4 to a new state. 75 G4bool SetNewState(const G4ApplicationState& << 83 // In case the request is irregal, false will be returned 76 // Set Geant4 to a new state. << 84 // and the state of Geant4 will not be changed. 77 // In case the request is illegal, false wil << 85 // "msg" is information associating to this state change 78 // and the state of Geant4 will not be chang << 86 G4bool RegisterDependent(G4VStateDependent* aDependent,G4bool bottom=false); 79 // "msg" is the information associated to th << 87 // Register a concrete class of G4VStateDependent. 80 G4bool RegisterDependent(G4VStateDependent* << 88 // Registered concrete classes will be notified via 81 G4bool bottom = fal << 89 // G4VStateDependent::Notify() method when the state of Geant4 changes. 82 // Register a concrete class of G4VStateDepe << 90 // False will be returned if registration fails. 83 // Registered concrete classes will be notif << 91 G4bool DeregisterDependent(G4VStateDependent* aDependent); 84 // G4VStateDependent::Notify() method when t << 92 // Remove the registration. 85 // False will be returned if registration fa << 93 // False will be returned if aDependent has not been registered. 86 G4bool DeregisterDependent(G4VStateDependent << 94 G4VStateDependent* RemoveDependent(const G4VStateDependent* aDependent); 87 // Remove the registration. << 95 // Remove the registration. 88 // False will be returned if aDependent has << 96 // Removed pointer is returned. 89 G4VStateDependent* RemoveDependent(const G4V << 97 G4String GetStateString(const G4ApplicationState& aState) const; 90 // Remove the registration. << 98 // Utility method which returns a string of the state name. 91 // Removed pointer is returned << 99 92 G4String GetStateString(const G4ApplicationS << 100 inline void SetSuppressAbortion(G4int i); 93 // Utility method which returns a string of << 101 inline G4int GetSuppressAbortion() const; 94 << 102 inline const char* GetMessage() const; 95 void NotifyDeletion(const G4Event*); << 103 inline void SetExceptionHandler(G4VExceptionHandler* eh); 96 void NotifyDeletion(const G4Run*); << 104 inline G4VExceptionHandler* GetExceptionHandler() const; 97 // Notifying when an event or a run is delet << 105 static void SetVerboseLevel(G4int val); 98 // a state-dependent class from accessing to << 106 99 << 107 private: 100 inline void SetSuppressAbortion(G4int i); << 108 101 inline G4int GetSuppressAbortion() const; << 109 G4StateManager(); 102 inline const char* GetMessage() const; << 110 G4StateManager(const G4StateManager &right); 103 inline void SetExceptionHandler(G4VException << 111 G4StateManager& operator=(const G4StateManager &right); 104 inline G4VExceptionHandler* GetExceptionHand << 112 G4bool operator==(const G4StateManager &right) const; 105 static void SetVerboseLevel(G4int val); << 113 G4bool operator!=(const G4StateManager &right) const; 106 << 114 107 private: << 115 private: 108 G4StateManager(); << 116 109 << 117 static G4ThreadLocal G4StateManager* theStateManager; 110 private: << 118 G4ApplicationState theCurrentState; 111 static G4ThreadLocal G4StateManager* theStat << 119 G4ApplicationState thePreviousState; 112 G4ApplicationState theCurrentState = G4Stat << 120 std::vector<G4VStateDependent*> theDependentsList; 113 G4ApplicationState thePreviousState = G4Stat << 121 G4VStateDependent* theBottomDependent; 114 std::vector<G4VStateDependent*> theDependent << 122 G4int suppressAbortion; 115 G4VStateDependent* theBottomDependent = null << 123 const char* msgptr; 116 G4int suppressAbortion = 0; << 124 G4VExceptionHandler* exceptionHandler; 117 const char* msgptr = null << 125 static G4int verboseLevel; 118 G4VExceptionHandler* exceptionHandler = null << 119 static G4int verboseLevel; << 120 }; 126 }; 121 127 122 #include "G4StateManager.icc" 128 #include "G4StateManager.icc" 123 129 124 #endif 130 #endif 125 131