source: trunk/source/global/management/include/G4StateManager.hh@ 1109

Last change on this file since 1109 was 1058, checked in by garnier, 17 years ago

file release beta

File size: 5.5 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// $Id: G4StateManager.hh,v 1.10 2006/06/29 19:02:59 gunter Exp $
28// GEANT4 tag $Name: geant4-09-02-ref-02 $
29//
30//
31// ------------------------------------------------------------
32// GEANT 4 class header file
33//
34//
35// ---------------- G4StateManager ----------------
36//
37// Authors: G.Cosmo, M.Asai - November 1996
38//
39// -------------------------------------------------------------
40//
41// Class Description:
42//
43// Class responsible for handling and updating the running state
44// of the Geant4 application during its different phases.
45// The class is a singleton, it can be accessed via the public
46// method G4StateManager::GetStateManager().
47//
48// States of Geant4 are defined in G4ApplicationState.
49
50// -------------------------------------------------------------
51
52#ifndef G4StateManager_h
53#define G4StateManager_h 1
54
55#include <vector>
56#include "globals.hh"
57#include "G4ApplicationState.hh"
58#include "G4VStateDependent.hh"
59#include "G4VExceptionHandler.hh"
60
61class G4StateManager
62{
63
64public: // with description
65
66 static G4StateManager* GetStateManager();
67 // The G4StateManager class is a singleton class and the pointer
68 // to the only one existing object can be obtained by this static
69 // method.
70
71protected:
72
73 G4StateManager();
74
75public:
76
77 ~G4StateManager();
78
79public: // with description
80
81 G4ApplicationState GetCurrentState() const;
82 // Returns the current state
83 G4ApplicationState GetPreviousState() const;
84 // Returns the previous state
85 G4bool SetNewState(G4ApplicationState requestedState);
86 // Set Geant4 to a new state.
87 // In case the request is irregal, false will be returned
88 // and the state of Geant4 will not be changed.
89 G4bool SetNewState(G4ApplicationState requestedState, const char* msg);
90 // Set Geant4 to a new state.
91 // In case the request is irregal, false will be returned
92 // and the state of Geant4 will not be changed.
93 // "msg" is information associating to this state change
94 G4bool RegisterDependent(G4VStateDependent* aDependent,G4bool bottom=false);
95 // Register a concrete class of G4VStateDependent.
96 // Registered concrete classes will be notified via
97 // G4VStateDependent::Notify() method when the state of Geant4 changes.
98 // False will be returned if registration fails.
99 G4bool DeregisterDependent(G4VStateDependent* aDependent);
100 // Remove the registration.
101 // False will be returned if aDependent has not been registered.
102 G4VStateDependent* RemoveDependent(const G4VStateDependent* aDependent);
103 // Remove the registration.
104 // Removed pointer is returned.
105 G4String GetStateString(G4ApplicationState aState) const;
106 // Utility method which returns a string of the state name.
107
108public:
109
110 inline void SetSuppressAbortion(G4int i);
111 inline G4int GetSuppressAbortion() const;
112 inline const char* GetMessage() const;
113 inline void SetExceptionHandler(G4VExceptionHandler* eh);
114 inline G4VExceptionHandler* GetExceptionHandler() const;
115
116public:
117
118 //void Pause();
119 //void Pause(const char* msg);
120 //void Pause(G4String msg);
121 //// G4UIsession::pauseSession() will be invoked. The argument string "msg"
122 //// will be used as a prompt characters if the session is non-graphical.
123 //// This method can be invoked by any user action class during the event
124 //// loop. After the user's interactions, control goes back to the caller.
125
126private:
127
128 G4StateManager(const G4StateManager &right);
129 G4StateManager& operator=(const G4StateManager &right);
130 G4int operator==(const G4StateManager &right) const;
131 G4int operator!=(const G4StateManager &right) const;
132
133private:
134
135 static G4StateManager* theStateManager;
136 G4ApplicationState theCurrentState;
137 G4ApplicationState thePreviousState;
138 std::vector<G4VStateDependent*> theDependentsList;
139 G4VStateDependent* theBottomDependent;
140 G4int suppressAbortion;
141 const char* msgptr;
142 G4VExceptionHandler* exceptionHandler;
143
144};
145
146#include "G4StateManager.icc"
147
148#endif
Note: See TracBrowser for help on using the repository browser.