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.

Referenced by G4AttValueFilterT< T, ConversionErrorPolicy >::Accept(), G4AttValueFilterT< T, ConversionErrorPolicy >::GetValidElement(), G4AttValueFilterT< T, ConversionErrorPolicy >::LoadIntervalElement(), and G4AttValueFilterT< T, ConversionErrorPolicy >::LoadSingleValueElement().

00047   {
00048     G4String input(myInput);
00049     input = input.strip();
00050 
00051     std::istringstream is(input);
00052     char tester;
00053     
00054     return ((is >> output) && !is.get(tester));
00055   }

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

Definition at line 59 of file G4ConversionUtils.hh.

References G4String::strip().

00060   {
00061     G4String input(myInput);
00062     input = input.strip();
00063 
00064     G4double value;
00065     G4String unit;
00066     
00067     std::istringstream is(input);
00068     char tester;
00069     
00070     if (!(is >> value >> unit) || is.get(tester)) return false;
00071 
00072     output = G4DimensionedDouble(value, unit);
00073     
00074     return true;      
00075   }

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

Definition at line 77 of file G4ConversionUtils.hh.

References G4String::strip().

00079   {
00080     G4String input(myInput);
00081     input = input.strip();
00082 
00083     G4double value1, value2, value3;
00084     G4String unit;
00085     
00086     std::istringstream is(input);
00087     char tester;
00088     
00089     if (!(is >> value1 >> value2 >> value3 >>unit) || is.get(tester)) return false;
00090 
00091     output = G4DimensionedThreeVector(G4ThreeVector(value1, value2, value3), unit);
00092     
00093     return true;      
00094   }

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

Definition at line 96 of file G4ConversionUtils.hh.

References G4String::strip().

00097   {
00098     G4String input(myInput);
00099     input = input.strip();
00100 
00101     G4double value1, value2, value3;
00102     
00103     std::istringstream is(input);
00104     char tester;
00105 
00106     if (!(is >> value1 >> value2 >> value3) || is.get(tester)) return false;
00107     output = G4ThreeVector(value1, value2, value3);
00108 
00109     return true;
00110   }

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

Definition at line 115 of file G4ConversionUtils.hh.

References G4String::strip().

00117   {
00118     G4String input(myInput);
00119     input = input.strip();
00120 
00121     std::istringstream is(input);
00122     char tester;
00123     
00124     return ((is >> value1 >> value2) && (!is.get(tester)));
00125   }

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

Definition at line 128 of file G4ConversionUtils.hh.

References G4String::strip().

00130   {
00131     G4String input(myInput);
00132     input = input.strip();
00133 
00134     G4double valueMin, valueMax;  
00135     G4String unitsMin, unitsMax;
00136     
00137     std::istringstream is(input);
00138     char tester;
00139     
00140     if (!(is >> valueMin >> unitsMin >> valueMax >> unitsMax) || is.get(tester)) return false;;
00141     
00142     min = G4DimensionedDouble(valueMin, unitsMin);
00143     max = G4DimensionedDouble(valueMax, unitsMax);
00144     
00145     return true;      
00146   }

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

Definition at line 148 of file G4ConversionUtils.hh.

References G4String::strip().

00150   {   
00151     G4String input(myInput);
00152     input = input.strip();
00153    
00154     G4double valueMinX, valueMinY, valueMinZ;
00155     G4double valueMaxX, valueMaxY, valueMaxZ;
00156     G4String unitMin, unitMax;
00157     
00158     std::istringstream is(input);
00159     char tester;
00160     
00161     if (!(is >> valueMinX >> valueMinY >> valueMinZ >> unitMin >> valueMaxX >> valueMaxY >> valueMaxZ >> unitMax)
00162         || is.get(tester)) return false;
00163     
00164       min = G4DimensionedThreeVector(G4ThreeVector(valueMinX, valueMinY, valueMinZ), unitMin);
00165       max = G4DimensionedThreeVector(G4ThreeVector(valueMaxX, valueMaxY, valueMaxZ), unitMax);
00166       
00167       return true;      
00168   }

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

Definition at line 170 of file G4ConversionUtils.hh.

References G4String::strip().

00172   {      
00173     G4String input(myInput);
00174     input = input.strip();
00175 
00176     G4double valueMinX, valueMinY, valueMinZ;
00177     G4double valueMaxX, valueMaxY, valueMaxZ;
00178     
00179     std::istringstream is(input);
00180     char tester;
00181 
00182     if (!(is >> valueMinX >> valueMinY >> valueMinZ >> valueMaxX >> valueMaxY >> valueMaxZ)
00183         || is.get(tester)) return false;
00184     
00185     min = G4ThreeVector(valueMinX, valueMinY, valueMinZ);
00186     max = G4ThreeVector(valueMaxX, valueMaxY, valueMaxZ);
00187     
00188     return true;      
00189   }


Generated on Mon May 27 17:54:05 2013 for Geant4 by  doxygen 1.4.7