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.5 2001/07/18 17:59:22 asaim Exp $ >> 25 // GEANT4 tag $Name: geant4-04-00 $ >> 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 // ------------------------------------------- << 39 #ifndef G4StateManager_hh << 40 #define G4StateManager_hh 1 << 41 48 >> 49 #ifndef G4StateManager_h >> 50 #define G4StateManager_h 1 >> 51 >> 52 #include "g4std/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> << 48 << 49 class G4Run; << 50 class G4Event; << 51 56 52 class G4StateManager 57 class G4StateManager 53 { 58 { 54 public: << 59 >> 60 public: // with description >> 61 55 static G4StateManager* GetStateManager(); 62 static G4StateManager* GetStateManager(); 56 // The G4StateManager class is a singleton c << 63 // The G4StateManager class is a singleton class and the pointer 57 // to the only one existing object can be ob << 64 // to the only one existing object can be obtained by this static 58 // method. << 65 // method. >> 66 >> 67 protected: >> 68 >> 69 G4StateManager(); >> 70 >> 71 public: 59 72 60 ~G4StateManager(); 73 ~G4StateManager(); 61 74 62 G4StateManager(const G4StateManager&) = dele << 75 public: // with description 63 G4StateManager& operator=(const G4StateManag << 76 64 G4bool operator==(const G4StateManager&) con << 77 G4ApplicationState GetCurrentState() const; 65 G4bool operator!=(const G4StateManager&) con << 78 // Returns the current state 66 << 79 G4ApplicationState GetPreviousState() const; 67 const G4ApplicationState& GetCurrentState() << 80 // Returns the previous state 68 // Returns the current state << 81 G4bool SetNewState(G4ApplicationState requestedState); 69 const G4ApplicationState& GetPreviousState() << 82 // Set Geant4 to a new state. 70 // Returns the previous state << 83 // In case the request is irregal, false will be returned 71 G4bool SetNewState(const G4ApplicationState& << 84 // and the state of Geant4 will not be changed. 72 // Set Geant4 to a new state. << 85 G4bool RegisterDependent(G4VStateDependent* aDependent,G4bool bottom=false); 73 // In case the request is illegal, false wil << 86 // Register a concrete class of G4VStateDependent. 74 // and the state of Geant4 will not be chang << 87 // Registered concrete classes will be notified via 75 G4bool SetNewState(const G4ApplicationState& << 88 // G4VStateDependent::Notify() method when the state of Geant4 changes. 76 // Set Geant4 to a new state. << 89 // False will be returned if registration fails. 77 // In case the request is illegal, false wil << 78 // and the state of Geant4 will not be chang << 79 // "msg" is the information associated to th << 80 G4bool RegisterDependent(G4VStateDependent* << 81 G4bool bottom = fal << 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 90 G4bool DeregisterDependent(G4VStateDependent* aDependent); 87 // Remove the registration. << 91 // Remove the registration. 88 // False will be returned if aDependent has << 92 // False will be returned if aDependent has not been registered. 89 G4VStateDependent* RemoveDependent(const G4V 93 G4VStateDependent* RemoveDependent(const G4VStateDependent* aDependent); 90 // Remove the registration. << 94 // Remove the registration. 91 // Removed pointer is returned << 95 // Removed pointer is returned. 92 G4String GetStateString(const G4ApplicationS << 96 G4String GetStateString(G4ApplicationState aState) const; 93 // Utility method which returns a string of << 97 // Utility method which returns a string of the state name. 94 << 98 95 void NotifyDeletion(const G4Event*); << 99 public: 96 void NotifyDeletion(const G4Run*); << 100 97 // Notifying when an event or a run is delet << 101 //void Pause(); 98 // a state-dependent class from accessing to << 102 //void Pause(const char* msg); 99 << 103 //void Pause(G4String msg); 100 inline void SetSuppressAbortion(G4int i); << 104 //// G4UIsession::pauseSession() will be invoked. The argument string "msg" 101 inline G4int GetSuppressAbortion() const; << 105 //// will be used as a prompt characters if the session is non-graphical. 102 inline const char* GetMessage() const; << 106 //// This method can be invoked by any user action class during the event 103 inline void SetExceptionHandler(G4VException << 107 //// loop. After the user's interactions, control goes back to the caller. 104 inline G4VExceptionHandler* GetExceptionHand << 108 105 static void SetVerboseLevel(G4int val); << 109 private: >> 110 >> 111 G4StateManager(const G4StateManager &right); >> 112 G4StateManager& operator=(const G4StateManager &right); >> 113 G4int operator==(const G4StateManager &right) const; >> 114 G4int operator!=(const G4StateManager &right) const; >> 115 >> 116 private: >> 117 >> 118 static G4StateManager* theStateManager; >> 119 G4ApplicationState theCurrentState; >> 120 G4ApplicationState thePreviousState; >> 121 G4std::vector<G4VStateDependent*> theDependentsList; >> 122 G4VStateDependent* theBottomDependent; >> 123 G4int suppressAbortion; >> 124 >> 125 public: >> 126 inline void SetSuppressAbortion(G4int i) { suppressAbortion = i; } >> 127 inline G4int GetSuppressAbortion() const { return suppressAbortion; } 106 128 107 private: << 108 G4StateManager(); << 109 << 110 private: << 111 static G4ThreadLocal G4StateManager* theStat << 112 G4ApplicationState theCurrentState = G4Stat << 113 G4ApplicationState thePreviousState = G4Stat << 114 std::vector<G4VStateDependent*> theDependent << 115 G4VStateDependent* theBottomDependent = null << 116 G4int suppressAbortion = 0; << 117 const char* msgptr = null << 118 G4VExceptionHandler* exceptionHandler = null << 119 static G4int verboseLevel; << 120 }; 129 }; 121 << 122 #include "G4StateManager.icc" << 123 130 124 #endif 131 #endif 125 132