Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VisCommandsListManager.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// Jane Tinslay, John Allison, Joseph Perl October 2005
28//
29// Class Description:
30// Templated list manager commands which control list manager listing and
31// selection.
32// Class Description - End:
33
34#ifndef G4VISCOMMANDLISTMANAGER_HH
35#define G4VISCOMMANDLISTMANAGER_HH
36
37#include "G4UImessenger.hh"
38#include "G4String.hh"
39#include "G4UIcmdWithAString.hh"
40#include "G4UIcommand.hh"
41
42template <typename Manager>
44
45public: // With description
46
47 G4VisCommandListManagerList(Manager*, const G4String& placement);
48 // Input list manager and command placement
49
51
53 void SetNewValue(G4UIcommand* command, G4String newValue);
54
55 G4String Placement() const;
56
57private:
58
59 // Data members
60 Manager* fpManager;
61 G4String fPlacement;
62
63 G4UIcmdWithAString* fpCommand;
64
65};
66
67// List command
68template <typename Manager>
70 :fpManager(manager)
71 ,fPlacement(placement)
72{
73 G4String command = Placement()+"/list";
74
75 fpCommand = new G4UIcmdWithAString(command, this);
76 fpCommand->SetGuidance("List objects registered with list manager");
77 fpCommand->SetParameterName("name", true);
78}
79
80template <typename Manager>
82{
83 delete fpCommand;
84}
85
86template <typename Manager>
89{
90 return fPlacement;
91}
92
93template <typename Manager>
96{
97 return "";
98}
99
100template <typename Manager>
102{
103 G4cout<<"Listing models available in "<<Placement()<<G4endl;
104
105 assert (0 != fpManager);
106 fpManager->Print(G4cout, name);
107}
108
109//Select command
110template <typename Manager>
112
113public: // With description
114
115 G4VisCommandListManagerSelect(Manager*, const G4String& placement);
116 // Input list manager and command placement
117
119
121 void SetNewValue (G4UIcommand* command, G4String newValue);
122
123private:
124
125 Manager* fpManager;
126 G4String fPlacement;
127
128 G4UIcmdWithAString* fpCommand;
129
130};
131
132template <typename Manager>
134 :fpManager(manager)
135 ,fPlacement(placement)
136{
137 G4String command = placement+"/select";
138 G4String guidance = "Select created object";
139
140 fpCommand = new G4UIcmdWithAString(command, this);
141 fpCommand->SetGuidance(guidance);
142 fpCommand->SetParameterName("name", false);
143}
144
145template <typename Manager>
147{
148 delete fpCommand;
149}
150
151template <typename Manager>
154{
155 return "";
156}
157
158template <typename Manager>
160{
161 assert (0 != fpManager);
162 fpManager->SetCurrent(name);
163}
164
165// Mode command
166template <typename Manager>
168
169public: // With description
170
171 G4VisCommandManagerMode(Manager*, const G4String& placement);
172
173 virtual ~G4VisCommandManagerMode();
174
176 void SetNewValue (G4UIcommand* command, G4String newValue);
177
178private:
179
180 Manager* fpManager;
181 G4String fPlacement;
182
183 G4UIcmdWithAString* fpCommand;
184
185};
186template <typename Manager>
188 :fpManager(manager)
189 ,fPlacement(placement)
190{
191 G4String command = fPlacement+"/mode";
192
193 fpCommand = new G4UIcmdWithAString(command, this);
194 fpCommand->SetGuidance("Set mode of operation");
195 fpCommand->SetParameterName("mode", false);
196 fpCommand->SetCandidates("soft hard");
197}
198
199template <typename Manager>
201{
202 delete fpCommand;
203}
204
205template <typename Manager>
208{
209 return "";
210}
211
212template <typename Manager>
214{
215 assert (0 != fpManager);
216 fpManager->SetMode(name);
218 if (visManager) visManager->NotifyHandlers();
219}
220
221#endif
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
void SetCandidates(const char *candidateList)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:157
virtual void NotifyHandlers()
static G4VVisManager * GetConcreteInstance()
G4String GetCurrentValue(G4UIcommand *)
G4VisCommandListManagerList(Manager *, const G4String &placement)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4VisCommandListManagerSelect(Manager *, const G4String &placement)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *)
G4VisCommandManagerMode(Manager *, const G4String &placement)
void SetNewValue(G4UIcommand *command, G4String newValue)