OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
SDDS::SDDSParser Class Reference

#include <SDDSParser.h>

Inheritance diagram for SDDS::SDDSParser:
Inheritance graph
[legend]
Collaboration diagram for SDDS::SDDSParser:
Collaboration graph
[legend]

Public Member Functions

 SDDSParser ()
 
 SDDSParser (const std::string &input)
 
void setInput (const std::string &input)
 
file run ()
 
file getData ()
 
ast::columnData_t getColumnData (const std::string &columnName)
 
ast::datatype getColumnType (const std::string &col_name)
 
template<typename T >
void getValue (int t, std::string column_name, T &nval)
 
template<typename T >
void getInterpolatedValue (std::string ref_name, double ref_val, std::string col_name, T &nval)
 
template<typename T >
void getInterpolatedValue (double spos, std::string col_name, T &nval)
 
template<typename T >
void getParameterValue (std::string parameter_name, T &nval)
 
template<typename T >
T getBoostVariantValue (const ast::variant_t &val, int datatype) const
 Convert value from boost variant (only numeric types) to a value of type T. More...
 

Private Member Functions

std::string readFile ()
 
int getColumnIndex (std::string col_name) const
 

Static Private Member Functions

static void fixCaseSensitivity (std::string &for_string)
 
static std::string fixCaseSensitivity (const std::string &for_string)
 

Private Attributes

std::string sddsFileName_m
 
std::map< std::string, int > paramNameToID_m
 mapping from parameter name to offset in params_m More...
 
std::map< std::string, int > columnNameToID_m
 mapping from column name to ID in columns_m More...
 
SDDS::file sddsData_m
 

Detailed Description

Definition at line 31 of file SDDSParser.h.

Constructor & Destructor Documentation

SDDS::SDDSParser::SDDSParser ( )

Definition at line 5 of file SDDSParser.cpp.

SDDS::SDDSParser::SDDSParser ( const std::string &  input)

Definition at line 9 of file SDDSParser.cpp.

Member Function Documentation

void SDDS::SDDSParser::fixCaseSensitivity ( std::string &  for_string)
staticprivate

Definition at line 119 of file SDDSParser.cpp.

Referenced by fixCaseSensitivity(), getParameterValue(), and getValue().

static std::string SDDS::SDDSParser::fixCaseSensitivity ( const std::string &  for_string)
inlinestaticprivate

Definition at line 35 of file SDDSParser.h.

References fixCaseSensitivity().

Here is the call graph for this function:

template<typename T >
T SDDS::SDDSParser::getBoostVariantValue ( const ast::variant_t val,
int  datatype 
) const
inline

Convert value from boost variant (only numeric types) to a value of type T.

Definition at line 190 of file SDDSParser.h.

References SDDS::ast::DOUBLE, SDDS::ast::FLOAT, SDDS::ast::LONG, SDDS::ast::SHORT, and T.

Referenced by OpalSimulation::getData().

SDDS::ast::columnData_t SDDS::SDDSParser::getColumnData ( const std::string &  columnName)

Definition at line 99 of file SDDSParser.cpp.

Referenced by OpalSimulation::getData().

int SDDS::SDDSParser::getColumnIndex ( std::string  col_name) const
private

Definition at line 106 of file SDDSParser.cpp.

Referenced by getColumnType(), getInterpolatedValue(), and getValue().

ast::datatype SDDS::SDDSParser::getColumnType ( const std::string &  col_name)
inline

Definition at line 58 of file SDDSParser.h.

References getColumnIndex(), SDDS::file::sddsColumns_m, and sddsData_m.

Referenced by OpalSimulation::getData(), getInterpolatedValue(), and getValue().

Here is the call graph for this function:

file SDDS::SDDSParser::getData ( )
inline

Definition at line 224 of file SDDSParser.h.

References sddsData_m.

template<typename T >
void SDDS::SDDSParser::getInterpolatedValue ( std::string  ref_name,
double  ref_val,
std::string  col_name,
T nval 
)
inline

Converts the string value of a parameter to a value of type T.

Parameters
ref_namereference quantity (e.g. spos)
ref_valinterpolate value of reference quantity (e.g. spos)
col_nameparameter name
nvalstore result of type T in nval

Definition at line 101 of file SDDSParser.h.

References Physics::e, getColumnIndex(), getColumnType(), SDDS::file::sddsColumns_m, sddsData_m, and T.

Referenced by getInterpolatedValue().

Here is the call graph for this function:

template<typename T >
void SDDS::SDDSParser::getInterpolatedValue ( double  spos,
std::string  col_name,
T nval 
)
inline

Converts the string value of a parameter at a position spos to a value of type T.

Parameters
sposinterpolate value at spos
col_nameparameter name
nvalstore result of type T in nval

Definition at line 161 of file SDDSParser.h.

References getInterpolatedValue().

Here is the call graph for this function:

template<typename T >
void SDDS::SDDSParser::getParameterValue ( std::string  parameter_name,
T nval 
)
inline

Converts the string value of a parameter to a value of type T.

Parameters
parameter_nameparameter name
nvalstore result of type T in nval

Definition at line 173 of file SDDSParser.h.

References fixCaseSensitivity(), paramNameToID_m, sddsData_m, and SDDS::file::sddsParameters_m.

Referenced by SDDSWriter::replaceVersionString().

Here is the call graph for this function:

template<typename T >
void SDDS::SDDSParser::getValue ( int  t,
std::string  column_name,
T nval 
)
inline

Converts the string value of a parameter at timestep t to a value of type T.

Parameters
ttimestep (beginning at 1, -1 means last)
column_nameparameter name
nvalstore result of type T in nval

Definition at line 72 of file SDDSParser.h.

References fixCaseSensitivity(), getColumnIndex(), getColumnType(), SDDS::file::sddsColumns_m, and sddsData_m.

Referenced by SDDSWriter::getLastValue().

Here is the call graph for this function:

std::string SDDS::SDDSParser::readFile ( )
private

Definition at line 77 of file SDDSParser.cpp.

SDDS::file SDDS::SDDSParser::run ( )

Definition at line 17 of file SDDSParser.cpp.

References name, SDDS::column::name_m, SDDS::parameter::name_m, and readFile().

Referenced by OpalSimulation::getData(), SDDSWriter::getLastValue(), SDDSReader::parseFile(), and SDDSWriter::replaceVersionString().

Here is the call graph for this function:

void SDDS::SDDSParser::setInput ( const std::string &  input)

Definition at line 13 of file SDDSParser.cpp.

Member Data Documentation

std::map<std::string, int> SDDS::SDDSParser::columnNameToID_m
private

mapping from column name to ID in columns_m

Definition at line 45 of file SDDSParser.h.

std::map<std::string, int> SDDS::SDDSParser::paramNameToID_m
private

mapping from parameter name to offset in params_m

Definition at line 43 of file SDDSParser.h.

Referenced by getParameterValue().

SDDS::file SDDS::SDDSParser::sddsData_m
private
std::string SDDS::SDDSParser::sddsFileName_m
private

Definition at line 40 of file SDDSParser.h.


The documentation for this class was generated from the following files: