|
||||
File indexing completed on 2025-01-18 09:59:06
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 G4StateManager 0050 { 0051 public: 0052 static G4StateManager* GetStateManager(); 0053 // The G4StateManager class is a singleton class and the pointer 0054 // to the only one existing object can be obtained by this static 0055 // method. 0056 0057 ~G4StateManager(); 0058 0059 G4StateManager(const G4StateManager&) = delete; 0060 G4StateManager& operator=(const G4StateManager&) = delete; 0061 G4bool operator==(const G4StateManager&) const = delete; 0062 G4bool operator!=(const G4StateManager&) const = delete; 0063 0064 const G4ApplicationState& GetCurrentState() const; 0065 // Returns the current state 0066 const G4ApplicationState& GetPreviousState() const; 0067 // Returns the previous state 0068 G4bool SetNewState(const G4ApplicationState& requestedState); 0069 // Set Geant4 to a new state. 0070 // In case the request is illegal, false will be returned 0071 // and the state of Geant4 will not be changed 0072 G4bool SetNewState(const G4ApplicationState& requestedState, const char* msg); 0073 // Set Geant4 to a new state. 0074 // In case the request is illegal, false will be returned 0075 // and the state of Geant4 will not be changed. 0076 // "msg" is the information associated to the state change 0077 G4bool RegisterDependent(G4VStateDependent* aDependent, 0078 G4bool bottom = false); 0079 // Register a concrete class of G4VStateDependent. 0080 // Registered concrete classes will be notified via 0081 // G4VStateDependent::Notify() method when the state of Geant4 changes. 0082 // False will be returned if registration fails 0083 G4bool DeregisterDependent(G4VStateDependent* aDependent); 0084 // Remove the registration. 0085 // False will be returned if aDependent has not been registered 0086 G4VStateDependent* RemoveDependent(const G4VStateDependent* aDependent); 0087 // Remove the registration. 0088 // Removed pointer is returned 0089 G4String GetStateString(const G4ApplicationState& aState) const; 0090 // Utility method which returns a string of the state name 0091 0092 inline void SetSuppressAbortion(G4int i); 0093 inline G4int GetSuppressAbortion() const; 0094 inline const char* GetMessage() const; 0095 inline void SetExceptionHandler(G4VExceptionHandler* eh); 0096 inline G4VExceptionHandler* GetExceptionHandler() const; 0097 static void SetVerboseLevel(G4int val); 0098 0099 private: 0100 G4StateManager(); 0101 0102 private: 0103 static G4ThreadLocal G4StateManager* theStateManager; 0104 G4ApplicationState theCurrentState = G4State_PreInit; 0105 G4ApplicationState thePreviousState = G4State_PreInit; 0106 std::vector<G4VStateDependent*> theDependentsList; 0107 G4VStateDependent* theBottomDependent = nullptr; 0108 G4int suppressAbortion = 0; 0109 const char* msgptr = nullptr; 0110 G4VExceptionHandler* exceptionHandler = nullptr; 0111 static G4int verboseLevel; 0112 }; 0113 0114 #include "G4StateManager.icc" 0115 0116 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |