]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSt1IniReader.h
Cleaning the task in the destructor if it was posted
[u/mrichter/AliRoot.git] / MUON / AliMUONSt1IniReader.h
CommitLineData
ba030c0e 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 */
5
6/* $Id$ */
7
8// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
9//
10// Class AliMUONIniReader
11// ----------------------
12// General class to read data in ASCII file format,
13// similar to the Windows ".ini" files (a set of sections tagged by a
14// [ sectionName ]
15// and values defined in the way:
16// parameterName = value
17//
18// comment lines can be introduced if the first non-blank character
19// is either ';' or '#'
20
21
22#include <string>
23#include <vector>
24#include <map>
25#include <utility>
26#include <fstream>
27
40c8ec24 28#ifndef __HP_aCC
29 using std::string;
30 using std::pair;
31 using std::vector;
32 using std::multimap;
33#endif
ba030c0e 34
35class AliMUONSt1IniReader
36{
37 public:
40c8ec24 38 enum IniType {kUndef, kChapter, kValue};
5f91c9e8 39
40c8ec24 40 typedef pair<string, string> ValuePair;
41 typedef vector<ValuePair> ValueList;
42 typedef pair<string, ValueList> Chapter;
43 typedef multimap <string, ValueList> ChapterList;
ba030c0e 44
45 public:
46 AliMUONSt1IniReader();
47 AliMUONSt1IniReader(string fileName);
48 virtual ~AliMUONSt1IniReader();
49
40c8ec24 50 bool ReadNextLine();
51 IniType GetCurrentType() const {return fCurrentType; }
52 string GetCurrentName() const {return fCurrentName; }
53 string GetCurrentValue() const {return fCurrentValue;}
54 Chapter MakeCurrentChapter();
55 ValueList MakeCurrentValueList();
56 ChapterList MakeChapterList();
3c25381f 57 bool Eof() const {return fEndOfFile;}
ba030c0e 58 void Reset() ;
59
60 private:
3c25381f 61 string Trail(const string& s) const;
ba030c0e 62
63 ifstream fFile; // the file to be read
40c8ec24 64 IniType fCurrentType; // current type of line (either kChapter or kValue)
ba030c0e 65 string fCurrentName; // name of chapter / name of parameter pair
66 string fCurrentValue;// value of the parameter pair if the type is kValue
67 bool fEndOfFile; // true if the file is entirely read
68};
69
70#endif //ALI_MUON_ST1_INI_READER_H