Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

G4VInteractorManager Class Reference

#include <G4VInteractorManager.hh>

Inheritance diagram for G4VInteractorManager:

Inheritance graph
[legend]
List of all members.

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

Constructor & Destructor Documentation

G4VInteractorManager::G4VInteractorManager  ) 
 

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

Definition at line 43 of file G4VInteractorManager.cc.

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

G4VInteractorManager::~G4VInteractorManager  )  [virtual]
 

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

Definition at line 59 of file G4VInteractorManager.cc.

References alreadyInSecondaryLoop, argc, argv, dispatchers, exitSecondaryLoop, postActions, preActions, secondaryLoopEnabled, and shells.

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


Member Function Documentation

void G4VInteractorManager::AddDispatcher G4DispatchFunction  a_dispatcher  ) 
 

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

Definition at line 152 of file G4VInteractorManager.cc.

References dispatchers, and G4DispatchFunction.

Referenced by G4Win32::G4Win32(), and G4Xt::G4Xt().

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

void G4VInteractorManager::AddSecondaryLoopPostAction G4SecondaryLoopAction  a_postAction  ) 
 

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

Definition at line 216 of file G4VInteractorManager.cc.

References G4SecondaryLoopAction, and postActions.

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

void G4VInteractorManager::AddSecondaryLoopPreAction G4SecondaryLoopAction  a_preAction  ) 
 

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

Definition at line 194 of file G4VInteractorManager.cc.

References G4SecondaryLoopAction, and preActions.

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

void G4VInteractorManager::AddShell G4Interactor  a_shell  ) 
 

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

Definition at line 289 of file G4VInteractorManager.cc.

References G4Interactor, and shells.

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

void G4VInteractorManager::DisableSecondaryLoop  ) 
 

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

Definition at line 144 of file G4VInteractorManager.cc.

References secondaryLoopEnabled.

Referenced by G4UIXm::SessionStart(), G4UIXaw::SessionStart(), G4UIWin32::SessionStart(), and G4UIQt::SessionStart().

00148 {
00149   secondaryLoopEnabled = FALSE;
00150 }

void G4VInteractorManager::DispatchEvent void *  a_event  ) 
 

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

Definition at line 178 of file G4VInteractorManager.cc.

References dispatchers, and G4DispatchFunction.

Referenced by G4UIXm::GetHelpChoice(), G4UIXaw::GetHelpChoice(), G4UIWin32::GetHelpChoice(), SecondaryLoop(), G4UIXm::SecondaryLoop(), G4UIXaw::SecondaryLoop(), G4UIWin32::SecondaryLoop(), G4UIQt::SecondaryLoop(), G4UIXm::SessionStart(), G4UIXaw::SessionStart(), and G4UIWin32::SessionStart().

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

void G4VInteractorManager::EnableSecondaryLoop  ) 
 

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

Definition at line 136 of file G4VInteractorManager.cc.

References secondaryLoopEnabled.

Referenced by G4UIXm::SessionStart(), G4UIXaw::SessionStart(), G4UIWin32::SessionStart(), and G4UIQt::SessionStart().

00140 {
00141   secondaryLoopEnabled = TRUE;
00142 }

virtual void G4VInteractorManager::FlushAndWaitExecution  )  [pure virtual]
 

Implemented in G4Qt, G4Win32, and G4Xt.

char** G4VInteractorManager::GetArguments int *   ) 
 

G4Interactor G4VInteractorManager::GetCreatedInteractor  ) 
 

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

Definition at line 341 of file G4VInteractorManager.cc.

References createdInteractor, and G4Interactor.

00345 {
00346   return createdInteractor;
00347 }

char * G4VInteractorManager::GetCreationString  ) 
 

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

Definition at line 358 of file G4VInteractorManager.cc.

References creationString.

00362 {
00363   return creationString;
00364 }

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

Implemented in G4Qt, G4Win32, and G4Xt.

Referenced by G4UIWin32::GetHelpChoice(), SecondaryLoop(), G4UIWin32::SecondaryLoop(), and G4UIWin32::SessionStart().

G4int G4VInteractorManager::GetExitSecondaryLoopCode  ) 
 

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

Definition at line 281 of file G4VInteractorManager.cc.

References exitSecondaryLoop.

00285 {
00286   return exitSecondaryLoop;
00287 }

G4Interactor G4VInteractorManager::GetMainInteractor  ) 
 

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

Definition at line 128 of file G4VInteractorManager.cc.

References G4Interactor, and mainInteractor.

Referenced by G4UIXaw::G4UIXaw(), G4UIXm::G4UIXm(), G4UIQt::SessionStart(), and G4UIQt::SessionTerminate().

00132 {
00133   return mainInteractor;
00134 }

G4Interactor G4VInteractorManager::GetParentInteractor  ) 
 

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

Definition at line 324 of file G4VInteractorManager.cc.

References G4Interactor, and parentInteractor.

00328 {
00329   return parentInteractor;
00330 }

virtual G4bool G4VInteractorManager::Inited  )  [pure virtual]
 

Implemented in G4Qt, G4Win32, and G4Xt.

Referenced by SecondaryLoop().

void G4VInteractorManager::PutStringInResourceDatabase char *   ) 
 

Reimplemented in G4Xt.

void G4VInteractorManager::RemoveDispatcher G4DispatchFunction  a_dispatcher  ) 
 

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

Definition at line 163 of file G4VInteractorManager.cc.

References dispatchers, and G4DispatchFunction.

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

void G4VInteractorManager::RemoveShell G4Interactor  a_shell  ) 
 

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

Definition at line 300 of file G4VInteractorManager.cc.

References G4Interactor, and shells.

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

void G4VInteractorManager::RequireExitSecondaryLoop int   ) 
 

void G4VInteractorManager::SecondaryLoop  ) 
 

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

Definition at line 238 of file G4VInteractorManager.cc.

References alreadyInSecondaryLoop, DispatchEvent(), exitSecondaryLoop, GetEvent(), Inited(), secondaryLoopEnabled, SecondaryLoopPostActions(), and SecondaryLoopPreActions().

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

Here is the call graph for this function:

void G4VInteractorManager::SecondaryLoopPostActions  ) 
 

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

Definition at line 227 of file G4VInteractorManager.cc.

References postActions.

Referenced by SecondaryLoop().

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

void G4VInteractorManager::SecondaryLoopPreActions  ) 
 

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

Definition at line 205 of file G4VInteractorManager.cc.

References preActions.

Referenced by SecondaryLoop().

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

void G4VInteractorManager::SetArguments int  ,
char ** 
 

Referenced by G4Qt::G4Qt(), and G4Xt::G4Xt().

void G4VInteractorManager::SetCreatedInteractor G4Interactor  a_interactor  ) 
 

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

Definition at line 332 of file G4VInteractorManager.cc.

References createdInteractor, and G4Interactor.

00337 {
00338   createdInteractor = a_interactor;
00339 }

void G4VInteractorManager::SetCreationString char *  a_string  ) 
 

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

Definition at line 349 of file G4VInteractorManager.cc.

References creationString.

00354 {
00355   creationString = a_string;
00356 }

void G4VInteractorManager::SetMainInteractor G4Interactor  a_main  ) 
 

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

Definition at line 119 of file G4VInteractorManager.cc.

References G4Interactor, and mainInteractor.

Referenced by G4Qt::G4Qt(), G4Win32::G4Win32(), and G4Xt::G4Xt().

00124 {
00125   mainInteractor = a_main;
00126 }

void G4VInteractorManager::SetParentInteractor G4Interactor  a_interactor  ) 
 

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

Definition at line 315 of file G4VInteractorManager.cc.

References G4Interactor, and parentInteractor.

00320 {
00321   parentInteractor = a_interactor;
00322 }


Member Data Documentation

G4bool G4VInteractorManager::alreadyInSecondaryLoop [private]
 

Definition at line 93 of file G4VInteractorManager.hh.

Referenced by SecondaryLoop(), and ~G4VInteractorManager().

int G4VInteractorManager::argc [private]
 

Definition at line 85 of file G4VInteractorManager.hh.

Referenced by ~G4VInteractorManager().

char** G4VInteractorManager::argv [private]
 

Definition at line 86 of file G4VInteractorManager.hh.

Referenced by ~G4VInteractorManager().

G4Interactor G4VInteractorManager::createdInteractor [private]
 

Definition at line 96 of file G4VInteractorManager.hh.

Referenced by GetCreatedInteractor(), and SetCreatedInteractor().

char* G4VInteractorManager::creationString [private]
 

Definition at line 97 of file G4VInteractorManager.hh.

Referenced by GetCreationString(), and SetCreationString().

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

Definition at line 88 of file G4VInteractorManager.hh.

Referenced by AddDispatcher(), DispatchEvent(), RemoveDispatcher(), and ~G4VInteractorManager().

int G4VInteractorManager::exitSecondaryLoop [private]
 

Definition at line 94 of file G4VInteractorManager.hh.

Referenced by GetExitSecondaryLoopCode(), SecondaryLoop(), and ~G4VInteractorManager().

G4Interactor G4VInteractorManager::mainInteractor [private]
 

Definition at line 87 of file G4VInteractorManager.hh.

Referenced by GetMainInteractor(), and SetMainInteractor().

G4Interactor G4VInteractorManager::parentInteractor [private]
 

Definition at line 95 of file G4VInteractorManager.hh.

Referenced by GetParentInteractor(), and SetParentInteractor().

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

Definition at line 90 of file G4VInteractorManager.hh.

Referenced by AddSecondaryLoopPostAction(), SecondaryLoopPostActions(), and ~G4VInteractorManager().

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

Definition at line 89 of file G4VInteractorManager.hh.

Referenced by AddSecondaryLoopPreAction(), SecondaryLoopPreActions(), and ~G4VInteractorManager().

G4bool G4VInteractorManager::secondaryLoopEnabled [private]
 

Definition at line 92 of file G4VInteractorManager.hh.

Referenced by DisableSecondaryLoop(), EnableSecondaryLoop(), SecondaryLoop(), and ~G4VInteractorManager().

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

Definition at line 91 of file G4VInteractorManager.hh.

Referenced by AddShell(), RemoveShell(), and ~G4VInteractorManager().


The documentation for this class was generated from the following files:
Generated on Fri Jun 22 11:08:02 2007 by doxygen 1.3.4