Geant4  10.02.p03
G4VInteractorManager Class Referenceabstract

#include <G4VInteractorManager.hh>

Collaboration diagram for G4VInteractorManager:

Public Member Functions

 G4VInteractorManager ()
 
virtual ~G4VInteractorManager ()
 
void SetArguments (int, char **)
 
char ** GetArguments (int *)
 
void SetMainInteractor (G4Interactor)
 
G4Interactor GetMainInteractor ()
 
void AddDispatcher (G4DispatchFunction)
 
void RemoveDispatcher (G4DispatchFunction)
 
void AddSecondaryLoopPreAction (G4SecondaryLoopAction)
 
void AddSecondaryLoopPostAction (G4SecondaryLoopAction)
 
void AddShell (G4Interactor)
 
void RemoveShell (G4Interactor)
 
void EnableSecondaryLoop ()
 
void DisableSecondaryLoop ()
 
void SecondaryLoopPreActions ()
 
void SecondaryLoopPostActions ()
 
void RequireExitSecondaryLoop (int)
 
void DispatchEvent (void *)
 
void SecondaryLoop ()
 
int GetExitSecondaryLoopCode ()
 
void PutStringInResourceDatabase (char *)
 
virtual G4bool Inited ()=0
 
virtual void * GetEvent ()=0
 
virtual void FlushAndWaitExecution ()=0
 
void SetParentInteractor (G4Interactor)
 
G4Interactor GetParentInteractor ()
 
void SetCreatedInteractor (G4Interactor)
 
G4Interactor GetCreatedInteractor ()
 
void SetCreationString (char *)
 
char * GetCreationString ()
 

Private Attributes

int argc
 
char ** argv
 
G4Interactor mainInteractor
 
std::vector< G4DispatchFunctiondispatchers
 
std::vector< G4SecondaryLoopActionpreActions
 
std::vector< G4SecondaryLoopActionpostActions
 
std::vector< G4Interactorshells
 
G4bool secondaryLoopEnabled
 
G4bool alreadyInSecondaryLoop
 
int exitSecondaryLoop
 
G4Interactor parentInteractor
 
G4Interactor createdInteractor
 
char * creationString
 

Detailed Description

Definition at line 51 of file G4VInteractorManager.hh.

Constructor & Destructor Documentation

◆ G4VInteractorManager()

G4VInteractorManager::G4VInteractorManager ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 42 of file G4VInteractorManager.cc.

44 :argc(0)
45 ,argv(NULL)
46 ,mainInteractor(NULL)
50 ,parentInteractor(NULL)
51 ,createdInteractor(NULL)
52 ,creationString(NULL)
53 /***************************************************************************/
55 {
56 }
#define FALSE
Definition: globals.hh:52
#define TRUE
Definition: globals.hh:55

◆ ~G4VInteractorManager()

G4VInteractorManager::~G4VInteractorManager ( )
virtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 58 of file G4VInteractorManager.cc.

62 {
63  if(argv!=NULL) {
64  for(G4int argi=0;argi<argc;argi++) {
65  if(argv[argi]!=NULL) free(argv[argi]);
66  }
67  free (argv);
68  }
69  argv = NULL;
70  argc = 0;
71  dispatchers.clear();
72  preActions.clear();
73  postActions.clear();
74  shells.clear();
78 }
std::vector< G4Interactor > shells
int G4int
Definition: G4Types.hh:78
std::vector< G4SecondaryLoopAction > postActions
#define FALSE
Definition: globals.hh:52
#define TRUE
Definition: globals.hh:55
std::vector< G4SecondaryLoopAction > preActions
std::vector< G4DispatchFunction > dispatchers

Member Function Documentation

◆ AddDispatcher()

void G4VInteractorManager::AddDispatcher ( G4DispatchFunction  a_dispatcher)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 151 of file G4VInteractorManager.cc.

156 {
157  if(a_dispatcher==NULL) return;
158  if(std::find(dispatchers.begin(),dispatchers.end(),a_dispatcher)!=dispatchers.end()) return;
159  dispatchers.push_back(a_dispatcher);
160 }
std::vector< G4DispatchFunction > dispatchers

◆ AddSecondaryLoopPostAction()

void G4VInteractorManager::AddSecondaryLoopPostAction ( G4SecondaryLoopAction  a_postAction)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 215 of file G4VInteractorManager.cc.

220 {
221  if(a_postAction==NULL) return;
222  if(std::find(postActions.begin(),postActions.end(),a_postAction)!=postActions.end()) return;
223  postActions.push_back(a_postAction);
224 }
std::vector< G4SecondaryLoopAction > postActions

◆ AddSecondaryLoopPreAction()

void G4VInteractorManager::AddSecondaryLoopPreAction ( G4SecondaryLoopAction  a_preAction)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 193 of file G4VInteractorManager.cc.

198 {
199  if(a_preAction==NULL) return;
200  if(std::find(preActions.begin(),preActions.end(),a_preAction)!=preActions.end()) return;
201  preActions.push_back(a_preAction);
202 }
std::vector< G4SecondaryLoopAction > preActions

◆ AddShell()

void G4VInteractorManager::AddShell ( G4Interactor  a_shell)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 288 of file G4VInteractorManager.cc.

293 {
294  if(a_shell==NULL) return;
295  if(std::find(shells.begin(),shells.end(),a_shell)!=shells.end()) return;
296  shells.push_back(a_shell);
297 }
std::vector< G4Interactor > shells

◆ DisableSecondaryLoop()

void G4VInteractorManager::DisableSecondaryLoop ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 143 of file G4VInteractorManager.cc.

147 {
149 }
#define FALSE
Definition: globals.hh:52

◆ DispatchEvent()

void G4VInteractorManager::DispatchEvent ( void *  a_event)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 177 of file G4VInteractorManager.cc.

182 {
183  G4int dispatchern = dispatchers.size();
184  G4DispatchFunction func;
185  for(G4int count=0;count<dispatchern;count++) {
186  func = dispatchers[count];
187  if(func!=NULL) {
188  if(func(a_event)==true) return;
189  }
190  }
191 }
int G4int
Definition: G4Types.hh:78
G4bool(* G4DispatchFunction)(void *)
std::vector< G4DispatchFunction > dispatchers
Here is the caller graph for this function:

◆ EnableSecondaryLoop()

void G4VInteractorManager::EnableSecondaryLoop ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 135 of file G4VInteractorManager.cc.

139 {
141 }
#define TRUE
Definition: globals.hh:55

◆ FlushAndWaitExecution()

virtual void G4VInteractorManager::FlushAndWaitExecution ( )
pure virtual

◆ GetArguments()

char ** G4VInteractorManager::GetArguments ( int *  a_argc)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 108 of file G4VInteractorManager.cc.

113 {
114  if(a_argc!=NULL) *a_argc = argc;
115  return argv;
116 }

◆ GetCreatedInteractor()

G4Interactor G4VInteractorManager::GetCreatedInteractor ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 340 of file G4VInteractorManager.cc.

344 {
345  return createdInteractor;
346 }

◆ GetCreationString()

char * G4VInteractorManager::GetCreationString ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 357 of file G4VInteractorManager.cc.

361 {
362  return creationString;
363 }

◆ GetEvent()

virtual void* G4VInteractorManager::GetEvent ( )
pure virtual
Here is the caller graph for this function:

◆ GetExitSecondaryLoopCode()

G4int G4VInteractorManager::GetExitSecondaryLoopCode ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 280 of file G4VInteractorManager.cc.

284 {
285  return exitSecondaryLoop;
286 }

◆ GetMainInteractor()

G4Interactor G4VInteractorManager::GetMainInteractor ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 127 of file G4VInteractorManager.cc.

131 {
132  return mainInteractor;
133 }

