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