G4StateManager.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // 
00030 // ------------------------------------------------------------
00031 //      GEANT 4 class header file 
00032 //
00033 //
00034 //       ---------------- G4StateManager ----------------
00035 //
00036 // Authors: G.Cosmo, M.Asai - November 1996
00037 //
00038 // -------------------------------------------------------------
00039 //
00040 // Class Description:
00041 //
00042 // Class responsible for handling and updating the running state
00043 // of the Geant4 application during its different phases.
00044 // The class is a singleton, it can be accessed via the public
00045 // method G4StateManager::GetStateManager().
00046 //
00047 // States of Geant4 are defined in G4ApplicationState.
00048 
00049 // -------------------------------------------------------------
00050 
00051 #ifndef G4StateManager_h
00052 #define G4StateManager_h 1
00053 
00054 #include <vector>
00055 #include "globals.hh"
00056 #include "G4ApplicationState.hh"
00057 #include "G4VStateDependent.hh"
00058 #include "G4VExceptionHandler.hh"
00059 
00060 class G4StateManager
00061 {
00062 
00063 public: // with description
00064 
00065   static G4StateManager* GetStateManager();
00066     // The G4StateManager class is a singleton class and the pointer
00067     // to the only one existing object can be obtained by this static 
00068     // method.
00069 
00070 protected:
00071 
00072   G4StateManager();
00073 
00074 public:
00075 
00076   ~G4StateManager();
00077 
00078 public: // with description
00079 
00080   G4ApplicationState GetCurrentState() const;
00081     // Returns the current state
00082   G4ApplicationState GetPreviousState() const;
00083     // Returns the previous state
00084   G4bool SetNewState(G4ApplicationState requestedState);
00085     // Set Geant4 to a new state.
00086     // In case the request is irregal, false will be returned
00087     // and the state of Geant4 will not be changed.
00088   G4bool SetNewState(G4ApplicationState requestedState, const char* msg);
00089     // Set Geant4 to a new state.
00090     // In case the request is irregal, false will be returned
00091     // and the state of Geant4 will not be changed.
00092     // "msg" is information associating to this state change
00093   G4bool RegisterDependent(G4VStateDependent* aDependent,G4bool bottom=false);
00094     // Register a concrete class of G4VStateDependent.
00095     // Registered concrete classes will be notified via
00096     // G4VStateDependent::Notify() method when the state of Geant4 changes.
00097     // False will be returned if registration fails.
00098   G4bool DeregisterDependent(G4VStateDependent* aDependent);
00099     // Remove the registration.
00100     // False will be returned if aDependent has not been registered.
00101   G4VStateDependent* RemoveDependent(const G4VStateDependent* aDependent);
00102     // Remove the registration.
00103     // Removed pointer is returned.
00104   G4String GetStateString(G4ApplicationState aState) const;
00105     // Utility method which returns a string of the state name.
00106 
00107 public:
00108 
00109   inline void SetSuppressAbortion(G4int i);
00110   inline G4int GetSuppressAbortion() const;
00111   inline const char* GetMessage() const;
00112   inline void SetExceptionHandler(G4VExceptionHandler* eh);
00113   inline G4VExceptionHandler* GetExceptionHandler() const;
00114 
00115 public:
00116 
00117   //void Pause();
00118   //void Pause(const char* msg);
00119   //void Pause(G4String msg);
00124 
00125 private:
00126 
00127   G4StateManager(const G4StateManager &right);
00128   G4StateManager& operator=(const G4StateManager &right);
00129   G4int operator==(const G4StateManager &right) const;
00130   G4int operator!=(const G4StateManager &right) const;
00131 
00132 private:
00133 
00134   static G4StateManager* theStateManager;
00135   G4ApplicationState theCurrentState;
00136   G4ApplicationState thePreviousState;
00137   std::vector<G4VStateDependent*> theDependentsList;
00138   G4VStateDependent* theBottomDependent;
00139   G4int suppressAbortion;
00140   const char* msgptr;
00141   G4VExceptionHandler* exceptionHandler;
00142 
00143 };
00144 
00145 #include "G4StateManager.icc"
00146 
00147 #endif

Generated on Mon May 27 17:49:53 2013 for Geant4 by  doxygen 1.4.7