laura is hosted by Hepforge, IPPP Durham
Laura++  v3r4
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauTextFileParser.hh
Go to the documentation of this file.
1 
2 /*
3 Copyright 2008 University of Warwick
4 
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8 
9  http://www.apache.org/licenses/LICENSE-2.0
10 
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 */
17 
18 /*
19 Laura++ package authors:
20 John Back
21 Paul Harrison
22 Thomas Latham
23 */
24 
35 #ifndef LAU_TEXT_FILE_PARSER_HH
36 #define LAU_TEXT_FILE_PARSER_HH
37 
38 #include "TString.h"
39 
40 #include <iostream>
41 #include <string>
42 #include <sstream>
43 #include <vector>
44 #include <map>
45 
47 
48  public:
50 
53  LauTextFileParser(const char* s);
54 
56 
59  LauTextFileParser(const std::string& s);
60 
62 
65  LauTextFileParser(const TString& s);
66 
68  virtual ~LauTextFileParser();
69 
71  void processFile();
72 
74 
78  std::vector<std::string> getLine(UInt_t lineNo);
79 
81 
84  std::vector<std::string> getNextLine();
85 
87 
90  void resetLineNumber(UInt_t lineNo) {lineNumber_ = lineNo;}
91 
93 
96  UInt_t getTotalNumLines() const {return totalLines_;}
97 
98  protected:
99 
100  private:
103 
106 
108  typedef std::map<int, std::vector<std::string> > LineMap;
109 
111  std::string theFile_;
112 
115 
117  UInt_t totalLines_;
118 
120  UInt_t lineNumber_;
121 
122 };
123 
124 #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.