1 #ifndef ALI_MUON_ST1_INI_READER_H
2 #define ALI_MUON_ST1_INI_READER_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
7 // Revision of includes 07/05/2004
10 /// \class AliMUONSt1IniReader
11 /// \brief General class to read data in a special ASCII file format
13 /// General class to read data in ASCII file format,
14 /// similar to the Windows ".ini" files (a set of sections tagged by a \n
15 /// [ sectionName ] \n
16 /// and values defined in the way: \n
17 /// parameterName = value \n
19 /// comment lines can be introduced if the first non-blank character
20 /// is either ';' or '#'
22 /// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
38 class AliMUONSt1IniReader
41 enum IniType {kUndef, kChapter, kValue};
43 typedef pair<string, string> ValuePair;
44 typedef vector<ValuePair> ValueList;
45 typedef pair<string, ValueList> Chapter;
46 typedef multimap <string, ValueList> ChapterList;
49 AliMUONSt1IniReader();
50 AliMUONSt1IniReader(string fileName);
51 virtual ~AliMUONSt1IniReader();
54 IniType GetCurrentType() const {return fCurrentType; }
55 string GetCurrentName() const {return fCurrentName; }
56 string GetCurrentValue() const {return fCurrentValue;}
57 Chapter MakeCurrentChapter();
58 ValueList MakeCurrentValueList();
59 ChapterList MakeChapterList();
60 bool Eof() const {return fEndOfFile;}
64 string Trail(const string& s) const;
66 ifstream fFile; // the file to be read
67 IniType fCurrentType; // current type of line (either kChapter or kValue)
68 string fCurrentName; // name of chapter / name of parameter pair
69 string fCurrentValue;// value of the parameter pair if the type is kValue
70 bool fEndOfFile; // true if the file is entirely read
73 #endif //ALI_MUON_ST1_INI_READER_H