Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ConversionUtils Namespace Reference

Functions

template<typename Value >
G4bool Convert (const G4String &myInput, Value &output)
 
template<>
G4bool Convert (const G4String &myInput, G4DimensionedDouble &output)
 
template<>
G4bool Convert (const G4String &myInput, G4DimensionedThreeVector &output)
 
template<>
G4bool Convert (const G4String &myInput, G4ThreeVector &output)
 
template<typename Value >
G4bool Convert (const G4String &myInput, Value &value1, Value &value2)
 
template<>
G4bool Convert (const G4String &myInput, G4DimensionedDouble &min, G4DimensionedDouble &max)
 
template<>
G4bool Convert (const G4String &myInput, G4DimensionedThreeVector &min, G4DimensionedThreeVector &max)
 
template<>
G4bool Convert (const G4String &myInput, G4ThreeVector &min, G4ThreeVector &max)
 

Function Documentation

template<typename Value >
G4bool G4ConversionUtils::Convert ( const G4String myInput,
Value &  output 
)

Definition at line 46 of file G4ConversionUtils.hh.

47  {
48  G4String input(myInput);
49  input = input.strip();
50 
51  std::istringstream is(input);
52  char tester;
53 
54  return ((is >> output) && !is.get(tester));
55  }

Here is the call graph for this function:

Here is the caller graph for this function:

template<>
G4bool G4ConversionUtils::Convert ( const G4String myInput,
G4DimensionedDouble output 
)
inline

Definition at line 59 of file G4ConversionUtils.hh.

60  {
61  G4String input(myInput);
62  input = input.strip();
63 
65  G4String unit;
66 
67  std::istringstream is(input);
68  char tester;
69 
70  if (!(is >> value >> unit) || is.get(tester)) return false;
71 
72  output = G4DimensionedDouble(value, unit);
73 
74  return true;
75  }
G4DimensionedType< G4double > G4DimensionedDouble
const XML_Char int const XML_Char * value
Definition: expat.h:331
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

template<>
G4bool G4ConversionUtils::Convert ( const G4String myInput,
G4DimensionedThreeVector output 
)
inline

Definition at line 77 of file G4ConversionUtils.hh.

79  {
80  G4String input(myInput);
81  input = input.strip();
82 
83  G4double value1, value2, value3;
84  G4String unit;
85 
86  std::istringstream is(input);
87  char tester;
88 
89  if (!(is >> value1 >> value2 >> value3 >>unit) || is.get(tester)) return false;
90 
91  output = G4DimensionedThreeVector(G4ThreeVector(value1, value2, value3), unit);
92 
93  return true;
94  }
CLHEP::Hep3Vector G4ThreeVector
G4DimensionedType< G4ThreeVector > G4DimensionedThreeVector
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

template<>
G4bool G4ConversionUtils::Convert ( const G4String myInput,
G4ThreeVector output 
)
inline

Definition at line 96 of file G4ConversionUtils.hh.

97  {
98  G4String input(myInput);
99  input = input.strip();
100 
101  G4double value1, value2, value3;
102 
103  std::istringstream is(input);
104  char tester;
105 
106  if (!(is >> value1 >> value2 >> value3) || is.get(tester)) return false;
107  output = G4ThreeVector(value1, value2, value3);
108 
109  return true;
110  }
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

template<typename Value >
G4bool G4ConversionUtils::Convert ( const G4String myInput,
Value &  value1,
Value &  value2 
)

Definition at line 115 of file G4ConversionUtils.hh.

117  {
118  G4String input(myInput);
119  input = input.strip();
120 
121  std::istringstream is(input);
122  char tester;
123 
124  return ((is >> value1 >> value2) && (!is.get(tester)));
125  }

Here is the call graph for this function:

template<>
G4bool G4ConversionUtils::Convert ( const G4String myInput,
G4DimensionedDouble min,
G4DimensionedDouble max 
)
inline

Definition at line 128 of file G4ConversionUtils.hh.

130  {
131  G4String input(myInput);
132  input = input.strip();
133 
134  G4double valueMin, valueMax;
135  G4String unitsMin, unitsMax;
136 
137  std::istringstream is(input);
138  char tester;
139 
140  if (!(is >> valueMin >> unitsMin >> valueMax >> unitsMax) || is.get(tester)) return false;;
141 
142  min = G4DimensionedDouble(valueMin, unitsMin);
143  max = G4DimensionedDouble(valueMax, unitsMax);
144 
145  return true;
146  }
G4DimensionedType< G4double > G4DimensionedDouble
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

template<>
G4bool G4ConversionUtils::Convert ( const G4String myInput,
G4DimensionedThreeVector min,
G4DimensionedThreeVector max 
)
inline

Definition at line 148 of file G4ConversionUtils.hh.

150  {
151  G4String input(myInput);
152  input = input.strip();
153 
154  G4double valueMinX, valueMinY, valueMinZ;
155  G4double valueMaxX, valueMaxY, valueMaxZ;
156  G4String unitMin, unitMax;
157 
158  std::istringstream is(input);
159  char tester;
160 
161  if (!(is >> valueMinX >> valueMinY >> valueMinZ >> unitMin >> valueMaxX >> valueMaxY >> valueMaxZ >> unitMax)
162  || is.get(tester)) return false;
163 
164  min = G4DimensionedThreeVector(G4ThreeVector(valueMinX, valueMinY, valueMinZ), unitMin);
165  max = G4DimensionedThreeVector(G4ThreeVector(valueMaxX, valueMaxY, valueMaxZ), unitMax);
166 
167  return true;
168  }
CLHEP::Hep3Vector G4ThreeVector
G4DimensionedType< G4ThreeVector > G4DimensionedThreeVector
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

template<>
G4bool G4ConversionUtils::Convert ( const G4String myInput,
G4ThreeVector min,
G4ThreeVector max 
)
inline

Definition at line 170 of file G4ConversionUtils.hh.

172  {
173  G4String input(myInput);
174  input = input.strip();
175 
176  G4double valueMinX, valueMinY, valueMinZ;
177  G4double valueMaxX, valueMaxY, valueMaxZ;
178 
179  std::istringstream is(input);
180  char tester;
181 
182  if (!(is >> valueMinX >> valueMinY >> valueMinZ >> valueMaxX >> valueMaxY >> valueMaxZ)
183  || is.get(tester)) return false;
184 
185  min = G4ThreeVector(valueMinX, valueMinY, valueMinZ);
186  max = G4ThreeVector(valueMaxX, valueMaxY, valueMaxZ);
187 
188  return true;
189  }
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function: