source: snovis/trunk/source/G4Lab/cxx/State.cxx@ 291

Last change on this file since 291 was 233, checked in by barrand, 19 years ago
  • Property svn:eol-style set to native
File size: 4.4 KB
Line 
1
2// this :
3#include <G4Lab/State.h>
4
5//Geant4 :
6#include <G4StateManager.hh>
7
8// Lib :
9#include <Slash/Core/ISession.h>
10
11// OnX :
12#include <Slash/UI/IScriptManager.h>
13
14//////////////////////////////////////////////////////////////////////////////
15G4Lab::State::State(
16 Slash::UI::IScriptManager* aScriptManager
17)
18:fScriptManager(aScriptManager)
19,fIsRunning(false)
20//////////////////////////////////////////////////////////////////////////////
21//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
22{
23 //G4UImanager::GetUIpointer()->SetSession(this); //So that Pause works..
24}
25//////////////////////////////////////////////////////////////////////////////
26G4Lab::State::~State(
27)
28//////////////////////////////////////////////////////////////////////////////
29//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
30{
31 //G4UImanager::GetUIpointer()->SetSession(0);
32}
33//////////////////////////////////////////////////////////////////////////////
34bool G4Lab::State::isRunning(
35) const
36//////////////////////////////////////////////////////////////////////////////
37//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
38{
39 return fIsRunning;
40}
41//////////////////////////////////////////////////////////////////////////////
42void G4Lab::State::setRunBeginScript(
43 const std::string& aInterp
44,const std::string& aScript
45)
46//////////////////////////////////////////////////////////////////////////////
47//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
48{
49 fRunBeginInterp = aInterp;
50 fRunBeginScript = aScript;
51}
52//////////////////////////////////////////////////////////////////////////////
53void G4Lab::State::setRunEndScript(
54 const std::string& aInterp
55,const std::string& aScript
56)
57//////////////////////////////////////////////////////////////////////////////
58//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
59{
60 fRunEndInterp = aInterp;
61 fRunEndScript = aScript;
62}
63//////////////////////////////////////////////////////////////////////////////
64void G4Lab::State::setEventBeginScript(
65 const std::string& aInterp
66,const std::string& aScript
67)
68//////////////////////////////////////////////////////////////////////////////
69//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
70{
71 fEventBeginInterp = aInterp;
72 fEventBeginScript = aScript;
73}
74//////////////////////////////////////////////////////////////////////////////
75void G4Lab::State::setEventEndScript(
76 const std::string& aInterp
77,const std::string& aScript
78)
79//////////////////////////////////////////////////////////////////////////////
80//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
81{
82 fEventEndInterp = aInterp;
83 fEventEndScript = aScript;
84}
85//////////////////////////////////////////////////////////////////////////////
86G4bool G4Lab::State::Notify(
87 G4ApplicationState aRequestedState
88)
89//////////////////////////////////////////////////////////////////////////////
90//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
91{
92 G4StateManager* statM = G4StateManager::GetStateManager();
93 G4ApplicationState previousState = statM->GetPreviousState();
94
95 if(previousState==G4State_Idle && aRequestedState==G4State_GeomClosed) {
96 fIsRunning = true;
97 if(fScriptManager)
98 fScriptManager->executeScript(fRunBeginInterp,fRunBeginScript);
99
100 } else if(previousState==G4State_GeomClosed && aRequestedState==G4State_Idle) {
101
102 fIsRunning = false;
103 if(fScriptManager)
104 fScriptManager->executeScript(fRunEndInterp,fRunEndScript);
105
106 } else if(previousState==G4State_GeomClosed && aRequestedState==G4State_EventProc) {
107
108 if(fScriptManager)
109 fScriptManager->executeScript(fEventBeginInterp,fEventBeginScript);
110
111 } else if(previousState==G4State_EventProc && aRequestedState==G4State_GeomClosed) {
112
113 // End of event :
114 //fScriptManager.out().println("debug : exec \"%s\" \"%s\"",
115 // fEventEndInterp.c_str(),
116 // fEventEndScript.c_str());
117 if(fScriptManager)
118 fScriptManager->executeScript(fEventEndInterp,fEventEndScript);
119
120 }
121
122 return true;
123}
124//////////////////////////////////////////////////////////////////////////////
125void G4Lab::State::PauseSessionStart(
126 G4String
127)
128//////////////////////////////////////////////////////////////////////////////
129//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
130{
131 /*
132 if(aMessage=="G4_pause> ") {
133 WoProcessEvents ();
134 }
135 */
136}
137
138
139
140
Note: See TracBrowser for help on using the repository browser.