1 | /* ======================================================================== *\
|
---|
2 | !
|
---|
3 | ! *
|
---|
4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
---|
6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
---|
8 | ! *
|
---|
9 | ! * Permission to use, copy, modify and distribute this software and its
|
---|
10 | ! * documentation for any purpose is hereby granted without fee,
|
---|
11 | ! * provided that the above copyright notice appear in all copies and
|
---|
12 | ! * that both that copyright notice and this permission notice appear
|
---|
13 | ! * in supporting documentation. It is provided "as is" without express
|
---|
14 | ! * or implied warranty.
|
---|
15 | ! *
|
---|
16 | !
|
---|
17 | !
|
---|
18 | ! Author(s): Thomas Bretz 2/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2007
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | //////////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // MEnv
|
---|
28 | //
|
---|
29 | // It is a slightly changed version of TEnv. It logs all resources which are
|
---|
30 | // touched, so that you can print all untouched resources by
|
---|
31 | // PrintUntouched()
|
---|
32 | //
|
---|
33 | // A new special resource is available. With the resource "Include"
|
---|
34 | // you can include resources from other files, for example
|
---|
35 | //
|
---|
36 | // Include: file1.rc file2.rc
|
---|
37 | //
|
---|
38 | // Including can be done recursively. Resources from the included files
|
---|
39 | // have lower priority. This allows to write a resource file with your
|
---|
40 | // default resources which then can be included in other files overwriting
|
---|
41 | // some of the resources.
|
---|
42 | //
|
---|
43 | // If given paths are not absolute there base is always th elocation of
|
---|
44 | // the including file.
|
---|
45 | //
|
---|
46 | //////////////////////////////////////////////////////////////////////////////
|
---|
47 | #include "MEnv.h"
|
---|
48 |
|
---|
49 | #include <Gtypes.h>
|
---|
50 | #include <TObjString.h>
|
---|
51 |
|
---|
52 | #include <TPave.h>
|
---|
53 | #include <TAttText.h>
|
---|
54 | #include <TAttMarker.h>
|
---|
55 | #include <THashList.h> // needed since root v5.10/00 (TEnv::GetTable)
|
---|
56 |
|
---|
57 | #include "MLog.h"
|
---|
58 | #include "MLogManip.h"
|
---|
59 |
|
---|
60 | #include "MArgs.h"
|
---|
61 |
|
---|
62 | ClassImp(MEnv);
|
---|
63 |
|
---|
64 | using namespace std;
|
---|
65 |
|
---|
66 | //---------------------------------------------------------------------------
|
---|
67 | //
|
---|
68 | // (Default) constructor. If the given file cannot be accessed SetRcName("")
|
---|
69 | // is called which can then be checked by IsValid()
|
---|
70 | //
|
---|
71 | MEnv::MEnv(const char *name) : TEnv(name)
|
---|
72 | {
|
---|
73 | fChecked.SetOwner();
|
---|
74 |
|
---|
75 | // If TEnv::TEnv has not set fRcName
|
---|
76 | if (!IsValid())
|
---|
77 | return;
|
---|
78 |
|
---|
79 | // ExpandPathName (not done by TEnv::TEnv) and read again
|
---|
80 | TString fname(name);
|
---|
81 | gSystem->ExpandPathName(fname);
|
---|
82 |
|
---|
83 | // Is file accessible
|
---|
84 | if (gSystem->AccessPathName(fname, kFileExists))
|
---|
85 | fname = "";
|
---|
86 |
|
---|
87 | SetRcName(fname);
|
---|
88 |
|
---|
89 | // No file found
|
---|
90 | if (fname.IsNull())
|
---|
91 | return;
|
---|
92 |
|
---|
93 | // File has been already processed, but ReadInclude is part of a
|
---|
94 | // derived function, i.e. not yet executed.
|
---|
95 | if (GetEntries()>0 || fname==name)
|
---|
96 | {
|
---|
97 | if (ReadInclude()<0)
|
---|
98 | SetRcName("");
|
---|
99 | return;
|
---|
100 | }
|
---|
101 |
|
---|
102 | // File not yet processed. Reread file.
|
---|
103 | if (ReadFile(fname, kEnvLocal)<0)
|
---|
104 | SetRcName("");
|
---|
105 | }
|
---|
106 |
|
---|
107 | //---------------------------------------------------------------------------
|
---|
108 | //
|
---|
109 | // Process an Include directive and read the corresponding contents
|
---|
110 | //
|
---|
111 | Int_t MEnv::ReadInclude()
|
---|
112 | {
|
---|
113 | // Check for "Include" resource
|
---|
114 | const TString incl = GetValue("Include", "");
|
---|
115 | if (incl.IsNull())
|
---|
116 | return 0;
|
---|
117 |
|
---|
118 | const char *dir = gSystem->DirName(GetRcName());
|
---|
119 |
|
---|
120 | // Tokenize the array into single files divided by a whitespace
|
---|
121 | TObjArray *arr = incl.Tokenize(" ");
|
---|
122 |
|
---|
123 | // We have to rebuild the Include array from scratch to get the
|
---|
124 | // correct sorting for a possible rereading.
|
---|
125 | SetValue("Include", "");
|
---|
126 |
|
---|
127 | // FIXME: Make sure that recursions don't crash the system!
|
---|
128 |
|
---|
129 | for (int i=0; i<arr->GetEntries(); i++)
|
---|
130 | {
|
---|
131 | // Get file name to include
|
---|
132 | TString fenv = (*arr)[i]->GetName();
|
---|
133 |
|
---|
134 | // If the is not anabsolute path we prepend the dir-name
|
---|
135 | // of the including file. This allows that includes
|
---|
136 | // do not necessarily need absolute paths and paths are always
|
---|
137 | // relative to the location of th eincluding file.
|
---|
138 | if (!gSystem->IsAbsoluteFileName(fenv))
|
---|
139 | {
|
---|
140 | fenv.Prepend("/");
|
---|
141 | fenv.Prepend(dir);
|
---|
142 | }
|
---|
143 |
|
---|
144 | // Read included file and check if its valid
|
---|
145 | const MEnv env(fenv);
|
---|
146 | if (!env.IsValid())
|
---|
147 | {
|
---|
148 | delete arr;
|
---|
149 | return -1;
|
---|
150 | }
|
---|
151 |
|
---|
152 | // Add file name before its childs
|
---|
153 | SetValue("+Include", fenv);
|
---|
154 |
|
---|
155 | // If it is valid add entries from include without overwriting,
|
---|
156 | // i.e. the included resources have lower priority
|
---|
157 | AddEnv(env, kFALSE);
|
---|
158 |
|
---|
159 | // Get a possible child include from env
|
---|
160 | const TString incl2 = const_cast<MEnv&>(env).GetValue("Include", "");
|
---|
161 | if (!incl2.IsNull())
|
---|
162 | SetValue("+Include", incl2);
|
---|
163 | }
|
---|
164 |
|
---|
165 | delete arr;
|
---|
166 |
|
---|
167 | // Get final compiled resource
|
---|
168 | TString inc = GetValue("Include", "");
|
---|
169 |
|
---|
170 | // Remove obsolete whitespaces for convinience
|
---|
171 | inc.ReplaceAll(" ", " ");
|
---|
172 | inc = inc.Strip(TString::kBoth);
|
---|
173 |
|
---|
174 | // Set final resource, now as kEnvLocal (previously set as kEnvChnaged)
|
---|
175 | SetValue("Include", inc, kEnvLocal);
|
---|
176 |
|
---|
177 | // FIXME: Remove douplets in the correct order
|
---|
178 |
|
---|
179 | return 0;
|
---|
180 | }
|
---|
181 |
|
---|
182 | //---------------------------------------------------------------------------
|
---|
183 | //
|
---|
184 | // Read and parse the resource file for a certain level.
|
---|
185 | // Returns -1 on case of error, 0 in case of success.
|
---|
186 | //
|
---|
187 | // Check for an include directive
|
---|
188 | //
|
---|
189 | Int_t MEnv::ReadFile(const char *fname, EEnvLevel level)
|
---|
190 | {
|
---|
191 | // First read the file via TEnv
|
---|
192 | if (TEnv::ReadFile(fname, level)<0)
|
---|
193 | return -1;
|
---|
194 |
|
---|
195 | return ReadInclude();
|
---|
196 | }
|
---|
197 |
|
---|
198 | //---------------------------------------------------------------------------
|
---|
199 | //
|
---|
200 | // Make sure that the name used for writing doesn't contain a full path
|
---|
201 | //
|
---|
202 | const char *MEnv::GetName() const
|
---|
203 | {
|
---|
204 | const char *pos = strrchr(GetRcName(), '/');
|
---|
205 | return pos>0 ? pos+1 : GetRcName();
|
---|
206 | }
|
---|
207 |
|
---|
208 | //---------------------------------------------------------------------------
|
---|
209 | //
|
---|
210 | // Return the total number of entries in the table
|
---|
211 | //
|
---|
212 | Int_t MEnv::GetEntries() const
|
---|
213 | {
|
---|
214 | if (!GetTable())
|
---|
215 | return -1;
|
---|
216 |
|
---|
217 | return GetTable()->GetEntries();
|
---|
218 | }
|
---|
219 |
|
---|
220 | //---------------------------------------------------------------------------
|
---|
221 | //
|
---|
222 | // Compile str+post and make sure that in between there is a unique dot.
|
---|
223 | //
|
---|
224 | TString MEnv::Compile(TString str, const char *post) const
|
---|
225 | {
|
---|
226 | if (!str.IsNull() && !str.EndsWith("."))
|
---|
227 | str += ".";
|
---|
228 |
|
---|
229 | str += post;
|
---|
230 |
|
---|
231 | return str;
|
---|
232 | }
|
---|
233 |
|
---|
234 | //---------------------------------------------------------------------------
|
---|
235 | //
|
---|
236 | // Get the value from the table and remember the value as checked
|
---|
237 | //
|
---|
238 | Int_t MEnv::GetValue(const char *name, Int_t dflt)
|
---|
239 | {
|
---|
240 | if (!fChecked.FindObject(name))
|
---|
241 | fChecked.Add(new TObjString(name));
|
---|
242 | return TEnv::GetValue(name, dflt);
|
---|
243 | }
|
---|
244 |
|
---|
245 | //---------------------------------------------------------------------------
|
---|
246 | //
|
---|
247 | // Get the value from the table and remember the value as checked
|
---|
248 | //
|
---|
249 | Double_t MEnv::GetValue(const char *name, Double_t dflt)
|
---|
250 | {
|
---|
251 | if (!fChecked.FindObject(name))
|
---|
252 | fChecked.Add(new TObjString(name));
|
---|
253 | return TEnv::GetValue(name, dflt);
|
---|
254 | }
|
---|
255 |
|
---|
256 | //---------------------------------------------------------------------------
|
---|
257 | //
|
---|
258 | // Get the value from the table and remember the value as checked
|
---|
259 | //
|
---|
260 | const char *MEnv::GetValue(const char *name, const char *dflt)
|
---|
261 | {
|
---|
262 | if (!fChecked.FindObject(name))
|
---|
263 | fChecked.Add(new TObjString(name));
|
---|
264 | return TEnv::GetValue(name, dflt);
|
---|
265 | }
|
---|
266 |
|
---|
267 | //---------------------------------------------------------------------------
|
---|
268 | //
|
---|
269 | // TEnv doen't have a streamer --> cannot be cloned
|
---|
270 | // --> we have to clone it ourself
|
---|
271 | //
|
---|
272 | TObject *MEnv::Clone(const char *) const
|
---|
273 | {
|
---|
274 | MEnv *env = new MEnv("/dev/null");
|
---|
275 | env->SetRcName(GetRcName());
|
---|
276 | env->AddEnv(*this);
|
---|
277 | return env;
|
---|
278 | }
|
---|
279 |
|
---|
280 | //---------------------------------------------------------------------------
|
---|
281 | //
|
---|
282 | // Interprete fill style: Hollow, Solid, Hatch, 0%-100%
|
---|
283 | // If no text style is detected the value is converted to an integer.
|
---|
284 | //
|
---|
285 | Int_t MEnv::GetFillStyle(const char *name, Int_t dftl)
|
---|
286 | {
|
---|
287 | TString str = GetValue(name, "");
|
---|
288 | str = str.Strip(TString::kBoth);
|
---|
289 | if (str.IsNull())
|
---|
290 | return dftl;
|
---|
291 |
|
---|
292 | str.ToLower();
|
---|
293 |
|
---|
294 | switch (str.Hash())
|
---|
295 | {
|
---|
296 | case 2374867578U: return 0; // hollow
|
---|
297 | case 764279305U: return 1001; // solid
|
---|
298 | case 1854683492U: return 2001; // hatch
|
---|
299 | }
|
---|
300 |
|
---|
301 | return str.EndsWith("%") ? 4000+str.Atoi() : str.Atoi();
|
---|
302 | }
|
---|
303 |
|
---|
304 | //---------------------------------------------------------------------------
|
---|
305 | //
|
---|
306 | // Interprete line style: Solid, Dashed, Dotted, DashDotted
|
---|
307 | // If no line style is detected the value is converted to an integer.
|
---|
308 | //
|
---|
309 | Int_t MEnv::GetLineStyle(const char *name, Int_t dftl)
|
---|
310 | {
|
---|
311 | TString str = GetValue(name, "");
|
---|
312 | str = str.Strip(TString::kBoth);
|
---|
313 | if (str.IsNull())
|
---|
314 | return dftl;
|
---|
315 |
|
---|
316 | str.ToLower();
|
---|
317 |
|
---|
318 | switch (str.Hash())
|
---|
319 | {
|
---|
320 | case 764279305U: return kSolid;
|
---|
321 | case 241979881U: return kDashed;
|
---|
322 | case 2391642602U: return kDotted;
|
---|
323 | case 1124931659U: return kDashDotted;
|
---|
324 | }
|
---|
325 |
|
---|
326 | return str.Atoi();
|
---|
327 | }
|
---|
328 |
|
---|
329 | //---------------------------------------------------------------------------
|
---|
330 | //
|
---|
331 | // Interprete alignment: Top, Right, Left, Bottom, Center, tr, cc, bl, ...
|
---|
332 | // If no text align is detected the value is converted to an integer.
|
---|
333 | //
|
---|
334 | // eg.
|
---|
335 | // Top Right
|
---|
336 | // Bottom Center
|
---|
337 | // Center
|
---|
338 | // tr
|
---|
339 | // br
|
---|
340 | // cr
|
---|
341 | //
|
---|
342 | Int_t MEnv::GetAlign(const char *name, Int_t dftl)
|
---|
343 | {
|
---|
344 | TString str = GetValue(name, "");
|
---|
345 | str = str.Strip(TString::kBoth);
|
---|
346 | if (str.IsNull())
|
---|
347 | return dftl;
|
---|
348 |
|
---|
349 | str.ToLower();
|
---|
350 |
|
---|
351 | switch (str.Hash())
|
---|
352 | {
|
---|
353 | case 29746: return 33; // tr
|
---|
354 | case 25379: return 22; // cc
|
---|
355 | case 25132: return 11; // bl
|
---|
356 |
|
---|
357 | case 25388: return 12; // cl
|
---|
358 | case 25394: return 32; // cr
|
---|
359 |
|
---|
360 | case 29731: return 23; // tc
|
---|
361 | case 25123: return 32; // bc
|
---|
362 |
|
---|
363 | case 29740: return 13; // tl
|
---|
364 | case 25138: return 13; // br
|
---|
365 | }
|
---|
366 |
|
---|
367 | Int_t align = 0;
|
---|
368 | if (str.Contains("right", TString::kIgnoreCase))
|
---|
369 | align += 3;
|
---|
370 | if (str.Contains("left", TString::kIgnoreCase))
|
---|
371 | align += 1;
|
---|
372 | if (str.Contains("bottom", TString::kIgnoreCase))
|
---|
373 | align += 10;
|
---|
374 | if (str.Contains("top", TString::kIgnoreCase))
|
---|
375 | align += 30;
|
---|
376 |
|
---|
377 | if (str.Contains("center", TString::kIgnoreCase))
|
---|
378 | {
|
---|
379 | if (align==0)
|
---|
380 | return 22;
|
---|
381 | if (align/10==0)
|
---|
382 | return align+20;
|
---|
383 | if (align%10==0)
|
---|
384 | return align+2;
|
---|
385 | }
|
---|
386 |
|
---|
387 | return align>0 ? align : str.Atoi();
|
---|
388 | }
|
---|
389 |
|
---|
390 | //---------------------------------------------------------------------------
|
---|
391 | //
|
---|
392 | // Interprete color: Black, White, Red, Green, Blue, Yellow, Magenta,
|
---|
393 | // Cyan, Gray1-5, Grey1-5.
|
---|
394 | // If no text color is detected the value is converted to an integer.
|
---|
395 | //
|
---|
396 | // eg.
|
---|
397 | // Red
|
---|
398 | // Light Red
|
---|
399 | // Dark Red
|
---|
400 | //
|
---|
401 | Int_t MEnv::GetColor(const char *name, Int_t dftl)
|
---|
402 | {
|
---|
403 | TString str = GetValue(name, "");
|
---|
404 |
|
---|
405 | str = str.Strip(TString::kBoth);
|
---|
406 | if (str.IsNull())
|
---|
407 | return dftl;
|
---|
408 |
|
---|
409 | str.ToLower();
|
---|
410 |
|
---|
411 | Int_t offset=0;
|
---|
412 | if (str.Contains("dark"))
|
---|
413 | {
|
---|
414 | str.ReplaceAll("dark", "");
|
---|
415 | str = str.Strip(TString::kBoth);
|
---|
416 | offset = 100;
|
---|
417 | }
|
---|
418 | if (str.Contains("light"))
|
---|
419 | {
|
---|
420 | str.ReplaceAll("light", "");
|
---|
421 | str = str.Strip(TString::kBoth);
|
---|
422 | offset = 150;
|
---|
423 | }
|
---|
424 |
|
---|
425 | switch (str.Hash())
|
---|
426 | {
|
---|
427 | case 2368543371U: return kWhite+offset;
|
---|
428 | case 1814927399U: return kBlack+offset;
|
---|
429 | case 7496964U: return kRed+offset;
|
---|
430 | case 2897107074U: return kGreen+offset;
|
---|
431 | case 1702194402U: return kBlue+offset;
|
---|
432 | case 2374817882U: return kYellow+offset;
|
---|
433 | case 2894218701U: return kMagenta+offset;
|
---|
434 | case 1851881955U: return kCyan+offset;
|
---|
435 | case 749623518U: return 19; // grey1
|
---|
436 | case 749623517U: return 18; // grey2
|
---|
437 | case 749623516U: return 17; // grey3
|
---|
438 | case 749623515U: return 16; // grey4
|
---|
439 | case 749623514U: return 15; // grey5
|
---|
440 | case 749623513U: return 14; // grey6
|
---|
441 | case 749623512U: return 13; // grey7
|
---|
442 | case 749623511U: return 12; // grey8
|
---|
443 | case 741234910U: return 19; // gray1
|
---|
444 | case 741234909U: return 18; // gray2
|
---|
445 | case 741234908U: return 17; // gray3
|
---|
446 | case 741234907U: return 16; // gray4
|
---|
447 | case 741234906U: return 15; // gray5
|
---|
448 | case 741234905U: return 14; // gray6
|
---|
449 | case 741234904U: return 13; // gray7
|
---|
450 | case 741234903U: return 12; // gray8
|
---|
451 | }
|
---|
452 | return str.Atoi();
|
---|
453 | }
|
---|
454 |
|
---|
455 | //---------------------------------------------------------------------------
|
---|
456 | //
|
---|
457 | // As possible convert the color col into a text string which can be
|
---|
458 | // interpreted by GetColor before setting the resource value
|
---|
459 | //
|
---|
460 | void MEnv::SetColor(const char *name, Int_t col)
|
---|
461 | {
|
---|
462 | TString val;
|
---|
463 |
|
---|
464 | if (col>99 && col<101+kCyan)
|
---|
465 | {
|
---|
466 | val = "Dark ";
|
---|
467 | col -= 100;
|
---|
468 | }
|
---|
469 | if (col>150 && col<151+kCyan)
|
---|
470 | {
|
---|
471 | val = "Light ";
|
---|
472 | col -= 150;
|
---|
473 | }
|
---|
474 |
|
---|
475 | switch (col)
|
---|
476 | {
|
---|
477 | case kWhite: val += "White"; break;
|
---|
478 | case kBlack: val += "Black"; break;
|
---|
479 | case kRed: val += "Red"; break;
|
---|
480 | case kGreen: val += "Green"; break;
|
---|
481 | case kBlue: val += "Blue"; break;
|
---|
482 | case kYellow: val += "Yellow"; break;
|
---|
483 | case kMagenta: val += "Magenta"; break;
|
---|
484 | case kCyan: val += "Cyan"; break;
|
---|
485 | case 19: val += "Grey1"; break;
|
---|
486 | case 18: val += "Grey2"; break;
|
---|
487 | case 17: val += "Grey3"; break;
|
---|
488 | case 16: val += "Grey4"; break;
|
---|
489 | case 15: val += "Grey5"; break;
|
---|
490 | case 14: val += "Grey6"; break;
|
---|
491 | case 13: val += "Grey7"; break;
|
---|
492 | case 12: val += "Grey8"; break;
|
---|
493 | }
|
---|
494 |
|
---|
495 | if (val.IsNull())
|
---|
496 | val += col;
|
---|
497 |
|
---|
498 | SetValue(name, val);
|
---|
499 | }
|
---|
500 |
|
---|
501 | //---------------------------------------------------------------------------
|
---|
502 | //
|
---|
503 | // As possible convert the alignment align into a text string which can be
|
---|
504 | // interpreted by GetAlign before setting the resource value
|
---|
505 | //
|
---|
506 | void MEnv::SetAlign(const char *name, Int_t align)
|
---|
507 | {
|
---|
508 | TString val;
|
---|
509 | if (align==22)
|
---|
510 | {
|
---|
511 | SetValue(name, "Center");
|
---|
512 | return;
|
---|
513 | }
|
---|
514 |
|
---|
515 | switch (align%10)
|
---|
516 | {
|
---|
517 | case 1: val += "Left"; break;
|
---|
518 | case 2: val += "Center"; break;
|
---|
519 | case 3: val += "Right"; break;
|
---|
520 | }
|
---|
521 |
|
---|
522 | switch (align/10)
|
---|
523 | {
|
---|
524 | case 1: val += "Bottom"; break;
|
---|
525 | case 2: val += "Center"; break;
|
---|
526 | case 3: val += "Top"; break;
|
---|
527 | }
|
---|
528 |
|
---|
529 | SetValue(name, val);
|
---|
530 | }
|
---|
531 |
|
---|
532 | //---------------------------------------------------------------------------
|
---|
533 | //
|
---|
534 | // As possible convert the fill style style into a text string which can be
|
---|
535 | // interpreted by GetFillStyle before setting the resource value
|
---|
536 | //
|
---|
537 | void MEnv::SetFillStyle(const char *name, Int_t style)
|
---|
538 | {
|
---|
539 | TString val;
|
---|
540 |
|
---|
541 | if (style>3999 && style<4101)
|
---|
542 | val = Form("%d%%", style-4000);
|
---|
543 |
|
---|
544 | switch (style)
|
---|
545 | {
|
---|
546 | case 0: val = "Hollow"; break;
|
---|
547 | case 1001: val = "Solid"; break;
|
---|
548 | case 2001: val = "Hatch"; break;
|
---|
549 | }
|
---|
550 |
|
---|
551 | if (val.IsNull())
|
---|
552 | val += style;
|
---|
553 |
|
---|
554 | SetValue(name, val);
|
---|
555 | }
|
---|
556 |
|
---|
557 | //---------------------------------------------------------------------------
|
---|
558 | //
|
---|
559 | // As possible convert the line style style into a text string which can be
|
---|
560 | // interpreted by GetLineStyle before setting the resource value
|
---|
561 | //
|
---|
562 | void MEnv::SetLineStyle(const char *name, Int_t style)
|
---|
563 | {
|
---|
564 | TString val;
|
---|
565 | switch (style)
|
---|
566 | {
|
---|
567 | case kSolid: val = "Solid"; break;
|
---|
568 | case kDashed: val = "Dashed"; break;
|
---|
569 | case kDotted: val = "Dotted"; break;
|
---|
570 | case kDashDotted: val = "DashDotted"; break;
|
---|
571 | }
|
---|
572 |
|
---|
573 | if (val.IsNull())
|
---|
574 | val += style;
|
---|
575 |
|
---|
576 | SetValue(name, val);
|
---|
577 | }
|
---|
578 |
|
---|
579 | //---------------------------------------------------------------------------
|
---|
580 | //
|
---|
581 | // As possible convert the marker style style into a text string which can be
|
---|
582 | // interpreted by GetLineStyle before setting the resource value
|
---|
583 | //
|
---|
584 | void MEnv::SetMarkerStyle(const char *name, Int_t style)
|
---|
585 | {
|
---|
586 | TString val;
|
---|
587 | switch (style)
|
---|
588 | {
|
---|
589 | case kDot: val = "dot";
|
---|
590 | case kPlus: val = "plus";
|
---|
591 | case kCircle: val = "circle";
|
---|
592 | case kMultiply: val = "multiply";
|
---|
593 | case kFullDotSmall: val = "fulldotsmall";
|
---|
594 | case kFullDotMedium: val = "fulldotmedium";
|
---|
595 | case kFullDotLarge: val = "fulldotlarge";
|
---|
596 | case kOpenTriangleDown: val = "opentriangledown";
|
---|
597 | case kFullCross: val = "fullcross";
|
---|
598 | case kFullCircle: val = "fullcircle";
|
---|
599 | case kFullSquare: val = "fullsquare";
|
---|
600 | case kFullTriangleDown: val = "fulltriangledown";
|
---|
601 | case kOpenCircle: val = "opencircle";
|
---|
602 | case kOpenSquare: val = "opensquare";
|
---|
603 | case kOpenTriangleUp: val = "opentriangleup";
|
---|
604 | case kOpenDiamond: val = "opendiamond";
|
---|
605 | case kOpenCross: val = "opencross";
|
---|
606 | case kFullStar: val = "fullstar";
|
---|
607 | case kOpenStar: val = "openstar";
|
---|
608 | }
|
---|
609 |
|
---|
610 | if (val.IsNull())
|
---|
611 | val += style;
|
---|
612 |
|
---|
613 | SetValue(name, val);
|
---|
614 | }
|
---|
615 |
|
---|
616 | //---------------------------------------------------------------------------
|
---|
617 | //
|
---|
618 | // Get the attributed from a TAttLine (if dftl is given use it as default)
|
---|
619 | // name.LineColor <see also GetColor>
|
---|
620 | // name.LineStyle
|
---|
621 | // name.LineWidth
|
---|
622 | // For more details on the meaning see TAttLine
|
---|
623 | //
|
---|
624 | void MEnv::GetAttLine(const char *name, TAttLine &line, TAttLine *dftl)
|
---|
625 | {
|
---|
626 | const TString color = Compile(name, "LineColor");
|
---|
627 | const TString style = Compile(name, "LineStyle");
|
---|
628 | const TString width = Compile(name, "LineWidth");
|
---|
629 |
|
---|
630 | if (!dftl)
|
---|
631 | dftl = &line;
|
---|
632 |
|
---|
633 | const Color_t col = GetColor(color, dftl->GetLineColor());
|
---|
634 | const Style_t sty = GetLineStyle(style, dftl->GetLineStyle());
|
---|
635 | const Style_t wid = GetValue(width, dftl->GetLineWidth());
|
---|
636 |
|
---|
637 | line.SetLineColor(col);
|
---|
638 | line.SetLineStyle(sty);
|
---|
639 | line.SetLineWidth(wid);
|
---|
640 | }
|
---|
641 |
|
---|
642 | //---------------------------------------------------------------------------
|
---|
643 | //
|
---|
644 | // Get the attributed from a TAttText (if dftl is given use it as default)
|
---|
645 | // name.TextColor <see also GetColor>
|
---|
646 | // name.TextAlign <see also GetAlign>
|
---|
647 | // name.TextAngle
|
---|
648 | // name.TextFont
|
---|
649 | // name.TextSize
|
---|
650 | // For more details on the meaning see TAttText
|
---|
651 | //
|
---|
652 | void MEnv::GetAttText(const char *name, TAttText &text, TAttText *dftl)
|
---|
653 | {
|
---|
654 | const TString color = Compile(name, "TextColor");
|
---|
655 | const TString align = Compile(name, "TextAlign");
|
---|
656 | const TString angle = Compile(name, "TextAngle");
|
---|
657 | const TString font = Compile(name, "TextFont");
|
---|
658 | const TString size = Compile(name, "TextSize");
|
---|
659 |
|
---|
660 | if (!dftl)
|
---|
661 | dftl = &text;
|
---|
662 |
|
---|
663 | const Color_t col = GetColor(color, dftl->GetTextColor());
|
---|
664 | const Short_t ali = GetAlign(align, dftl->GetTextAlign());
|
---|
665 | const Float_t ang = GetValue(angle, dftl->GetTextAngle());
|
---|
666 | const Font_t fon = GetValue(font, dftl->GetTextFont());
|
---|
667 | const Float_t siz = GetValue(size, dftl->GetTextSize());
|
---|
668 |
|
---|
669 | text.SetTextColor(col);
|
---|
670 | text.SetTextAlign(ali);
|
---|
671 | text.SetTextAngle(ang);
|
---|
672 | text.SetTextFont(fon);
|
---|
673 | text.SetTextSize(siz);
|
---|
674 | }
|
---|
675 |
|
---|
676 | //---------------------------------------------------------------------------
|
---|
677 | //
|
---|
678 | // Get the attributed from a TAttFill (if dftl is given use it as default)
|
---|
679 | // name.FillColor <see also GetColor>
|
---|
680 | // name.FillStyle <see also GetFillStyle>
|
---|
681 | // For more details on the meaning see TAttFill
|
---|
682 | //
|
---|
683 | void MEnv::GetAttFill(const char *name, TAttFill &fill, TAttFill *dftl)
|
---|
684 | {
|
---|
685 | const TString color = Compile(name, "FillColor");
|
---|
686 | const TString style = Compile(name, "FillStyle");
|
---|
687 |
|
---|
688 | if (!dftl)
|
---|
689 | dftl = &fill;
|
---|
690 |
|
---|
691 | const Color_t col = GetColor(color, dftl->GetFillColor());
|
---|
692 | const Style_t sty = GetFillStyle(style, dftl->GetFillStyle());
|
---|
693 |
|
---|
694 | fill.SetFillColor(col);
|
---|
695 | fill.SetFillStyle(sty);
|
---|
696 | }
|
---|
697 |
|
---|
698 | //---------------------------------------------------------------------------
|
---|
699 | //
|
---|
700 | // Get the attributed from a TAttMarker (if dftl is given use it as default)
|
---|
701 | // name.MarkerColor <see also GetColor>
|
---|
702 | // name.MarkerStyle
|
---|
703 | // name.MarkerSize
|
---|
704 | // For more details on the meaning see TAttMarker
|
---|
705 | //
|
---|
706 | void MEnv::GetAttMarker(const char *name, TAttMarker &marker, TAttMarker *dftl)
|
---|
707 | {
|
---|
708 | const TString color = Compile(name, "MarkerColor");
|
---|
709 | const TString style = Compile(name, "MarkerStyle");
|
---|
710 | const TString size = Compile(name, "MarkerSize");
|
---|
711 |
|
---|
712 | if (!dftl)
|
---|
713 | dftl = ▮
|
---|
714 |
|
---|
715 | const Color_t col = GetColor(color, dftl->GetMarkerColor());
|
---|
716 | const Style_t sty = GetValue(style, dftl->GetMarkerStyle());
|
---|
717 | const Size_t siz = GetValue(size, dftl->GetMarkerSize());
|
---|
718 |
|
---|
719 | marker.SetMarkerColor(col);
|
---|
720 | marker.SetMarkerStyle(sty);
|
---|
721 | marker.SetMarkerSize(siz);
|
---|
722 | }
|
---|
723 |
|
---|
724 | //---------------------------------------------------------------------------
|
---|
725 | //
|
---|
726 | // Get the attributed from a TPave (if dftl is given use it as default)
|
---|
727 | // name.CornerRadius
|
---|
728 | // name.BorderSize
|
---|
729 | // name.Option
|
---|
730 | // Also all resources from TAttLine and TAttFill are supported.
|
---|
731 | //
|
---|
732 | // For your conveinience: If the CornerRadius is greater than 0 "arc" is
|
---|
733 | // added to the options. If it is equal or less than 0 "arc" is removed
|
---|
734 | // from the options.
|
---|
735 | //
|
---|
736 | // For more details on the meaning see TPave
|
---|
737 | //
|
---|
738 | void MEnv::GetAttPave(const char *str, TPave &pave, TPave *dftl)
|
---|
739 | {
|
---|
740 | const TString post(str);
|
---|
741 |
|
---|
742 | TString name(pave.GetName());
|
---|
743 | if (!name.IsNull() && name!=pave.ClassName())
|
---|
744 | name = Compile(name, post);
|
---|
745 |
|
---|
746 | GetAttLine(name, pave, dftl);
|
---|
747 | GetAttFill(name, pave, dftl);
|
---|
748 |
|
---|
749 | const TString corner = Compile(name, "CornerRadius");
|
---|
750 | const TString border = Compile(name, "BorderSize");
|
---|
751 | const TString option = Compile(name, "Option");
|
---|
752 |
|
---|
753 | if (!dftl)
|
---|
754 | dftl = &pave;
|
---|
755 |
|
---|
756 | const Double_t cor = GetValue(corner, dftl->GetCornerRadius());
|
---|
757 | const Int_t bor = GetValue(border, dftl->GetBorderSize());
|
---|
758 |
|
---|
759 | pave.SetCornerRadius(cor);
|
---|
760 | pave.SetBorderSize(bor);
|
---|
761 |
|
---|
762 | TString opt = GetValue(option, dftl->GetOption());
|
---|
763 | opt.ToLower();
|
---|
764 |
|
---|
765 | const Bool_t has = pave.GetCornerRadius()>0;
|
---|
766 |
|
---|
767 | if (has && !opt.Contains("arc"))
|
---|
768 | opt += "arc";
|
---|
769 |
|
---|
770 | if (!has && opt.Contains("arc"))
|
---|
771 | opt.ReplaceAll("arc", "");
|
---|
772 |
|
---|
773 | pave.SetOption(opt);
|
---|
774 |
|
---|
775 | }
|
---|
776 |
|
---|
777 | //---------------------------------------------------------------------------
|
---|
778 | //
|
---|
779 | // Get the attributed for the TObject obj. Use dftl for default attributes
|
---|
780 | // if given.
|
---|
781 | //
|
---|
782 | // There is support for:
|
---|
783 | // TPave <see GetAttPave>
|
---|
784 | // TAttLine <see GetAttLine>
|
---|
785 | // TAttText <see GetAttText>
|
---|
786 | // TAttFill <see GetAttFill>
|
---|
787 | // TAttMarker <see GetAttMarker>
|
---|
788 | //
|
---|
789 | void MEnv::GetAttributes(const char *name, TObject *obj, TObject *dftl)
|
---|
790 | {
|
---|
791 | //TAttAxis *line = dynamic_cast<TAttAxis*>(obj);
|
---|
792 | //TAtt3D *line = dynamic_cast<TAtt3D*>(obj);
|
---|
793 | //TAttCanvas *line = dynamic_cast<TAttCanvas*>(obj);
|
---|
794 | //TAttFillCanvas *line = dynamic_cast<TAttFillEitor*>(obj);
|
---|
795 | //TAttLineCanvas *line = dynamic_cast<TAttLineCanvas*>(obj);
|
---|
796 | //TAttLineEditor *line = dynamic_cast<TAttLineEditor*>(obj);
|
---|
797 | //TAttMarkerCanvas *line = dynamic_cast<TAttMarkerCanvas*>(obj);
|
---|
798 | //TAttMarkerEditor *line = dynamic_cast<TAttMarkerEditor*>(obj);
|
---|
799 | //TAttPad *line = dynamic_cast<TAttPad*>(obj);
|
---|
800 | //TAttParticle *line = dynamic_cast<TAttParticle*>(obj);
|
---|
801 | //TAttTextCanvas *line = dynamic_cast<TAttTextCanvas*>(obj);
|
---|
802 | //TAttTextEditor *line = dynamic_cast<TAttTextEditor*>(obj);
|
---|
803 |
|
---|
804 | TPave *pave = dynamic_cast<TPave*>(obj);
|
---|
805 | TAttLine *line = dynamic_cast<TAttLine*>(obj);
|
---|
806 | TAttText *text = dynamic_cast<TAttText*>(obj);
|
---|
807 | TAttFill *fill = dynamic_cast<TAttFill*>(obj);
|
---|
808 | TAttMarker *mark = dynamic_cast<TAttMarker*>(obj);
|
---|
809 |
|
---|
810 | if (pave)
|
---|
811 | {
|
---|
812 | GetAttPave(name, *pave, dynamic_cast<TPave*>(dftl));
|
---|
813 | return;
|
---|
814 | }
|
---|
815 |
|
---|
816 | if (line)
|
---|
817 | GetAttLine(name, *line, dynamic_cast<TAttLine*>(dftl));
|
---|
818 | if (text)
|
---|
819 | GetAttText(name, *text, dynamic_cast<TAttText*>(dftl));
|
---|
820 | if (fill)
|
---|
821 | GetAttFill(name, *fill, dynamic_cast<TAttFill*>(dftl));
|
---|
822 | if (mark)
|
---|
823 | GetAttMarker(name, *mark, dynamic_cast<TAttMarker*>(dftl));
|
---|
824 | }
|
---|
825 |
|
---|
826 | //---------------------------------------------------------------------------
|
---|
827 | //
|
---|
828 | // Set the resources from a TAttLine:
|
---|
829 | // name.LineColor <see also SetColor>
|
---|
830 | // name.LineStyle
|
---|
831 | // name.LineWidth
|
---|
832 | //
|
---|
833 | void MEnv::SetAttLine(const char *name, const TAttLine &line)
|
---|
834 | {
|
---|
835 | const TString color = Compile(name, "LineColor");
|
---|
836 | const TString style = Compile(name, "LineStyle");
|
---|
837 | const TString width = Compile(name, "LineWidth");
|
---|
838 |
|
---|
839 | SetColor(color, line.GetLineColor());
|
---|
840 | SetLineStyle(style, line.GetLineStyle());
|
---|
841 | SetValue(width, line.GetLineWidth());
|
---|
842 | }
|
---|
843 |
|
---|
844 | //---------------------------------------------------------------------------
|
---|
845 | //
|
---|
846 | // Set the resources from a TAttText:
|
---|
847 | // name.TextColor <see also SetColor>
|
---|
848 | // name.TextAlign <see also SetAlign>
|
---|
849 | // name.TextAngle
|
---|
850 | // name.TextFont
|
---|
851 | // name.TextSize
|
---|
852 | //
|
---|
853 | void MEnv::SetAttText(const char *name, const TAttText &text)
|
---|
854 | {
|
---|
855 | const TString color = Compile(name, "TextColor");
|
---|
856 | const TString align = Compile(name, "TextAlign");
|
---|
857 | const TString angle = Compile(name, "TextAngle");
|
---|
858 | const TString font = Compile(name, "TextFont");
|
---|
859 | const TString size = Compile(name, "TextSize");
|
---|
860 |
|
---|
861 | SetColor(color, text.GetTextColor());
|
---|
862 | SetAlign(align, text.GetTextAlign());
|
---|
863 | SetValue(angle, text.GetTextAngle());
|
---|
864 | SetValue(font, text.GetTextFont());
|
---|
865 | SetValue(size, text.GetTextSize());
|
---|
866 | }
|
---|
867 |
|
---|
868 | //---------------------------------------------------------------------------
|
---|
869 | //
|
---|
870 | // Set the resources from a TAttFill:
|
---|
871 | // name.FillColor <see also SetColor>
|
---|
872 | // name.FillStyle <see also SetFillStyle>
|
---|
873 | //
|
---|
874 | void MEnv::SetAttFill(const char *name, const TAttFill &fill)
|
---|
875 | {
|
---|
876 | const TString color = Compile(name, "FillColor");
|
---|
877 | const TString style = Compile(name, "FillStyle");
|
---|
878 |
|
---|
879 | SetColor(color, fill.GetFillColor());
|
---|
880 | SetFillStyle(style, fill.GetFillStyle());
|
---|
881 | }
|
---|
882 |
|
---|
883 | //---------------------------------------------------------------------------
|
---|
884 | //
|
---|
885 | // Set the resources from a TAttMarker:
|
---|
886 | // name.MarkerColor <see also SetColor>
|
---|
887 | // name.MarkerStyle
|
---|
888 | // name.MarkerSize
|
---|
889 | //
|
---|
890 | void MEnv::SetAttMarker(const char *name, const TAttMarker &marker)
|
---|
891 | {
|
---|
892 | const TString color = Compile(name, "MarkerColor");
|
---|
893 | const TString style = Compile(name, "MarkerStyle");
|
---|
894 | const TString size = Compile(name, "MarkerSize");
|
---|
895 |
|
---|
896 | SetColor(color, marker.GetMarkerColor());
|
---|
897 | SetMarkerStyle(style, marker.GetMarkerStyle());
|
---|
898 | SetValue(size, marker.GetMarkerSize());
|
---|
899 | }
|
---|
900 |
|
---|
901 | //---------------------------------------------------------------------------
|
---|
902 | //
|
---|
903 | // Set the resources from a TPave:
|
---|
904 | // name.CornerRadius
|
---|
905 | // name.BorderSize
|
---|
906 | // name.Option
|
---|
907 | // Also all resources from TAttLine and TAttFill are supported.
|
---|
908 | //
|
---|
909 | void MEnv::SetAttPave(const char *str, const TPave &pave)
|
---|
910 | {
|
---|
911 | const TString name(str);
|
---|
912 |
|
---|
913 | SetAttLine(name, pave);
|
---|
914 | SetAttFill(name, pave);
|
---|
915 |
|
---|
916 | const TString corner = Compile(name, "CornerRadius");
|
---|
917 | const TString border = Compile(name, "BorderSize");
|
---|
918 | const TString option = Compile(name, "Option");
|
---|
919 |
|
---|
920 | SetValue(corner, const_cast<TPave&>(pave).GetCornerRadius());
|
---|
921 | SetValue(border, const_cast<TPave&>(pave).GetBorderSize());
|
---|
922 | SetValue(option, pave.GetOption());
|
---|
923 | }
|
---|
924 |
|
---|
925 | //---------------------------------------------------------------------------
|
---|
926 | //
|
---|
927 | // Set the attributed for the TObject obj.
|
---|
928 | //
|
---|
929 | // There is support for:
|
---|
930 | // TPave <see SetAttPave>
|
---|
931 | // TAttLine <see SetAttLine>
|
---|
932 | // TAttText <see SetAttText>
|
---|
933 | // TAttFill <see SetAttFill>
|
---|
934 | // TAttMarker <see SetAttMarker>
|
---|
935 | //
|
---|
936 | void MEnv::SetAttributes(const char *name, const TObject *obj)
|
---|
937 | {
|
---|
938 | const TPave *pave = dynamic_cast<const TPave*>(obj);
|
---|
939 | const TAttLine *line = dynamic_cast<const TAttLine*>(obj);
|
---|
940 | const TAttText *text = dynamic_cast<const TAttText*>(obj);
|
---|
941 | const TAttFill *fill = dynamic_cast<const TAttFill*>(obj);
|
---|
942 | const TAttMarker *mark = dynamic_cast<const TAttMarker*>(obj);
|
---|
943 |
|
---|
944 | if (pave)
|
---|
945 | {
|
---|
946 | SetAttPave(name, *pave);
|
---|
947 | return;
|
---|
948 | }
|
---|
949 |
|
---|
950 | if (line)
|
---|
951 | SetAttLine(name, *line);
|
---|
952 | if (text)
|
---|
953 | SetAttText(name, *text);
|
---|
954 | if (fill)
|
---|
955 | SetAttFill(name, *fill);
|
---|
956 | if (mark)
|
---|
957 | SetAttMarker(name, *mark);
|
---|
958 | }
|
---|
959 |
|
---|
960 | //---------------------------------------------------------------------------
|
---|
961 | //
|
---|
962 | // Add all values from TEnv env the this MEnv. To not overwrite existing
|
---|
963 | // values set overwrite to kFALSE
|
---|
964 | //
|
---|
965 | void MEnv::AddEnv(const TEnv &env, Bool_t overwrite)
|
---|
966 | {
|
---|
967 | if (!GetTable() || !env.GetTable())
|
---|
968 | return;
|
---|
969 |
|
---|
970 | TIter Next(env.GetTable());
|
---|
971 |
|
---|
972 | TEnvRec *er;
|
---|
973 | while ((er = (TEnvRec*)Next()))
|
---|
974 | {
|
---|
975 | if (overwrite || !Defined(er->GetName()))
|
---|
976 | SetValue(er->GetName(), er->GetValue(), er->GetLevel(), er->GetType());
|
---|
977 | }
|
---|
978 | }
|
---|
979 |
|
---|
980 | //---------------------------------------------------------------------------
|
---|
981 | //
|
---|
982 | // Check MArgs for all options "--rc=" and remove them. Options should be
|
---|
983 | // given like
|
---|
984 | //
|
---|
985 | // program --rc=Option1:Test1 --rc=Option2.SubOption:Test2
|
---|
986 | //
|
---|
987 | // If all resources could be interpeted corrctly kTRUE is returned. If
|
---|
988 | // there were problems kFALSE is returned.
|
---|
989 | //
|
---|
990 | Bool_t MEnv::TakeEnv(MArgs &arg, Bool_t print, Bool_t overwrite)
|
---|
991 | {
|
---|
992 | if (!GetTable())
|
---|
993 | {
|
---|
994 | gLog << err << "ERROR - MEnv not yet initialized." << endl;
|
---|
995 | return kFALSE;
|
---|
996 | }
|
---|
997 |
|
---|
998 | Bool_t ret = kTRUE;
|
---|
999 | while (1)
|
---|
1000 | {
|
---|
1001 | const TString rc = arg.GetStringAndRemove("--rc=");
|
---|
1002 | if (rc.IsNull())
|
---|
1003 | break;
|
---|
1004 |
|
---|
1005 | const Ssiz_t pos = rc.First(':');
|
---|
1006 | if (pos<0)
|
---|
1007 | {
|
---|
1008 | gLog << warn << "WARNING - Resource '" << rc << "' doesn't contain a colon... ignored." << endl;
|
---|
1009 | ret=kFALSE;
|
---|
1010 | continue;
|
---|
1011 | }
|
---|
1012 | if (pos==0)
|
---|
1013 | {
|
---|
1014 | gLog << warn << "WARNING - Resource '" << rc << "' doesn't contain a name... ignored." << endl;
|
---|
1015 | ret=kFALSE;
|
---|
1016 | continue;
|
---|
1017 | }
|
---|
1018 | if (pos==rc.Length()-1)
|
---|
1019 | {
|
---|
1020 | gLog << warn << "WARNING - Resource '" << rc << "' empty... ignored." << endl;
|
---|
1021 | ret=kFALSE;
|
---|
1022 | continue;
|
---|
1023 | }
|
---|
1024 |
|
---|
1025 | const TString name = rc(0, pos);
|
---|
1026 | const TString val = rc(pos+1, rc.Length());
|
---|
1027 |
|
---|
1028 | if (print)
|
---|
1029 | gLog << all << "Command line resource '" << name << "' with value '" << val << "'...";
|
---|
1030 |
|
---|
1031 | const Bool_t exists = Defined(name);
|
---|
1032 | if (!exists)
|
---|
1033 | {
|
---|
1034 | SetValue(name, val, kEnvLocal);
|
---|
1035 | if (print)
|
---|
1036 | gLog << "set." << endl;
|
---|
1037 | continue;
|
---|
1038 | }
|
---|
1039 |
|
---|
1040 | if (overwrite)
|
---|
1041 | {
|
---|
1042 | SetValue(name, "");
|
---|
1043 | SetValue(name, val, kEnvLocal);
|
---|
1044 | if (print)
|
---|
1045 | gLog << "changed." << endl;
|
---|
1046 | continue;
|
---|
1047 | }
|
---|
1048 |
|
---|
1049 | if (print)
|
---|
1050 | gLog << "skipped/existing." << endl;
|
---|
1051 | }
|
---|
1052 | return ret;
|
---|
1053 | }
|
---|
1054 |
|
---|
1055 | //---------------------------------------------------------------------------
|
---|
1056 | //
|
---|
1057 | // Add name and full path to output
|
---|
1058 | //
|
---|
1059 | void MEnv::PrintEnv(EEnvLevel level) const
|
---|
1060 | {
|
---|
1061 | cout << "# Path: " << GetRcName() << endl;
|
---|
1062 | cout << "# Name: " << GetName() << endl;
|
---|
1063 | TEnv::PrintEnv(level);
|
---|
1064 | }
|
---|
1065 |
|
---|
1066 | //---------------------------------------------------------------------------
|
---|
1067 | //
|
---|
1068 | // Print resources which have never been touched (for debugging)
|
---|
1069 | //
|
---|
1070 | void MEnv::PrintUntouched() const
|
---|
1071 | {
|
---|
1072 | int i=0;
|
---|
1073 | gLog << inf << flush;
|
---|
1074 |
|
---|
1075 | TString sep = "Untouched Resources in ";
|
---|
1076 | sep += GetRcName();
|
---|
1077 | gLog.Separator(sep);
|
---|
1078 | TIter Next(GetTable());
|
---|
1079 | TObject *o=0;
|
---|
1080 |
|
---|
1081 | while ((o=Next()))
|
---|
1082 | if (!fChecked.FindObject(o->GetName()))
|
---|
1083 | {
|
---|
1084 | gLog << warn << " - Resource " << o->GetName() << " untouched" << endl;
|
---|
1085 | i++;
|
---|
1086 | }
|
---|
1087 | if (i==0)
|
---|
1088 | gLog << inf << "None." << endl;
|
---|
1089 | else
|
---|
1090 | gLog << inf << i << " resources have not been touched." << endl;
|
---|
1091 | }
|
---|
1092 |
|
---|
1093 | //---------------------------------------------------------------------------
|
---|
1094 | //
|
---|
1095 | // Return number of resources which have not been touched.
|
---|
1096 | //
|
---|
1097 | Int_t MEnv::GetNumUntouched() const
|
---|
1098 | {
|
---|
1099 | int i=0;
|
---|
1100 | TIter Next(GetTable());
|
---|
1101 | TObject *o=0;
|
---|
1102 | while ((o=Next()))
|
---|
1103 | if (!fChecked.FindObject(o->GetName()))
|
---|
1104 | i++;
|
---|
1105 | return i;
|
---|
1106 | }
|
---|