source: trunk/MagicSoft/Mars/mbase/MEnv.cc@ 7184

Last change on this file since 7184 was 6553, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 2.4 KB
Line 
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-2005
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//////////////////////////////////////////////////////////////////////////////
34#include "MEnv.h"
35
36#include <TObjString.h>
37
38#include "MLog.h"
39#include "MLogManip.h"
40
41ClassImp(MEnv);
42
43using namespace std;
44
45Int_t MEnv::GetValue(const char *name, Int_t dflt)
46{
47 if (!fChecked.FindObject(name))
48 fChecked.Add(new TObjString(name));
49 return TEnv::GetValue(name, dflt);
50}
51
52Double_t MEnv::GetValue(const char *name, Double_t dflt)
53{
54 if (!fChecked.FindObject(name))
55 fChecked.Add(new TObjString(name));
56 return TEnv::GetValue(name, dflt);
57}
58
59const char *MEnv::GetValue(const char *name, const char *dflt)
60{
61 if (!fChecked.FindObject(name))
62 fChecked.Add(new TObjString(name));
63 return TEnv::GetValue(name, dflt);
64}
65
66void MEnv::PrintUntouched() const
67{
68 int i=0;
69 gLog << inf << flush;
70 gLog.Separator("Untouched Resources");
71 TIter Next(GetTable());
72 TObject *o=0;
73 while ((o=Next()))
74 if (!fChecked.FindObject(o->GetName()))
75 {
76 gLog << warn << " - Resource " << o->GetName() << " not touched" << endl;
77 i++;
78 }
79 if (i==0)
80 gLog << inf << "None." << endl;
81 else
82 gLog << inf << i << " resources have not been touched." << endl;
83}
Note: See TracBrowser for help on using the repository browser.