Nymph  v1.5.2
Flow-Based Data Processing Framework
KTFilenameParsers.cc
Go to the documentation of this file.
1 /*
2  * KTFilenameParsers.cc
3  *
4  * Created on: May 31, 2013
5  * Author: nsoblath
6  */
7 
8 #include "KTFilenameParsers.hh"
9 
10 #include "KTLogger.hh"
11 
12 #include <boost/property_tree/ptree.hpp>
13 
14 #include <boost/spirit/include/qi.hpp>
15 #include <boost/spirit/include/phoenix_core.hpp>
16 #include <boost/spirit/include/phoenix_operator.hpp>
17 
18 // I can't just use boost::spirit::qi because of naming conflicts with std
19 using boost::spirit::qi::int_;
20 using boost::spirit::qi::double_;
21 // I had to take this out because of a naming conflict with boost::bind
22 //using boost::spirit::qi::_1;
23 using boost::spirit::qi::phrase_parse;
24 using boost::spirit::ascii::space;
25 using boost::phoenix::ref;
26 
27 using std::string;
28 
29 namespace Nymph
30 {
31  KTLOGGER(fnplog, "KTFilenameParsers");
32 
33 
35  {
36  bool parsed = phrase_parse(filename.begin(), filename.end(),
37  (int_[ref(fNEvents)=boost::spirit::qi::_1] >> "events_" >>
38  double_[ref(fEventLength) = boost::spirit::qi::_1] >> "dur_" >>
39  double_[ref(fdfdt) = boost::spirit::qi::_1] >> "dfdt_" >>
40  double_[ref(fSignalPower) = boost::spirit::qi::_1] >> "power.egg"
41  ), space);
42  if (! parsed)
43  {
44  KTERROR(fnplog, "Filename was not parsed correctly: " << filename);
45  }
46  }
47 
48 
49 }
KTLOGGER(applog, "KTApplication")
#define KTERROR(...)
Definition: KTLogger.hh:347
KTLocustMCFilename(const std::string &filename)
Contains the logger class and macros, based on Kasper&#39;s KLogger class.