Geant4-11
Public Member Functions | Private Attributes
G4VInteractorManager Class Referenceabstract

#include <G4VInteractorManager.hh>

Inheritance diagram for G4VInteractorManager:
G4Qt G4SoQt G4Win32 G4Xt

Public Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 50 of file G4VInteractorManager.hh.

Constructor & Destructor Documentation

◆ G4VInteractorManager()

G4VInteractorManager::G4VInteractorManager ( )

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

Definition at line 41 of file G4VInteractorManager.cc.

43:argc(0)
44,argv(NULL)
45,mainInteractor(NULL)
51,creationString(NULL)
52/***************************************************************************/
54{
55}
#define TRUE
Definition: Globals.hh:27
#define FALSE
Definition: Globals.hh:23

◆ ~G4VInteractorManager()

G4VInteractorManager::~G4VInteractorManager ( )
virtual

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

Definition at line 57 of file G4VInteractorManager.cc.

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

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

Member Function Documentation

◆ AddDispatcher()

void G4VInteractorManager::AddDispatcher ( G4DispatchFunction  a_dispatcher)

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

Definition at line 150 of file G4VInteractorManager.cc.

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

References dispatchers.

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

◆ AddSecondaryLoopPostAction()

void G4VInteractorManager::AddSecondaryLoopPostAction ( G4SecondaryLoopAction  a_postAction)

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

Definition at line 214 of file G4VInteractorManager.cc.

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

References postActions.

◆ AddSecondaryLoopPreAction()

void G4VInteractorManager::AddSecondaryLoopPreAction ( G4SecondaryLoopAction  a_preAction)

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

Definition at line 192 of file G4VInteractorManager.cc.

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

References preActions.

◆ AddShell()

void G4VInteractorManager::AddShell ( G4Interactor  a_shell)

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

Definition at line 287 of file G4VInteractorManager.cc.

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

References shells.

Referenced by G4OpenGLXmViewer::GetXmConnection(), G4OpenInventorWinViewer::Initialise(), G4OpenInventorXtExtendedViewer::Initialise(), and G4OpenInventorXtViewer::Initialise().

◆ DisableSecondaryLoop()

void G4VInteractorManager::DisableSecondaryLoop ( )

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

Definition at line 142 of file G4VInteractorManager.cc.

146{
148}

References FALSE, and secondaryLoopEnabled.

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

◆ DispatchEvent()

void G4VInteractorManager::DispatchEvent ( void *  a_event)

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

Definition at line 176 of file G4VInteractorManager.cc.

181{
182 G4int dispatchern = dispatchers.size();
184 for(G4int count=0;count<dispatchern;count++) {
185 func = dispatchers[count];
186 if(func!=NULL) {
187 if(func(a_event)==true) return;
188 }
189 }
190}
G4bool(* G4DispatchFunction)(void *)

References dispatchers.

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

◆ EnableSecondaryLoop()

void G4VInteractorManager::EnableSecondaryLoop ( )

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

Definition at line 134 of file G4VInteractorManager.cc.

138{
140}

References secondaryLoopEnabled, and TRUE.

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

◆ FlushAndWaitExecution()

virtual void G4VInteractorManager::FlushAndWaitExecution ( )
pure virtual

◆ GetArguments()

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

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

Definition at line 107 of file G4VInteractorManager.cc.

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

References argc, and argv.

◆ GetCreatedInteractor()

G4Interactor G4VInteractorManager::GetCreatedInteractor ( )

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

Definition at line 339 of file G4VInteractorManager.cc.

343{
344 return createdInteractor;
345}

References createdInteractor.

◆ GetCreationString()

char * G4VInteractorManager::GetCreationString ( )

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

Definition at line 356 of file G4VInteractorManager.cc.

360{
361 return creationString;
362}

References creationString.

Referenced by G4OpenInventorWinViewer::Initialise(), G4OpenInventorXtExtendedViewer::Initialise(), and G4OpenInventorXtViewer::Initialise().

◆ GetEvent()

virtual void * G4VInteractorManager::GetEvent ( )
pure virtual

◆ GetExitSecondaryLoopCode()

G4int G4VInteractorManager::GetExitSecondaryLoopCode ( )

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

Definition at line 279 of file G4VInteractorManager.cc.

283{
284 return exitSecondaryLoop;
285}

References exitSecondaryLoop.

◆ GetMainInteractor()

G4Interactor G4VInteractorManager::GetMainInteractor ( )

◆ GetParentInteractor()

G4Interactor G4VInteractorManager::GetParentInteractor ( )

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

Definition at line 322 of file G4VInteractorManager.cc.

326{
327 return parentInteractor;
328}

References parentInteractor.

Referenced by G4OpenInventorWinViewer::Initialise(), G4OpenInventorXtExtendedViewer::Initialise(), and G4OpenInventorXtViewer::Initialise().

◆ Inited()

virtual G4bool G4VInteractorManager::Inited ( )
pure virtual

Implemented in G4Qt, G4Win32, G4Xt, and G4SoQt.

Referenced by SecondaryLoop().

◆ PutStringInResourceDatabase()

void G4VInteractorManager::PutStringInResourceDatabase ( char *  )

◆ RemoveDispatcher()

void G4VInteractorManager::RemoveDispatcher ( G4DispatchFunction  a_dispatcher)

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

Definition at line 161 of file G4VInteractorManager.cc.

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

References dispatchers.

◆ RemoveShell()

void G4VInteractorManager::RemoveShell ( G4Interactor  a_shell)

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

Definition at line 298 of file G4VInteractorManager.cc.

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

References shells.

Referenced by G4OpenGLXmViewer::~G4OpenGLXmViewer(), G4OpenInventorWinViewer::~G4OpenInventorWinViewer(), G4OpenInventorXtExtendedViewer::~G4OpenInventorXtExtendedViewer(), and G4OpenInventorXtViewer::~G4OpenInventorXtViewer().

◆ RequireExitSecondaryLoop()

void G4VInteractorManager::RequireExitSecondaryLoop ( int  a_code)

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

Definition at line 265 of file G4VInteractorManager.cc.

270{
271 if(secondaryLoopEnabled==FALSE) return;
272 if(a_code==0) a_code = 1;
273 exitSecondaryLoop = a_code;
275 // for(G4int count=0;count<shelln;count++) XWidgetIconify(shells[count]);
276 // if(shelln!=0) XSync(XtDisplay(topWidget),False);
277}

References alreadyInSecondaryLoop, exitSecondaryLoop, FALSE, and secondaryLoopEnabled.

Referenced by G4OpenInventorViewer::Escape().

◆ SecondaryLoop()

void G4VInteractorManager::SecondaryLoop ( )
virtual

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

Reimplemented in G4SoQt.

Definition at line 236 of file G4VInteractorManager.cc.

240{
241 if(Inited()==FALSE) return;
242
243 if(secondaryLoopEnabled==FALSE) return;
244
246 G4cout << "------------------------------------------" << G4endl;
247 G4cout << "You have entered a viewer secondary X event loop." << G4endl;
248 G4cout << "Quit it with an 'Escape' viewer button" << G4endl;
252 //for(G4int count=0;count<shelln;count++) XWidgetUniconify(shells[count]);
253 void* event;
254 while(1) {
255 event = GetEvent();
256 if(event==NULL) break;
257 DispatchEvent (event);
258 if(exitSecondaryLoop!=0) break;
259 }
260 G4cout << "Secondary X event loop exited." << G4endl;
262 }
263}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
virtual void * GetEvent()=0
virtual G4bool Inited()=0

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

◆ SecondaryLoopPostActions()

void G4VInteractorManager::SecondaryLoopPostActions ( )

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

Definition at line 225 of file G4VInteractorManager.cc.

229{
230 G4int postActionn = postActions.size();
231 for(G4int count=0;count<postActionn;count++) {
232 if(postActions[count]!=NULL) postActions[count]();
233 }
234}

References postActions.

Referenced by SecondaryLoop().

◆ SecondaryLoopPreActions()

void G4VInteractorManager::SecondaryLoopPreActions ( )

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

Definition at line 203 of file G4VInteractorManager.cc.

207{
208 G4int preActionn = preActions.size();
209 for(G4int count=0;count<preActionn;count++) {
210 if(preActions[count]!=NULL) preActions[count]();
211 }
212}

References preActions.

Referenced by SecondaryLoop().

◆ SetArguments()

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

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

Definition at line 79 of file G4VInteractorManager.cc.

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

References argc, argv, free, and NewString.

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

◆ SetCreatedInteractor()

void G4VInteractorManager::SetCreatedInteractor ( G4Interactor  a_interactor)

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

Definition at line 330 of file G4VInteractorManager.cc.

335{
336 createdInteractor = a_interactor;
337}

References createdInteractor.

Referenced by G4OpenInventorQtViewer::Initialise(), G4OpenInventorWinViewer::Initialise(), G4OpenInventorXtExtendedViewer::Initialise(), and G4OpenInventorXtViewer::Initialise().

◆ SetCreationString()

void G4VInteractorManager::SetCreationString ( char *  a_string)

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

Definition at line 347 of file G4VInteractorManager.cc.

352{
353 creationString = a_string;
354}

References creationString.

◆ SetMainInteractor()

void G4VInteractorManager::SetMainInteractor ( G4Interactor  a_main)

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

Definition at line 117 of file G4VInteractorManager.cc.

122{
123 mainInteractor = a_main;
124}

References mainInteractor.

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

◆ SetParentInteractor()

void G4VInteractorManager::SetParentInteractor ( G4Interactor  a_interactor)

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

Definition at line 313 of file G4VInteractorManager.cc.

318{
319 parentInteractor = a_interactor;
320}

References parentInteractor.

Field Documentation

◆ alreadyInSecondaryLoop

G4bool G4VInteractorManager::alreadyInSecondaryLoop
private

◆ argc

int G4VInteractorManager::argc
private

Definition at line 83 of file G4VInteractorManager.hh.

Referenced by GetArguments(), SetArguments(), and ~G4VInteractorManager().

◆ argv

char** G4VInteractorManager::argv
private

Definition at line 84 of file G4VInteractorManager.hh.

Referenced by GetArguments(), SetArguments(), and ~G4VInteractorManager().

◆ createdInteractor

G4Interactor G4VInteractorManager::createdInteractor
private

Definition at line 94 of file G4VInteractorManager.hh.

Referenced by GetCreatedInteractor(), and SetCreatedInteractor().

◆ creationString

char* G4VInteractorManager::creationString
private

Definition at line 95 of file G4VInteractorManager.hh.

Referenced by GetCreationString(), and SetCreationString().

◆ dispatchers

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

◆ exitSecondaryLoop

int G4VInteractorManager::exitSecondaryLoop
private

◆ mainInteractor

G4Interactor G4VInteractorManager::mainInteractor
private

Definition at line 85 of file G4VInteractorManager.hh.

Referenced by GetMainInteractor(), and SetMainInteractor().

◆ parentInteractor

G4Interactor G4VInteractorManager::parentInteractor
private

Definition at line 93 of file G4VInteractorManager.hh.

Referenced by GetParentInteractor(), and SetParentInteractor().

◆ postActions

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

◆ preActions

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

◆ secondaryLoopEnabled

G4bool G4VInteractorManager::secondaryLoopEnabled
private

◆ shells

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

Definition at line 89 of file G4VInteractorManager.hh.

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


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