G4VInteractorManager Class Reference

#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 void * GetEvent ()=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.

00044 :argc(0)
00045 ,argv(NULL)
00046 ,mainInteractor(NULL)
00047 ,secondaryLoopEnabled(TRUE)
00048 ,alreadyInSecondaryLoop(FALSE)
00049 ,exitSecondaryLoop(0)
00050 ,parentInteractor(NULL)
00051 ,createdInteractor(NULL)
00052 ,creationString(NULL)
00053 /***************************************************************************/
00055 {
00056 }

G4VInteractorManager::~G4VInteractorManager (  )  [virtual]

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

Definition at line 58 of file G4VInteractorManager.cc.

References FALSE, and TRUE.

00062 {
00063   if(argv!=NULL) {
00064     for(G4int argi=0;argi<argc;argi++) {
00065       if(argv[argi]!=NULL) free(argv[argi]);
00066     }
00067     free (argv);
00068   }
00069   argv = NULL;
00070   argc = 0;
00071   dispatchers.clear();
00072   preActions.clear();
00073   postActions.clear();
00074   shells.clear();
00075   secondaryLoopEnabled = TRUE;
00076   alreadyInSecondaryLoop = FALSE;
00077   exitSecondaryLoop = 0;
00078 }


Member Function Documentation

void G4VInteractorManager::AddDispatcher ( G4DispatchFunction  a_dispatcher  ) 

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

Definition at line 151 of file G4VInteractorManager.cc.

00156 {
00157   if(a_dispatcher==NULL) return;
00158   if(std::find(dispatchers.begin(),dispatchers.end(),a_dispatcher)!=dispatchers.end()) return;
00159   dispatchers.push_back(a_dispatcher);
00160 }

void G4VInteractorManager::AddSecondaryLoopPostAction ( G4SecondaryLoopAction  a_postAction  ) 

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

Definition at line 215 of file G4VInteractorManager.cc.

00220 {
00221   if(a_postAction==NULL) return;
00222   if(std::find(postActions.begin(),postActions.end(),a_postAction)!=postActions.end()) return;
00223   postActions.push_back(a_postAction);
00224 }

void G4VInteractorManager::AddSecondaryLoopPreAction ( G4SecondaryLoopAction  a_preAction  ) 

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

Definition at line 193 of file G4VInteractorManager.cc.

00198 {
00199   if(a_preAction==NULL) return;
00200   if(std::find(preActions.begin(),preActions.end(),a_preAction)!=preActions.end()) return;
00201   preActions.push_back(a_preAction);
00202 }

void G4VInteractorManager::AddShell ( G4Interactor  a_shell  ) 

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

Definition at line 288 of file G4VInteractorManager.cc.

00293 {
00294   if(a_shell==NULL) return;
00295   if(std::find(shells.begin(),shells.end(),a_shell)!=shells.end()) return;
00296   shells.push_back(a_shell);
00297 }

void G4VInteractorManager::DisableSecondaryLoop (  ) 

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

Definition at line 143 of file G4VInteractorManager.cc.

References FALSE.

00147 {
00148   secondaryLoopEnabled = FALSE;
00149 }

void G4VInteractorManager::DispatchEvent ( void *  a_event  ) 

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

Definition at line 177 of file G4VInteractorManager.cc.

Referenced by SecondaryLoop().

00182 {
00183   G4int dispatchern = dispatchers.size();
00184   G4DispatchFunction func;
00185   for(G4int count=0;count<dispatchern;count++) {
00186     func = dispatchers[count];
00187     if(func!=NULL) {
00188       if(func(a_event)==true) return;
00189     }
00190   }
00191 }

void G4VInteractorManager::EnableSecondaryLoop (  ) 

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

Definition at line 135 of file G4VInteractorManager.cc.

References TRUE.

00139 {
00140   secondaryLoopEnabled = TRUE;
00141 }

virtual void G4VInteractorManager::FlushAndWaitExecution (  )  [pure virtual]

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

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

Definition at line 108 of file G4VInteractorManager.cc.

00113 {
00114   if(a_argc!=NULL) *a_argc = argc;
00115   return argv;
00116 }

G4Interactor G4VInteractorManager::GetCreatedInteractor (  ) 

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

Definition at line 340 of file G4VInteractorManager.cc.

00344 {
00345   return createdInteractor;
00346 }

char * G4VInteractorManager::GetCreationString (  ) 

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

Definition at line 357 of file G4VInteractorManager.cc.

00361 {
00362   return creationString;
00363 }

virtual void* G4VInteractorManager::GetEvent (  )  [pure virtual]

Referenced by SecondaryLoop().

G4int G4VInteractorManager::GetExitSecondaryLoopCode (  ) 

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

Definition at line 280 of file G4VInteractorManager.cc.

00284 {
00285   return exitSecondaryLoop;
00286 }

G4Interactor G4VInteractorManager::GetMainInteractor (  ) 

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

Definition at line 127 of file G4VInteractorManager.cc.

00131 {
00132   return mainInteractor;
00133 }

G4Interactor G4VInteractorManager::GetParentInteractor (  ) 

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

Definition at line 323 of file G4VInteractorManager.cc.

00327 {
00328   return parentInteractor;
00329 }

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.

00167 {
00168   std::vector<G4DispatchFunction>::iterator it;
00169   for (it = dispatchers.begin(); it != dispatchers.end(); it++) {
00170     if (*it == a_dispatcher) {
00171       dispatchers.erase(it);
00172       break;
00173     }
00174   }
00175 }

void G4VInteractorManager::RemoveShell ( G4Interactor  a_shell  ) 

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

Definition at line 299 of file G4VInteractorManager.cc.

00304 {  
00305   std::vector<G4Interactor>::iterator it;
00306   for (it = shells.begin(); it != shells.end(); it++) {
00307     if (*it == a_shell) {
00308       shells.erase(it);
00309       break;
00310     }
00311   }
00312 }

void G4VInteractorManager::RequireExitSecondaryLoop ( int  a_code  ) 

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

Definition at line 266 of file G4VInteractorManager.cc.

References FALSE.

00271 {
00272   if(secondaryLoopEnabled==FALSE) return;
00273   if(a_code==0)            a_code = 1;
00274   exitSecondaryLoop        = a_code;
00275   alreadyInSecondaryLoop   = FALSE;
00276   // for(G4int count=0;count<shelln;count++) XWidgetIconify(shells[count]);
00277   // if(shelln!=0)            XSync(XtDisplay(topWidget),False);
00278 }

void G4VInteractorManager::SecondaryLoop (  ) 

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

Definition at line 237 of file G4VInteractorManager.cc.

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

00241 {
00242   if(Inited()==FALSE) return;
00243 
00244   if(secondaryLoopEnabled==FALSE) return;
00245   
00246   if (alreadyInSecondaryLoop==FALSE) {
00247     G4cout << "------------------------------------------" << G4endl;
00248     G4cout << "You have entered a viewer secondary X event loop." << G4endl;
00249     G4cout << "Quit it with an 'Escape' viewer button" << G4endl;
00250     alreadyInSecondaryLoop   = TRUE;
00251     exitSecondaryLoop        = 0;
00252     SecondaryLoopPreActions  ();
00253     //for(G4int count=0;count<shelln;count++) XWidgetUniconify(shells[count]);
00254     void*                    event;
00255     while(1) {
00256       event = GetEvent();
00257       if(event==NULL) break;
00258       DispatchEvent  (event);
00259       if(exitSecondaryLoop!=0) break;
00260     }
00261     G4cout << "Secondary X event loop exited." << G4endl;
00262     SecondaryLoopPostActions ();
00263     }
00264 }

void G4VInteractorManager::SecondaryLoopPostActions (  ) 

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

Definition at line 226 of file G4VInteractorManager.cc.

Referenced by SecondaryLoop().

00230 {
00231   G4int postActionn = postActions.size();
00232   for(G4int count=0;count<postActionn;count++) {
00233     if(postActions[count]!=NULL) postActions[count]();
00234   }
00235 }

void G4VInteractorManager::SecondaryLoopPreActions (  ) 

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

Definition at line 204 of file G4VInteractorManager.cc.

Referenced by SecondaryLoop().

00208 {
00209   G4int preActionn = preActions.size();
00210   for(G4int count=0;count<preActionn;count++) {
00211     if(preActions[count]!=NULL) preActions[count]();
00212   }
00213 }

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

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

Definition at line 80 of file G4VInteractorManager.cc.

References NewString.

00086 {
00087   // Free previous values.
00088   if(argv!=NULL) {
00089     for(G4int argi=0;argi<argc;argi++) {
00090       if(argv[argi]!=NULL) free(argv[argi]);
00091     }
00092     free(argv);
00093   }
00094   argv = NULL;
00095   argc = 0;
00096   // Set new values.
00097   if(a_argc!=0) {
00098     argv = (char**)malloc(a_argc * sizeof(char*));
00099     if(argv!=NULL) {
00100       argc = a_argc;
00101       for(G4int argi=0;argi<a_argc;argi++) {
00102         argv[argi] = (char*)NewString (a_argv[argi]);
00103       }
00104     }
00105   }
00106 }

void G4VInteractorManager::SetCreatedInteractor ( G4Interactor  a_interactor  ) 

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

Definition at line 331 of file G4VInteractorManager.cc.

00336 {
00337   createdInteractor = a_interactor;
00338 }

void G4VInteractorManager::SetCreationString ( char *  a_string  ) 

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

Definition at line 348 of file G4VInteractorManager.cc.

00353 {
00354   creationString = a_string;
00355 }

void G4VInteractorManager::SetMainInteractor ( G4Interactor  a_main  ) 

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

Definition at line 118 of file G4VInteractorManager.cc.

00123 {
00124   mainInteractor = a_main;
00125 }

void G4VInteractorManager::SetParentInteractor ( G4Interactor  a_interactor  ) 

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

Definition at line 314 of file G4VInteractorManager.cc.

00319 {
00320   parentInteractor = a_interactor;
00321 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:44 2013 for Geant4 by  doxygen 1.4.7