Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4VInteractorManager Class Referenceabstract

#include <G4VInteractorManager.hh>

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 voidGetEvent ()=0
 
virtual void FlushAndWaitExecution ()=0
 
void SetParentInteractor (G4Interactor)
 
G4Interactor GetParentInteractor ()
 
void SetCreatedInteractor (G4Interactor)
 
G4Interactor GetCreatedInteractor ()
 
void SetCreationString (char *)
 
char * GetCreationString ()
 

Detailed Description

Definition at line 51 of file G4VInteractorManager.hh.

Constructor & Destructor Documentation

G4VInteractorManager::G4VInteractorManager ( )

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

Definition at line 42 of file G4VInteractorManager.cc.

44 :argc(0)
45 ,argv(NULL)
46 ,mainInteractor(NULL)
47 ,secondaryLoopEnabled(TRUE)
48 ,alreadyInSecondaryLoop(FALSE)
49 ,exitSecondaryLoop(0)
50 ,parentInteractor(NULL)
51 ,createdInteractor(NULL)
52 ,creationString(NULL)
53 /***************************************************************************/
54 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
55 {
56 }
#define FALSE
Definition: globals.hh:52
#define TRUE
Definition: globals.hh:55
G4VInteractorManager::~G4VInteractorManager ( )
virtual

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

Definition at line 58 of file G4VInteractorManager.cc.

References FALSE, free(), and TRUE.

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();
75  secondaryLoopEnabled = TRUE;
76  alreadyInSecondaryLoop = FALSE;
77  exitSecondaryLoop = 0;
78 }
void free(void *__ptr)
Definition: hjmalloc.cc:140
int G4int
Definition: G4Types.hh:78
#define FALSE
Definition: globals.hh:52
#define TRUE
Definition: globals.hh:55

Member Function Documentation

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 }
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 }
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 }
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 }
void G4VInteractorManager::DisableSecondaryLoop ( )

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

Definition at line 143 of file G4VInteractorManager.cc.

References FALSE.

147 {
148  secondaryLoopEnabled = FALSE;
149 }
#define FALSE
Definition: globals.hh:52
void G4VInteractorManager::DispatchEvent ( void a_event)

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

Definition at line 177 of file G4VInteractorManager.cc.

Referenced by SecondaryLoop().

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 *)
void G4VInteractorManager::EnableSecondaryLoop ( )

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

Definition at line 135 of file G4VInteractorManager.cc.

References TRUE.

139 {
140  secondaryLoopEnabled = TRUE;
141 }
#define TRUE
Definition: globals.hh:55
virtual void G4VInteractorManager::FlushAndWaitExecution ( )
pure virtual
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 }
G4Interactor G4VInteractorManager::GetCreatedInteractor ( )

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

Definition at line 340 of file G4VInteractorManager.cc.

344 {
345  return createdInteractor;
346 }
char * G4VInteractorManager::GetCreationString ( )

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

Definition at line 357 of file G4VInteractorManager.cc.

361 {
362  return creationString;
363 }
virtual void* G4VInteractorManager::GetEvent ( )
pure virtual

Referenced by SecondaryLoop().

G4int G4VInteractorManager::GetExitSecondaryLoopCode ( )

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

Definition at line 280 of file G4VInteractorManager.cc.

284 {
285  return exitSecondaryLoop;
286 }
G4Interactor G4VInteractorManager::GetMainInteractor ( )

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

Definition at line 127 of file G4VInteractorManager.cc.

131 {
132  return mainInteractor;
133 }
G4Interactor G4VInteractorManager::GetParentInteractor ( )

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

Definition at line 323 of file G4VInteractorManager.cc.

327 {
328  return parentInteractor;
329 }
virtual G4bool G4VInteractorManager::Inited ( )
pure virtual

Referenced by SecondaryLoop().

void G4VInteractorManager::PutStringInResourceDatabase ( char *  )
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 }
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 }
void G4VInteractorManager::RequireExitSecondaryLoop ( int  a_code)

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

Definition at line 266 of file G4VInteractorManager.cc.

References FALSE.

271 {
272  if(secondaryLoopEnabled==FALSE) return;
273  if(a_code==0) a_code = 1;
274  exitSecondaryLoop = a_code;
275  alreadyInSecondaryLoop = FALSE;
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
void G4VInteractorManager::SecondaryLoop ( )

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

Definition at line 237 of file G4VInteractorManager.cc.

References DispatchEvent(), FALSE, G4cout, G4endl, GetEvent(), Inited(), SecondaryLoopPostActions(), SecondaryLoopPreActions(), and TRUE.

241 {
242  if(Inited()==FALSE) return;
243 
244  if(secondaryLoopEnabled==FALSE) return;
245 
246  if (alreadyInSecondaryLoop==FALSE) {
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;
250  alreadyInSecondaryLoop = TRUE;
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
void G4VInteractorManager::SecondaryLoopPostActions ( )

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

Definition at line 226 of file G4VInteractorManager.cc.

Referenced by SecondaryLoop().

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
void G4VInteractorManager::SecondaryLoopPreActions ( )

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

Definition at line 204 of file G4VInteractorManager.cc.

Referenced by SecondaryLoop().

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
void G4VInteractorManager::SetArguments ( int  a_argc,
char **  a_argv 
)

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

Definition at line 80 of file G4VInteractorManager.cc.

References free(), malloc(), and NewString.

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 }
void free(void *__ptr)
Definition: hjmalloc.cc:140
int G4int
Definition: G4Types.hh:78
#define NewString(str)
void * malloc(size_t __size)
Definition: hjmalloc.cc:30
void G4VInteractorManager::SetCreatedInteractor ( G4Interactor  a_interactor)

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

Definition at line 331 of file G4VInteractorManager.cc.

336 {
337  createdInteractor = a_interactor;
338 }
void G4VInteractorManager::SetCreationString ( char *  a_string)

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

Definition at line 348 of file G4VInteractorManager.cc.

353 {
354  creationString = a_string;
355 }
void G4VInteractorManager::SetMainInteractor ( G4Interactor  a_main)

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

Definition at line 118 of file G4VInteractorManager.cc.

123 {
124  mainInteractor = a_main;
125 }
void G4VInteractorManager::SetParentInteractor ( G4Interactor  a_interactor)

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

Definition at line 314 of file G4VInteractorManager.cc.

319 {
320  parentInteractor = a_interactor;
321 }

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