◆ GetParentInteractor()

G4Interactor G4VInteractorManager::GetParentInteractor ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 323 of file G4VInteractorManager.cc.

327 {
328  return parentInteractor;
329 }

◆ Inited()

virtual G4bool G4VInteractorManager::Inited ( )
pure virtual
Here is the caller graph for this function:

◆ PutStringInResourceDatabase()

void G4VInteractorManager::PutStringInResourceDatabase ( char *  )

◆ RemoveDispatcher()

void G4VInteractorManager::RemoveDispatcher ( G4DispatchFunction  a_dispatcher)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 162 of file G4VInteractorManager.cc.

167 {
168  std::vector<G4DispatchFunction>::iterator it;
169  for (it = dispatchers.begin(); it != dispatchers.end(); it++) {
170  if (*it == a_dispatcher) {
171  dispatchers.erase(it);
172  break;
173  }
174  }
175 }
std::vector< G4DispatchFunction > dispatchers

◆ RemoveShell()

void G4VInteractorManager::RemoveShell ( G4Interactor  a_shell)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 299 of file G4VInteractorManager.cc.

304 {
305  std::vector<G4Interactor>::iterator it;
306  for (it = shells.begin(); it != shells.end(); it++) {
307  if (*it == a_shell) {
308  shells.erase(it);
309  break;
310  }
311  }
312 }
std::vector< G4Interactor > shells

◆ RequireExitSecondaryLoop()

void G4VInteractorManager::RequireExitSecondaryLoop ( int  a_code)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 266 of file G4VInteractorManager.cc.

271 {
272  if(secondaryLoopEnabled==FALSE) return;
273  if(a_code==0) a_code = 1;
274  exitSecondaryLoop = a_code;
276  // for(G4int count=0;count<shelln;count++) XWidgetIconify(shells[count]);
277  // if(shelln!=0) XSync(XtDisplay(topWidget),False);
278 }
#define FALSE
Definition: globals.hh:52

◆ SecondaryLoop()

void G4VInteractorManager::SecondaryLoop ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 237 of file G4VInteractorManager.cc.

241 {
242  if(Inited()==FALSE) return;
243 
244  if(secondaryLoopEnabled==FALSE) return;
245 
247  G4cout << "------------------------------------------" << G4endl;
248  G4cout << "You have entered a viewer secondary X event loop." << G4endl;
249  G4cout << "Quit it with an 'Escape' viewer button" << G4endl;
251  exitSecondaryLoop = 0;
253  //for(G4int count=0;count<shelln;count++) XWidgetUniconify(shells[count]);
254  void* event;
255  while(1) {
256  event = GetEvent();
257  if(event==NULL) break;
258  DispatchEvent (event);
259  if(exitSecondaryLoop!=0) break;
260  }
261  G4cout << "Secondary X event loop exited." << G4endl;
263  }
264 }
virtual G4bool Inited()=0
G4GLOB_DLL std::ostream G4cout
#define FALSE
Definition: globals.hh:52
#define TRUE
Definition: globals.hh:55
virtual void * GetEvent()=0
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ SecondaryLoopPostActions()

void G4VInteractorManager::SecondaryLoopPostActions ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 226 of file G4VInteractorManager.cc.

230 {
231  G4int postActionn = postActions.size();
232  for(G4int count=0;count<postActionn;count++) {
233  if(postActions[count]!=NULL) postActions[count]();
234  }
235 }
int G4int
Definition: G4Types.hh:78
std::vector< G4SecondaryLoopAction > postActions
Here is the caller graph for this function:

◆ SecondaryLoopPreActions()

void G4VInteractorManager::SecondaryLoopPreActions ( )

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 204 of file G4VInteractorManager.cc.

208 {
209  G4int preActionn = preActions.size();
210  for(G4int count=0;count<preActionn;count++) {
211  if(preActions[count]!=NULL) preActions[count]();
212  }
213 }
int G4int
Definition: G4Types.hh:78
std::vector< G4SecondaryLoopAction > preActions
Here is the caller graph for this function:

◆ SetArguments()

void G4VInteractorManager::SetArguments ( int  a_argc,
char **  a_argv 
)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 80 of file G4VInteractorManager.cc.

86 {
87  // Free previous values.
88  if(argv!=NULL) {
89  for(G4int argi=0;argi<argc;argi++) {
90  if(argv[argi]!=NULL) free(argv[argi]);
91  }
92  free(argv);
93  }
94  argv = NULL;
95  argc = 0;
96  // Set new values.
97  if(a_argc!=0) {
98  argv = (char**)malloc(a_argc * sizeof(char*));
99  if(argv!=NULL) {
100  argc = a_argc;
101  for(G4int argi=0;argi<a_argc;argi++) {
102  argv[argi] = (char*)NewString (a_argv[argi]);
103  }
104  }
105  }
106 }
int G4int
Definition: G4Types.hh:78
#define NewString(str)

◆ SetCreatedInteractor()

void G4VInteractorManager::SetCreatedInteractor ( G4Interactor  a_interactor)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 331 of file G4VInteractorManager.cc.

336 {
337  createdInteractor = a_interactor;
338 }

◆ SetCreationString()

void G4VInteractorManager::SetCreationString ( char *  a_string)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 348 of file G4VInteractorManager.cc.

353 {
354  creationString = a_string;
355 }

◆ SetMainInteractor()

void G4VInteractorManager::SetMainInteractor ( G4Interactor  a_main)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 118 of file G4VInteractorManager.cc.

123 {
124  mainInteractor = a_main;
125 }

◆ SetParentInteractor()

void G4VInteractorManager::SetParentInteractor ( G4Interactor  a_interactor)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 314 of file G4VInteractorManager.cc.

319 {
320  parentInteractor = a_interactor;
321 }

Member Data Documentation

◆ alreadyInSecondaryLoop

G4bool G4VInteractorManager::alreadyInSecondaryLoop
private

Definition at line 92 of file G4VInteractorManager.hh.

◆ argc

int G4VInteractorManager::argc
private

Definition at line 84 of file G4VInteractorManager.hh.

◆ argv

char** G4VInteractorManager::argv
private

Definition at line 85 of file G4VInteractorManager.hh.

◆ createdInteractor

G4Interactor G4VInteractorManager::createdInteractor
private

Definition at line 95 of file G4VInteractorManager.hh.

◆ creationString

char* G4VInteractorManager::creationString
private

Definition at line 96 of file G4VInteractorManager.hh.

◆ dispatchers

std::vector<G4DispatchFunction> G4VInteractorManager::dispatchers
private

Definition at line 87 of file G4VInteractorManager.hh.

◆ exitSecondaryLoop

int G4VInteractorManager::exitSecondaryLoop
private

Definition at line 93 of file G4VInteractorManager.hh.

◆ mainInteractor

G4Interactor G4VInteractorManager::mainInteractor
private

Definition at line 86 of file G4VInteractorManager.hh.

◆ parentInteractor

G4Interactor G4VInteractorManager::parentInteractor
private

Definition at line 94 of file G4VInteractorManager.hh.

◆ postActions

std::vector<G4SecondaryLoopAction> G4VInteractorManager::postActions
private

Definition at line 89 of file G4VInteractorManager.hh.

◆ preActions

std::vector<G4SecondaryLoopAction> G4VInteractorManager::preActions
private

Definition at line 88 of file G4VInteractorManager.hh.

◆ secondaryLoopEnabled

G4bool G4VInteractorManager::secondaryLoopEnabled
private

Definition at line 91 of file G4VInteractorManager.hh.

◆ shells

std::vector<G4Interactor> G4VInteractorManager::shells
private

Definition at line 90 of file G4VInteractorManager.hh.


The documentation for this class was generated from the following files: