]>
Commit | Line | Data |
---|---|---|
ea6b7ed6 | 1 | //-*- Mode: C++ -*- |
2 | // $Id$ | |
3 | ||
4 | #ifndef ALIHLTPENDOLINOLISTREADER_H | |
5 | #define ALIHLTPENDOLINOLISTREADER_H | |
6 | ||
7 | /************************************************************************ | |
8 | ** | |
9 | ** | |
10 | ** This file is property of and copyright by the Department of Physics | |
11 | ** Institute for Physic and Technology, University of Bergen, | |
12 | ** Bergen, Norway, 2007 | |
13 | ** This file has been written by Sebastian Bablok, | |
14 | ** sebastian.bablok@ift.uib.no | |
15 | ** | |
16 | ** Important: This file is provided without any warranty, including | |
17 | ** fitness for any particular purpose. | |
18 | ** | |
19 | ** | |
20 | *************************************************************************/ | |
21 | ||
22 | // @file AliHLTPendolinoListReader.h | |
23 | // @author Sepastian Bablok | |
24 | // @date | |
25 | // @brief Helper class for pendolino list handling | |
26 | // @note maintained by matthias.richter@cern.ch | |
27 | ||
28 | //#include <vector> | |
29 | //#include <map> | |
30 | #include <string> | |
31 | ||
32 | #include <TString.h> | |
33 | #include <TObject.h> | |
34 | #include <TMap.h> | |
35 | ||
36 | ||
37 | //namespace alice { namespace hlt { namespace pendolino { | |
38 | ||
39 | //#define MAX_LINE_LENGTH 256 | |
40 | ||
41 | /** | |
42 | * This class reads the file containing the list of calibration objects the | |
43 | * Pendolino shall fetch. | |
44 | * | |
45 | * @author Sebastian Bablok | |
46 | * | |
47 | * @date 2007-02-23 | |
48 | */ | |
49 | class AliHLTPendolinoListReader : public TObject { | |
50 | public: | |
51 | ||
52 | /** | |
53 | * Static that defines the maximum line length inside the list file | |
54 | */ | |
55 | static int kMAX_LINE_LENGTH; | |
56 | ||
57 | /** | |
58 | * Constructor for the AliHLTPendolinoListReader. | |
59 | */ | |
60 | AliHLTPendolinoListReader(); | |
61 | ||
62 | /** | |
63 | * Constaructor for AliHLTPendolinoListReader, which also loads the | |
64 | * list from file | |
65 | * | |
66 | * @param filename of the list file to read given as char* | |
67 | */ | |
68 | AliHLTPendolinoListReader(const char* filename); | |
69 | ||
70 | /** | |
71 | * Destructor for the AliHLTPendolinoListReader. | |
72 | */ | |
73 | virtual ~AliHLTPendolinoListReader(); | |
74 | ||
75 | /** | |
76 | * Reads the list from the file given by filename | |
77 | * and stores the calibration object names in this class/object. | |
78 | * | |
79 | * @param filename of the list file to read given as char* | |
80 | * | |
81 | * @return false, if file does not exist or file is empty, else true | |
82 | */ | |
83 | bool ReadListFromFile(const char* filename); | |
84 | ||
85 | /** | |
86 | * Reads the list from the file given by filename | |
87 | * and stores the calibration object names in this class/object. | |
88 | * | |
89 | * @param filename of the list file to read given as string | |
90 | * | |
91 | * @return false, if file does not exist or file is empty, else true | |
92 | */ | |
93 | bool ReadListFromFile(const std::string filename); | |
94 | ||
95 | /** | |
96 | * Function to get the list of calibration object names. | |
97 | * | |
98 | * @return pointer to a TMap containing the the lists grouped by | |
99 | * detector. The Alias names are already included as the key | |
100 | * in a map, so they can be directly used for contacting | |
101 | * the AliDCSClient. Structure of the returned TMap: | |
102 | * <pre> | |
103 | * TMap( detector name [key], lists of alias names [value] ) | |
104 | * {TObjString} {TSeqCollection( Alias names )} | |
105 | * {TObjString} | |
106 | * e.g.: | |
107 | * TMap( TRD [key], TRD alias list [value] | |
108 | * ( [Alias names] | |
109 | * -> TRD_low_volt_xyz, | |
110 | * -> TRD_low_volt_123, | |
111 | * -> TRD_high_volt, | |
112 | * -> TRD_temp_1234, ) | |
113 | * TPC [key], TPC alias list [value] | |
114 | * ( [Alias names] | |
115 | * -> TPC_low_volt_abc, | |
116 | * -> TPC_temp_1234, | |
117 | * -> Pressure_sens_01, ) | |
118 | * ...) | |
119 | * </pre> | |
120 | */ | |
121 | TMap* GetCalibObjList(); | |
122 | ||
123 | /** | |
124 | * Function to retrieve the latest run number | |
125 | * | |
126 | * @param path path to the directory containing the lastRunNumber file, | |
127 | * NOTE: the file name must not be included to the path | |
128 | * | |
129 | * @return latest run number | |
130 | */ | |
131 | static int RetrieveLastRunNumber(std::string path); | |
132 | ||
133 | /** | |
134 | * Function to retrieve the latest run number | |
135 | * | |
136 | * @param path path to the directory containing the lastRunNumber file, | |
137 | * NOTE: the file name must not be included to the path | |
138 | * | |
139 | * @return latest run number | |
140 | */ | |
141 | static int RetrieveLastRunNumber(char* path); | |
142 | ||
143 | /** | |
144 | * Function to print out the content of the Map containing the lists. | |
145 | */ | |
146 | void Print() const; | |
147 | ||
148 | // check here !!! | |
149 | /** | |
150 | * Retrieves and returns the value of a given property name. | |
151 | * | |
f22ec90f | 152 | * @param [in] propertyName the name of the requested property (as char) |
153 | * @param [out] propertyValue pointer to the string representing the | |
ea6b7ed6 | 154 | * value of the requested property |
155 | * | |
156 | * @return true, if requested property has been found in the class, else | |
157 | * false (false also when PropertyReader is not valid or | |
158 | * propertyName is NULL) | |
159 | */ | |
160 | // bool retrievePropertyValue(const char* propertyName, | |
161 | // std::string** propertyValue); | |
162 | ||
163 | /** | |
164 | * Retrieves and returns the value of a given property name. | |
165 | * | |
f22ec90f | 166 | * @param [in] propertyName pointer to the string containing the name of |
ea6b7ed6 | 167 | * the requested property |
f22ec90f | 168 | * @param [out] propertyValue pointer to the string representing the |
ea6b7ed6 | 169 | * value of the requested property |
170 | * | |
171 | * @return true, if requested property has been found in the class, else | |
172 | * false (false also when PropertyReader is not valid or | |
173 | * propertyName is NULL) | |
174 | */ | |
175 | // bool retrievePropertyValue(const std::string* propertyName, | |
176 | // std::string** propertyValue); | |
177 | ||
178 | ||
179 | private: | |
180 | ||
181 | /** | |
182 | * Flag, indicating if list has already been read from file. | |
183 | */ | |
184 | bool fValid; //! see above | |
185 | ||
186 | /** | |
187 | * Vector containing the list of calibration objects | |
188 | */ | |
189 | // std::vector<std::string> mCalibObjList; | |
190 | ||
191 | ||
192 | ||
193 | /** | |
194 | * Map containing all PropertyName PropertyValue pairs read from the | |
195 | * property file. | |
196 | */ | |
197 | TMap fCalibObjList;//! mProperties; | |
198 | ||
199 | /** | |
200 | * AliRoot required stuff | |
201 | */ | |
202 | ClassDef(AliHLTPendolinoListReader, 5); | |
203 | }; //end of class | |
204 | ||
205 | ||
206 | inline TMap* AliHLTPendolinoListReader::GetCalibObjList() { | |
207 | return &fCalibObjList; | |
208 | } | |
209 | ||
210 | ||
211 | #endif // ALIHLTPENDOLINOLISTREADER_H | |
212 |