#include <LBNEKeyedInput.hh>
|
| LBNEKeyedInput () |
|
void | readFile (cstr_t filename) |
|
void | readString (cstr_t data) |
|
void | readStream (std::istream &in) |
|
G4bool | contains (G4String name) const |
|
void | get (cstr_t name, G4int &buffer, G4int length=-1) |
|
void | get (cstr_t name, G4double &buffer, G4int length=-1) |
|
void | get (cstr_t name, G4bool &buffer, G4int length=-1) |
|
void | get (cstr_t name, G4String &buffer, G4int length=-1) |
|
void | get (cstr_t name, std::vector< G4int > &buffer, G4int length=-1) |
|
void | get (cstr_t name, std::vector< G4double > &buffer, G4int length=-1) |
|
void | get (cstr_t name, std::vector< G4bool > &buffer, G4int length=-1) |
|
void | get (cstr_t name, std::vector< G4String > &buffer, G4int length=-1) |
|
void | printAll () const |
|
|
typedef std::map< G4String, G4String > | ssmap_t |
|
typedef const G4String & | cstr_t |
|
|
static G4bool | isLineComment (cstr_t line) |
|
static G4int | countTerms (cstr_t value) |
|
static void | fail (cstr_t message, cstr_t key="", G4int expected=-1) |
|
static void | parse (std::istream &in, G4int &buffer, cstr_t name) |
|
static void | parse (std::istream &in, G4double &buffer, cstr_t name) |
|
static void | parse (std::istream &in, G4bool &buffer, cstr_t name) |
|
static void | parse (std::istream &in, G4String &buffer, cstr_t name) |
|
static void | checkGotTerm (std::istream &in, cstr_t message, cstr_t name) |
|
Definition at line 44 of file LBNEKeyedInput.hh.
LBNEKeyedInput::LBNEKeyedInput |
( |
| ) |
|
|
explicit |
void LBNEKeyedInput::checkGotTerm |
( |
std::istream & |
in, |
|
|
cstr_t |
message, |
|
|
cstr_t |
name |
|
) |
| |
|
staticprivate |
G4bool LBNEKeyedInput::contains |
( |
G4String |
name | ) |
const |
G4int LBNEKeyedInput::countTerms |
( |
cstr_t |
value | ) |
|
|
staticprivate |
Definition at line 146 of file LBNEKeyedInput.cc.
147 istringstream in(
value);
const GenericPointer< typename T::ValueType > T2 value
void LBNEKeyedInput::fail |
( |
cstr_t |
message, |
|
|
cstr_t |
key = "" , |
|
|
G4int |
expected = -1 |
|
) |
| |
|
staticprivate |
Definition at line 162 of file LBNEKeyedInput.cc.
164 exc <<
"LBNEKeyedInput error:\n";
165 if(
key !=
"") exc <<
" variable: " <<
key <<
'\n';
166 exc <<
" message: " <<
message <<
'\n';
168 G4Exception(exc.str().c_str(),
" " , FatalException,
" " );
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void LBNEKeyedInput::get |
( |
cstr_t |
name, |
|
|
G4int & |
buffer, |
|
|
G4int |
length = -1 |
|
) |
| |
void LBNEKeyedInput::get |
( |
cstr_t |
name, |
|
|
G4double & |
buffer, |
|
|
G4int |
length = -1 |
|
) |
| |
void LBNEKeyedInput::get |
( |
cstr_t |
name, |
|
|
G4bool & |
buffer, |
|
|
G4int |
length = -1 |
|
) |
| |
void LBNEKeyedInput::get |
( |
cstr_t |
name, |
|
|
G4String & |
buffer, |
|
|
G4int |
length = -1 |
|
) |
| |
void LBNEKeyedInput::get |
( |
cstr_t |
name, |
|
|
std::vector< G4int > & |
buffer, |
|
|
G4int |
length = -1 |
|
) |
| |
void LBNEKeyedInput::get |
( |
cstr_t |
name, |
|
|
std::vector< G4double > & |
buffer, |
|
|
G4int |
length = -1 |
|
) |
| |
void LBNEKeyedInput::get |
( |
cstr_t |
name, |
|
|
std::vector< G4bool > & |
buffer, |
|
|
G4int |
length = -1 |
|
) |
| |
void LBNEKeyedInput::get |
( |
cstr_t |
name, |
|
|
std::vector< G4String > & |
buffer, |
|
|
G4int |
length = -1 |
|
) |
| |
template<class T >
void LBNEKeyedInput::getSingle |
( |
cstr_t |
name, |
|
|
T & |
buffer |
|
) |
| |
|
private |
template<class T >
void LBNEKeyedInput::getVector |
( |
G4String |
name, |
|
|
std::vector< T > & |
buffer, |
|
|
G4int |
length |
|
) |
| |
|
private |
Definition at line 185 of file LBNEKeyedInput.cc.
188 if(buffer.size() != 0)
fail(
"non-empty buffer",
name);
191 if(in.eof())
fail(
"missing or empty variable",
name);
195 buffer.push_back(term);
198 if(length >= 0 && (
size_t)length != buffer.size()) {
199 fail(
"unexpected array length",
name, length);
void LBNEKeyedInput::handleLine |
( |
cstr_t |
line | ) |
|
|
private |
Definition at line 92 of file LBNEKeyedInput.cc.
95 istringstream in(
line);
107 if(!in.fail()) value << term <<
' ';
110 varMap[
key] = value.str();
const GenericPointer< typename T::ValueType > T2 value
G4bool LBNEKeyedInput::isLineComment |
( |
cstr_t |
line | ) |
|
|
staticprivate |
void LBNEKeyedInput::parse |
( |
std::istream & |
in, |
|
|
G4int & |
buffer, |
|
|
cstr_t |
name |
|
) |
| |
|
staticprivate |
void LBNEKeyedInput::parse |
( |
std::istream & |
in, |
|
|
G4double & |
buffer, |
|
|
cstr_t |
name |
|
) |
| |
|
staticprivate |
void LBNEKeyedInput::parse |
( |
std::istream & |
in, |
|
|
G4bool & |
buffer, |
|
|
cstr_t |
name |
|
) |
| |
|
staticprivate |
Definition at line 220 of file LBNEKeyedInput.cc.
223 if(term ==
"TRUE" || term ==
"1") buffer =
true;
224 else if(term ==
"FALSE" || term ==
"0") buffer =
false;
225 else in.setstate(ios::failbit);
void LBNEKeyedInput::parse |
( |
std::istream & |
in, |
|
|
G4String & |
buffer, |
|
|
cstr_t |
name |
|
) |
| |
|
staticprivate |
Definition at line 229 of file LBNEKeyedInput.cc.
231 size_t size = buffer.size();
232 if(size >= 2 && buffer[0u] ==
'\'' && buffer[size-1u] ==
'\'') {
233 buffer.erase(size-1,1);
237 in.setstate(ios::failbit);
240 "expected string(s) in single quotes, no spaces within string",
name);
void LBNEKeyedInput::printAll |
( |
| ) |
const |
Definition at line 77 of file LBNEKeyedInput.cc.
79 G4cout <<
"printing LBNEKeyedInput..." << G4endl;
80 G4cout <<
"--------------------------" << G4endl << G4endl;
82 G4cout << it->first <<
": " << it->second << G4endl << G4endl;
84 G4cout <<
"--------------------------" << G4endl << G4endl;
void LBNEKeyedInput::readFile |
( |
cstr_t |
filename | ) |
|
void LBNEKeyedInput::readIndexSpec |
( |
std::istringstream & |
in, |
|
|
cstr_t |
name |
|
) |
| |
|
private |
Definition at line 130 of file LBNEKeyedInput.cc.
131 streampos
start = in.tellg();
134 if(in.get() !=
'=' || in.fail()) {
140 fail(
"illegal array indexing", name);
void LBNEKeyedInput::readStream |
( |
std::istream & |
in | ) |
|
void LBNEKeyedInput::readString |
( |
cstr_t |
data | ) |
|
The documentation for this class was generated from the following files: