20 #include <boost/algorithm/string.hpp>
31 sddsFileName_m = input;
35 typedef std::string::const_iterator
iterator_t;
36 typedef SDDS::parser::file_parser<iterator_t> file_parser_t;
41 paramNameToID_m.clear();
42 columnNameToID_m.clear();
46 iterator_t contentsIter = contents.begin();
47 iterator_t contentsEnd = contents.end();
49 file_parser_t parser(error_handler);
51 bool success = phrase_parse(contentsIter, contentsEnd, parser, skipper, sddsData_m);
55 for (; piter != pend && success; ++ piter) {
56 success = piter->parse(contentsIter, contentsEnd, skipper);
58 while (success && contentsIter != contentsEnd) {
61 for (; citer != cend && success; ++ citer) {
62 success = citer->parse(contentsIter, contentsEnd, skipper);
67 if (!success || contentsIter != contentsEnd)
70 "could not parse SDDS file");
73 unsigned int param_order = 0;
76 fixCaseSensitivity(name);
77 paramNameToID_m.insert(std::make_pair(name,
82 unsigned int col_order = 0;
83 for (
const SDDS::column &col: sddsData_m.sddsColumns_m) {
85 fixCaseSensitivity(name);
86 columnNameToID_m.insert(std::make_pair(name,
95 std::ifstream in(sddsFileName_m.c_str());
100 contents.resize(in.tellg());
101 in.seekg(0, std::ios::beg);
103 in.read(&contents[0], contents.size());
111 "could not open file '" + sddsFileName_m +
"'");
113 return std::string(
"");
117 int idx = getColumnIndex(columnName);
119 return sddsData_m.sddsColumns_m[idx].values_m;
124 fixCaseSensitivity(col_name);
125 auto it = columnNameToID_m.find(col_name);
126 if (
it != columnNameToID_m.end()) {
131 "could not find column '" + col_name +
"'");
138 boost::to_lower(for_string);
static void fixCaseSensitivity(std::string &for_string)
int getColumnIndex(std::string col_name) const
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of it
SDDS::parser::skipper< iterator_t > skipper_t
void setInput(const std::string &input)
std::string::const_iterator iterator_t
std::string::iterator iterator
FILECONTENTS * readFile(const char filename[])
std::vector< variant_t > columnData_t
ast::columnData_t getColumnData(const std::string &columnName)
boost::optional< std::string > name_m
SDDS1 &description contents
boost::optional< std::string > name_m