Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4UImessenger.cc
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// G4UImessenger
27//
28// Author: Makoto Asai, 1998
29// --------------------------------------------------------------------
30
31#include "G4UImessenger.hh"
32#include "G4UImanager.hh"
33#include "G4UIcommand.hh"
34#include "G4UIdirectory.hh"
35#include "G4UIcommandTree.hh"
36#include "G4ios.hh"
37#include <sstream>
38
39// --------------------------------------------------------------------
41{
42}
43
44// --------------------------------------------------------------------
46 G4bool commandsToBeBroadcasted)
47{
48 CreateDirectory(path, dsc, commandsToBeBroadcasted);
49}
50
51// --------------------------------------------------------------------
53{
54 delete baseDir;
55}
56
57// --------------------------------------------------------------------
59{
60 G4String nullString;
61 return nullString;
62}
63
64// --------------------------------------------------------------------
66{
67}
68
69// --------------------------------------------------------------------
71{
72 return this == &messenger;
73}
74
75// --------------------------------------------------------------------
77{
78 return this != &messenger;
79}
80
81// --------------------------------------------------------------------
83{
84 std::ostringstream os;
85 os << i;
86 return G4String(os.str());
87}
88
89// --------------------------------------------------------------------
91{
92 std::ostringstream os;
93 os << a;
94 return G4String(os.str());
95}
96
97// --------------------------------------------------------------------
99{
100 G4String vl = "0";
101 if(b)
102 vl = "true";
103 return vl;
104}
105
106// --------------------------------------------------------------------
108{
109 G4int vl;
110 const char* t = str;
111 std::istringstream is(t);
112 is >> vl;
113 return vl;
114}
115
116// --------------------------------------------------------------------
118{
119 G4long vl;
120 const char* t = str;
121 std::istringstream is(t);
122 is >> vl;
123 return vl;
124}
125
126// --------------------------------------------------------------------
128{
129 G4double vl;
130 const char* t = str;
131 std::istringstream is(t);
132 is >> vl;
133 return vl;
134}
135
136// --------------------------------------------------------------------
138{
139 G4String v = str;
140 v.toUpper();
141 G4bool vl = false;
142 if(v == "Y" || v == "YES" || v == "1" || v == "T" || v == "TRUE")
143 {
144 vl = true;
145 }
146 return vl;
147}
148
149// --------------------------------------------------------------------
151{
152 G4cerr << "Warning : Old style definition of G4UIcommand <"
153 << newCommand->GetCommandPath() << ">." << G4endl;
154}
155
156// --------------------------------------------------------------------
158 G4bool commandsToBeBroadcasted)
159{
161
162 G4String fullpath = path;
163 if(fullpath(fullpath.length() - 1) != '/')
164 fullpath.append("/");
165
166 G4UIcommandTree* tree = ui->GetTree()->FindCommandTree(fullpath.c_str());
167 if(tree != nullptr)
168 {
169 baseDirName = tree->GetPathName();
170 }
171 else
172 {
173 baseDir = new G4UIdirectory(fullpath.c_str(), commandsToBeBroadcasted);
174 baseDirName = fullpath;
175 baseDir->SetGuidance(dsc.c_str());
176 }
177}
double G4double
Definition: G4Types.hh:83
long G4long
Definition: G4Types.hh:87
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4String & append(const G4String &)
void toUpper()
const G4String & GetPathName() const
G4UIcommandTree * FindCommandTree(const char *commandPath)
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:136
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:179
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
G4int StoI(G4String s)
G4bool operator!=(const G4UImessenger &messenger) const
G4String ItoS(G4int i)
virtual G4String GetCurrentValue(G4UIcommand *command)
G4String BtoS(G4bool b)
G4String baseDirName
virtual ~G4UImessenger()
G4bool operator==(const G4UImessenger &messenger) const
G4long StoL(G4String s)
void AddUIcommand(G4UIcommand *newCommand)
G4String DtoS(G4double a)
void CreateDirectory(const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
virtual void SetNewValue(G4UIcommand *command, G4String newValue)
G4double StoD(G4String s)
G4UIdirectory * baseDir
G4bool StoB(G4String s)