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 // $Id$ >> 28 // >> 29 // >> 30 // ------------------------------------------------------------ >> 31 // GEANT 4 class header file >> 32 // >> 33 // >> 34 // ---------------- G4StateManager ---------------- >> 35 // >> 36 // Authors: G.Cosmo, M.Asai - November 1996 >> 37 // >> 38 // ------------------------------------------------------------- >> 39 // >> 40 // Class Description: 29 // 41 // 30 // Class responsible for handling and updating 42 // Class responsible for handling and updating the running state 31 // of the Geant4 application during its differ 43 // of the Geant4 application during its different phases. 32 // The class is a singleton, it can be accesse 44 // The class is a singleton, it can be accessed via the public 33 // method G4StateManager::GetStateManager(). 45 // method G4StateManager::GetStateManager(). 34 // 46 // 35 // States of Geant4 are defined in G4Applicati 47 // States of Geant4 are defined in G4ApplicationState. 36 48 37 // Authors: G.Cosmo, M.Asai - November 1996 << 49 // ------------------------------------------------------------- 38 // ------------------------------------------- << 50 39 #ifndef G4StateManager_hh << 51 #ifndef G4StateManager_h 40 #define G4StateManager_hh 1 << 52 #define G4StateManager_h 1 41 53 >> 54 #include <vector> >> 55 #include "globals.hh" 42 #include "G4ApplicationState.hh" 56 #include "G4ApplicationState.hh" 43 #include "G4String.hh" << 44 #include "G4Types.hh" << 45 #include "G4VExceptionHandler.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 >> 63 public: // with description >> 64 55 static G4StateManager* GetStateManager(); 65 static G4StateManager* GetStateManager(); 56 // The G4StateManager class is a singleton c << 66 // The G4StateManager class is a singleton class and the pointer 57 // to the only one existing object can be ob << 67 // to the only one existing object can be obtained by this static 58 // method. << 68 // method. >> 69 >> 70 protected: >> 71 >> 72 G4StateManager(); >> 73 >> 74 public: 59 75 60 ~G4StateManager(); 76 ~G4StateManager(); 61 77 62 G4StateManager(const G4StateManager&) = dele << 78 public: // with description 63 G4StateManager& operator=(const G4StateManag << 79 64 G4bool operator==(const G4StateManager&) con << 80 G4ApplicationState GetCurrentState() const; 65 G4bool operator!=(const G4StateManager&) con << 81 // Returns the current state 66 << 82 G4ApplicationState GetPreviousState() const; 67 const G4ApplicationState& GetCurrentState() << 83 // Returns the previous state 68 // Returns the current state << 84 G4bool SetNewState(G4ApplicationState requestedState); 69 const G4ApplicationState& GetPreviousState() << 85 // Set Geant4 to a new state. 70 // Returns the previous state << 86 // In case the request is irregal, false will be returned 71 G4bool SetNewState(const G4ApplicationState& << 87 // and the state of Geant4 will not be changed. 72 // Set Geant4 to a new state. << 88 G4bool SetNewState(G4ApplicationState requestedState, const char* msg); 73 // In case the request is illegal, false wil << 89 // Set Geant4 to a new state. 74 // and the state of Geant4 will not be chang << 90 // In case the request is irregal, false will be returned 75 G4bool SetNewState(const G4ApplicationState& << 91 // and the state of Geant4 will not be changed. 76 // Set Geant4 to a new state. << 92 // "msg" is information associating to this state change 77 // In case the request is illegal, false wil << 93 G4bool RegisterDependent(G4VStateDependent* aDependent,G4bool bottom=false); 78 // and the state of Geant4 will not be chang << 94 // Register a concrete class of G4VStateDependent. 79 // "msg" is the information associated to th << 95 // Registered concrete classes will be notified via 80 G4bool RegisterDependent(G4VStateDependent* << 96 // G4VStateDependent::Notify() method when the state of Geant4 changes. 81 G4bool bottom = fal << 97 // False will be returned if registration fails. 82 // Register a concrete class of G4VStateDepe << 83 // Registered concrete classes will be notif << 84 // G4VStateDependent::Notify() method when t << 85 // False will be returned if registration fa << 86 G4bool DeregisterDependent(G4VStateDependent 98 G4bool DeregisterDependent(G4VStateDependent* aDependent); 87 // Remove the registration. << 99 // Remove the registration. 88 // False will be returned if aDependent has << 100 // False will be returned if aDependent has not been registered. 89 G4VStateDependent* RemoveDependent(const G4V 101 G4VStateDependent* RemoveDependent(const G4VStateDependent* aDependent); 90 // Remove the registration. << 102 // Remove the registration. 91 // Removed pointer is returned << 103 // Removed pointer is returned. 92 G4String GetStateString(const G4ApplicationS << 104 G4String GetStateString(G4ApplicationState aState) const; 93 // Utility method which returns a string of << 105 // Utility method which returns a string of the state name. 94 << 106 95 void NotifyDeletion(const G4Event*); << 107 public: 96 void NotifyDeletion(const G4Run*); << 97 // Notifying when an event or a run is delet << 98 // a state-dependent class from accessing to << 99 108 100 inline void SetSuppressAbortion(G4int i); 109 inline void SetSuppressAbortion(G4int i); 101 inline G4int GetSuppressAbortion() const; 110 inline G4int GetSuppressAbortion() const; 102 inline const char* GetMessage() const; 111 inline const char* GetMessage() const; 103 inline void SetExceptionHandler(G4VException 112 inline void SetExceptionHandler(G4VExceptionHandler* eh); 104 inline G4VExceptionHandler* GetExceptionHand 113 inline G4VExceptionHandler* GetExceptionHandler() const; 105 static void SetVerboseLevel(G4int val); << 106 114 107 private: << 115 public: 108 G4StateManager(); << 109 116 110 private: << 117 //void Pause(); 111 static G4ThreadLocal G4StateManager* theStat << 118 //void Pause(const char* msg); 112 G4ApplicationState theCurrentState = G4Stat << 119 //void Pause(G4String msg); 113 G4ApplicationState thePreviousState = G4Stat << 120 //// G4UIsession::pauseSession() will be invoked. The argument string "msg" >> 121 //// will be used as a prompt characters if the session is non-graphical. >> 122 //// This method can be invoked by any user action class during the event >> 123 //// loop. After the user's interactions, control goes back to the caller. >> 124 >> 125 private: >> 126 >> 127 G4StateManager(const G4StateManager &right); >> 128 G4StateManager& operator=(const G4StateManager &right); >> 129 G4int operator==(const G4StateManager &right) const; >> 130 G4int operator!=(const G4StateManager &right) const; >> 131 >> 132 private: >> 133 >> 134 static G4StateManager* theStateManager; >> 135 G4ApplicationState theCurrentState; >> 136 G4ApplicationState thePreviousState; 114 std::vector<G4VStateDependent*> theDependent 137 std::vector<G4VStateDependent*> theDependentsList; 115 G4VStateDependent* theBottomDependent = null << 138 G4VStateDependent* theBottomDependent; 116 G4int suppressAbortion = 0; << 139 G4int suppressAbortion; 117 const char* msgptr = null << 140 const char* msgptr; 118 G4VExceptionHandler* exceptionHandler = null << 141 G4VExceptionHandler* exceptionHandler; 119 static G4int verboseLevel; << 142 120 }; 143 }; 121 144 122 #include "G4StateManager.icc" 145 #include "G4StateManager.icc" 123 146 124 #endif 147 #endif 125 148