laura is hosted by Hepforge, IPPP Durham
Laura++  v3r2
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauTextFileParser.hh
Go to the documentation of this file.
1 
2 // Copyright University of Warwick 2008 - 2013.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 // Authors:
7 // Thomas Latham
8 // John Back
9 // Paul Harrison
10 
21 #ifndef LAU_TEXT_FILE_PARSER_HH
22 #define LAU_TEXT_FILE_PARSER_HH
23 
24 #include "TString.h"
25 
26 #include <iostream>
27 #include <string>
28 #include <sstream>
29 #include <vector>
30 #include <map>
31 
33 
34  public:
36 
39  LauTextFileParser(const char* s);
40 
42 
45  LauTextFileParser(const std::string& s);
46 
48 
51  LauTextFileParser(const TString& s);
52 
54  virtual ~LauTextFileParser();
55 
57  void processFile();
58 
60 
64  std::vector<std::string> getLine(UInt_t lineNo);
65 
67 
70  std::vector<std::string> getNextLine();
71 
73 
76  void resetLineNumber(UInt_t lineNo) {lineNumber_ = lineNo;}
77 
79 
82  UInt_t getTotalNumLines() const {return totalLines_;}
83 
84  protected:
85 
86  private:
89 
92 
94  typedef std::map<int, std::vector<std::string> > LineMap;
95 
97  std::string theFile_;
98 
101 
103  UInt_t totalLines_;
104 
106  UInt_t lineNumber_;
107 
108 };
109 
110 #endif
Class for parsing text files.
virtual ~LauTextFileParser()
Destructor.
std::vector< std::string > getNextLine()
Retrieve the next line.
void resetLineNumber(UInt_t lineNo)
Set the line number.
std::map< int, std::vector< std::string > > LineMap
The type used to contain the parsed text.
UInt_t totalLines_
The total number of lines in the file.
UInt_t lineNumber_
The current line number.
LineMap lineMap_
The parsed text.
std::string theFile_
The name of the file.
std::vector< std::string > getLine(UInt_t lineNo)
Retrieve the specified line.
LauTextFileParser(const char *s)
Constructor.
LauTextFileParser & operator=(const LauTextFileParser &rhs)
Copy assignment operator (not implemented)
void processFile()
Parse the file.
UInt_t getTotalNumLines() const
Get the total number of lines that are not comments.