Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VInteractorManager Class Referenceabstract

#include <G4VInteractorManager.hh>

+ Inheritance 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 *)
 
virtual 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::G4VInteractorManager ( )

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

Definition at line 40 of file G4VInteractorManager.cc.

41 : argc(0),
42 argv(nullptr),
43 mainInteractor(nullptr),
44 secondaryLoopEnabled(true),
45 alreadyInSecondaryLoop(false),
46 exitSecondaryLoop(0),
47 parentInteractor(nullptr),
48 createdInteractor(nullptr),
49 creationString(nullptr)
50/***************************************************************************/
51/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
52{}

◆ ~G4VInteractorManager()

G4VInteractorManager::~G4VInteractorManager ( )
virtual

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

Definition at line 54 of file G4VInteractorManager.cc.

57{
58 if (argv != nullptr) {
59 for (G4int argi = 0; argi < argc; ++argi) {
60 if (argv[argi] != nullptr) free(argv[argi]);
61 }
62 free(argv);
63 }
64 argv = nullptr;
65 argc = 0;
66 dispatchers.clear();
67 preActions.clear();
68 postActions.clear();
69 shells.clear();
70 secondaryLoopEnabled = true;
71 alreadyInSecondaryLoop = false;
72 exitSecondaryLoop = 0;
73}
int G4int
Definition G4Types.hh:85

Member Function Documentation

◆ AddDispatcher()

void G4VInteractorManager::AddDispatcher ( G4DispatchFunction a_dispatcher)

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

Definition at line 136 of file G4VInteractorManager.cc.

139{
140 if (a_dispatcher == nullptr) return;
141 if (std::find(dispatchers.cbegin(), dispatchers.cend(), a_dispatcher) != dispatchers.cend())
142 return;
143 dispatchers.push_back(a_dispatcher);
144}

◆ AddSecondaryLoopPostAction()

void G4VInteractorManager::AddSecondaryLoopPostAction ( G4SecondaryLoopAction a_postAction)

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

Definition at line 192 of file G4VInteractorManager.cc.

195{
196 if (a_postAction == nullptr) return;
197 if (std::find(postActions.cbegin(), postActions.cend(), a_postAction) != postActions.cend())
198 return;
199 postActions.push_back(a_postAction);
200}

◆ AddSecondaryLoopPreAction()

void G4VInteractorManager::AddSecondaryLoopPreAction ( G4SecondaryLoopAction a_preAction)

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

Definition at line 173 of file G4VInteractorManager.cc.

176{
177 if (a_preAction == nullptr) return;
178 if (std::find(preActions.cbegin(), preActions.cend(), a_preAction) != preActions.cend()) return;
179 preActions.push_back(a_preAction);
180}

◆ AddShell()

void G4VInteractorManager::AddShell ( G4Interactor a_shell)

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

Definition at line 257 of file G4VInteractorManager.cc.

260{
261 if (a_shell == nullptr) return;
262 if (std::find(shells.cbegin(), shells.cend(), a_shell) != shells.cend()) return;
263 shells.push_back(a_shell);
264}

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

◆ DisableSecondaryLoop()

void G4VInteractorManager::DisableSecondaryLoop ( )

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

Definition at line 129 of file G4VInteractorManager.cc.

132{
133 secondaryLoopEnabled = false;
134}

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

◆ DispatchEvent()

void G4VInteractorManager::DispatchEvent ( void * a_event)

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

Definition at line 159 of file G4VInteractorManager.cc.

162{
163 std::size_t dispatchern = dispatchers.size();
165 for (std::size_t count = 0; count < dispatchern; ++count) {
166 func = dispatchers[count];
167 if (func != nullptr) {
168 if (func(a_event)) return;
169 }
170 }
171}
G4bool(*)(void *) G4DispatchFunction

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

◆ EnableSecondaryLoop()

void G4VInteractorManager::EnableSecondaryLoop ( )

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

Definition at line 122 of file G4VInteractorManager.cc.

125{
126 secondaryLoopEnabled = true;
127}

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

◆ FlushAndWaitExecution()

virtual void G4VInteractorManager::FlushAndWaitExecution ( )
pure virtual

◆ GetArguments()

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

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

Definition at line 100 of file G4VInteractorManager.cc.

103{
104 if (a_argc != nullptr) *a_argc = argc;
105 return argv;
106}

◆ GetCreatedInteractor()

G4Interactor G4VInteractorManager::GetCreatedInteractor ( )

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

Definition at line 300 of file G4VInteractorManager.cc.

303{
304 return createdInteractor;
305}

◆ GetCreationString()

char * G4VInteractorManager::GetCreationString ( )

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

Definition at line 314 of file G4VInteractorManager.cc.

317{
318 return creationString;
319}

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

◆ GetEvent()

virtual void * G4VInteractorManager::GetEvent ( )
pure virtual

Implemented in G4Qt, G4SoQt, G4Win32, and G4Xt.

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

◆ GetExitSecondaryLoopCode()

G4int G4VInteractorManager::GetExitSecondaryLoopCode ( )

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

Definition at line 250 of file G4VInteractorManager.cc.

253{
254 return exitSecondaryLoop;
255}

◆ GetMainInteractor()

G4Interactor G4VInteractorManager::GetMainInteractor ( )

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

Definition at line 115 of file G4VInteractorManager.cc.

118{
119 return mainInteractor;
120}

Referenced by G4UIQt::G4UIQt(), G4UIXm::G4UIXm(), G4OpenGLXmViewer::GetXmConnection(), G4ToolsSGQtGLES::Initialise(), G4ToolsSGQtZB::Initialise(), session::session(), G4UIQt::SessionStart(), and G4UIQt::SessionTerminate().

◆ GetParentInteractor()

G4Interactor G4VInteractorManager::GetParentInteractor ( )

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

Definition at line 286 of file G4VInteractorManager.cc.

289{
290 return parentInteractor;
291}

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

◆ Inited()

virtual G4bool G4VInteractorManager::Inited ( )
pure virtual

Implemented in G4Qt, G4SoQt, G4Win32, and G4Xt.

Referenced by SecondaryLoop().

◆ PutStringInResourceDatabase()

void G4VInteractorManager::PutStringInResourceDatabase ( char * )

◆ RemoveDispatcher()

void G4VInteractorManager::RemoveDispatcher ( G4DispatchFunction a_dispatcher)

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

Definition at line 146 of file G4VInteractorManager.cc.

149{
150 std::vector<G4DispatchFunction>::iterator it;
151 for (it = dispatchers.begin(); it != dispatchers.end(); ++it) {
152 if (*it == a_dispatcher) {
153 dispatchers.erase(it);
154 break;
155 }
156 }
157}

◆ RemoveShell()

void G4VInteractorManager::RemoveShell ( G4Interactor a_shell)

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

Definition at line 266 of file G4VInteractorManager.cc.

269{
270 std::vector<G4Interactor>::iterator it;
271 for (it = shells.begin(); it != shells.end(); ++it) {
272 if (*it == a_shell) {
273 shells.erase(it);
274 break;
275 }
276 }
277}

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

◆ RequireExitSecondaryLoop()

void G4VInteractorManager::RequireExitSecondaryLoop ( int a_code)

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

Definition at line 240 of file G4VInteractorManager.cc.

243{
244 if (! secondaryLoopEnabled) return;
245 if (a_code == 0) a_code = 1;
246 exitSecondaryLoop = a_code;
247 alreadyInSecondaryLoop = false;
248}

Referenced by G4OpenInventorViewer::Escape().

◆ SecondaryLoop()

void G4VInteractorManager::SecondaryLoop ( )
virtual

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

Reimplemented in G4SoQt.

Definition at line 212 of file G4VInteractorManager.cc.

215{
216 if (! Inited()) return;
217
218 if (! secondaryLoopEnabled) return;
219
220 if (! alreadyInSecondaryLoop) {
221 G4cout << "------------------------------------------" << G4endl;
222 G4cout << "You have entered a viewer secondary X event loop." << G4endl;
223 G4cout << "Quit it with an 'Escape' viewer button" << G4endl;
224 alreadyInSecondaryLoop = true;
225 exitSecondaryLoop = 0;
227 // for(G4int count=0;count<shelln;count++) XWidgetUniconify(shells[count]);
228 void* event;
229 while (true) {
230 event = GetEvent();
231 if (event == nullptr) break;
232 DispatchEvent(event);
233 if (exitSecondaryLoop != 0) break;
234 }
235 G4cout << "Secondary X event loop exited." << G4endl;
237 }
238}
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
virtual void * GetEvent()=0
virtual G4bool Inited()=0

◆ SecondaryLoopPostActions()

void G4VInteractorManager::SecondaryLoopPostActions ( )

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

Definition at line 202 of file G4VInteractorManager.cc.

205{
206 std::size_t postActionn = postActions.size();
207 for (std::size_t count = 0; count < postActionn; ++count) {
208 if (postActions[count] != nullptr) postActions[count]();
209 }
210}

Referenced by SecondaryLoop().

◆ SecondaryLoopPreActions()

void G4VInteractorManager::SecondaryLoopPreActions ( )

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

Definition at line 182 of file G4VInteractorManager.cc.

185{
186 std::size_t preActionn = preActions.size();
187 for (std::size_t count = 0; count < preActionn; ++count) {
188 if (preActions[count] != nullptr) preActions[count]();
189 }
190}

Referenced by SecondaryLoop().

◆ SetArguments()

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

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

Definition at line 75 of file G4VInteractorManager.cc.

78{
79 // Free previous values.
80 if (argv != nullptr) {
81 for (G4int argi = 0; argi < argc; ++argi) {
82 if (argv[argi] != nullptr) free(argv[argi]);
83 }
84 free(argv);
85 }
86 argv = nullptr;
87 argc = 0;
88 // Set new values.
89 if (a_argc != 0) {
90 argv = (char**)malloc(a_argc * sizeof(char*));
91 if (argv != nullptr) {
92 argc = a_argc;
93 for (G4int argi = 0; argi < a_argc; ++argi) {
94 argv[argi] = (char*)NewString(a_argv[argi]);
95 }
96 }
97 }
98}
#define NewString(str)

◆ SetCreatedInteractor()

void G4VInteractorManager::SetCreatedInteractor ( G4Interactor a_interactor)

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

Definition at line 293 of file G4VInteractorManager.cc.

296{
297 createdInteractor = a_interactor;
298}

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

◆ SetCreationString()

void G4VInteractorManager::SetCreationString ( char * a_string)

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

Definition at line 307 of file G4VInteractorManager.cc.

310{
311 creationString = a_string;
312}

◆ SetMainInteractor()

void G4VInteractorManager::SetMainInteractor ( G4Interactor a_main)

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

Definition at line 108 of file G4VInteractorManager.cc.

111{
112 mainInteractor = a_main;
113}

◆ SetParentInteractor()

void G4VInteractorManager::SetParentInteractor ( G4Interactor a_interactor)

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

Definition at line 279 of file G4VInteractorManager.cc.

282{
283 parentInteractor = a_interactor;
284}

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