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 | // $Id: G4UImessenger.cc,v 1.7 2006/06/29 19:09:06 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: HEAD $ |
---|
29 | // |
---|
30 | |
---|
31 | #include "G4UImessenger.hh" |
---|
32 | #include "G4UImanager.hh" |
---|
33 | #include "G4UIcommand.hh" |
---|
34 | #include "G4ios.hh" |
---|
35 | #include <sstream> |
---|
36 | |
---|
37 | |
---|
38 | G4UImessenger::G4UImessenger() { } |
---|
39 | |
---|
40 | G4UImessenger::~G4UImessenger() { } |
---|
41 | |
---|
42 | G4String G4UImessenger::GetCurrentValue(G4UIcommand*) |
---|
43 | { |
---|
44 | G4String nullString; |
---|
45 | return nullString; |
---|
46 | } |
---|
47 | |
---|
48 | void G4UImessenger::SetNewValue(G4UIcommand*,G4String) |
---|
49 | { ; } |
---|
50 | |
---|
51 | G4bool G4UImessenger::operator == (const G4UImessenger& messenger) const { |
---|
52 | return this == &messenger; |
---|
53 | } |
---|
54 | |
---|
55 | G4String G4UImessenger::ItoS(G4int i) |
---|
56 | { |
---|
57 | std::ostringstream os; |
---|
58 | os << i; |
---|
59 | return G4String(os.str()); |
---|
60 | } |
---|
61 | |
---|
62 | G4String G4UImessenger::DtoS(G4double a) |
---|
63 | { |
---|
64 | std::ostringstream os; |
---|
65 | os << a; |
---|
66 | return G4String(os.str()); |
---|
67 | } |
---|
68 | |
---|
69 | G4String G4UImessenger::BtoS(G4bool b) |
---|
70 | { |
---|
71 | G4String vl = "0"; |
---|
72 | if(b) vl = "true"; |
---|
73 | return vl; |
---|
74 | } |
---|
75 | |
---|
76 | G4int G4UImessenger::StoI(G4String s) |
---|
77 | { |
---|
78 | G4int vl; |
---|
79 | const char* t = s; |
---|
80 | std::istringstream is(t); |
---|
81 | is >> vl; |
---|
82 | return vl; |
---|
83 | } |
---|
84 | |
---|
85 | G4double G4UImessenger::StoD(G4String s) |
---|
86 | { |
---|
87 | G4double vl; |
---|
88 | const char* t = s; |
---|
89 | std::istringstream is(t); |
---|
90 | is >> vl; |
---|
91 | return vl; |
---|
92 | } |
---|
93 | |
---|
94 | G4bool G4UImessenger::StoB(G4String s) |
---|
95 | { |
---|
96 | G4String v = s; |
---|
97 | v.toUpper(); |
---|
98 | G4bool vl = false; |
---|
99 | if( v=="Y" || v=="YES" || v=="1" || v=="T" || v=="TRUE" ) |
---|
100 | { vl = true; } |
---|
101 | return vl; |
---|
102 | } |
---|
103 | |
---|
104 | |
---|
105 | void G4UImessenger::AddUIcommand(G4UIcommand * newCommand) |
---|
106 | { |
---|
107 | G4cerr << "Warning : Old style definition of G4UIcommand <" |
---|
108 | << newCommand->GetCommandPath() << ">." << G4endl; |
---|
109 | } |
---|
110 | |
---|