]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Reve/Reve.h
Fix effc++ warnings.
[u/mrichter/AliRoot.git] / EVE / Reve / Reve.h
1 // $Header$
2
3 #ifndef REVE_Reve_H
4 #define REVE_Reve_H
5
6 #include <string>
7 #include <TString.h>
8 #include <TError.h>
9 #include <Gtypes.h>
10
11 inline bool operator==(const TString& t, const std::string& s)
12 { return (s == t.Data()); }
13
14 inline bool operator==(const std::string&  s, const TString& t)
15 { return (s == t.Data()); }
16
17 class TVirtualPad;
18 class TGeoManager;
19
20 namespace Reve {
21
22 class Exc_t : public std::string
23 {
24  public:
25   Exc_t() {}
26   Exc_t(const std::string& s) : std::string(s) {}
27   Exc_t(const char* s)        : std::string(s) {}
28
29   virtual ~Exc_t() {}
30
31   const char* Data() const { return c_str(); }
32
33   ClassDef(Reve::Exc_t, 1);
34 };
35
36 Exc_t operator+(const Exc_t &s1, const std::string  &s2);
37 Exc_t operator+(const Exc_t &s1, const TString &s2);
38 Exc_t operator+(const Exc_t &s1, const char    *s2);
39
40 void WarnCaller(const TString& warning);
41
42 void     ColorFromIdx(Color_t ci, UChar_t* col);
43 Color_t* FindColorVar(TObject* obj, const Text_t* varname);
44
45 /**************************************************************************/
46 /**************************************************************************/
47
48 void SetupEnvironment();
49
50 Bool_t CheckMacro(const Text_t* mac);
51 void   AssertMacro(const Text_t* mac);
52 void   Macro(const Text_t* mac);
53 void   LoadMacro(const Text_t* mac);
54
55 /**************************************************************************/
56 /**************************************************************************/
57
58 TVirtualPad* PushPad(TVirtualPad* new_gpad=0, Int_t subpad=0);
59 TVirtualPad* PopPad(Bool_t modify_update_p=false);
60
61 class PadHolder
62 {
63 private:
64   Bool_t fModifyUpdateP;
65 public:
66   PadHolder(Bool_t modify_update_p, TVirtualPad* new_gpad=0, Int_t subpad=0) :
67     fModifyUpdateP(modify_update_p)
68   { PushPad(new_gpad, subpad); }
69
70   virtual ~PadHolder() { PopPad(fModifyUpdateP); }
71
72   ClassDef(PadHolder, 0);
73 };
74
75 class GeoManagerHolder
76 {
77 private:
78   TGeoManager* fManager;
79
80   GeoManagerHolder(const GeoManagerHolder&);            // Not implemented
81   GeoManagerHolder& operator=(const GeoManagerHolder&); // Not implemented
82
83 public:
84   GeoManagerHolder(TGeoManager* new_gmgr=0);
85   virtual ~GeoManagerHolder();
86
87   ClassDef(GeoManagerHolder, 0);
88 };
89
90 /**************************************************************************/
91
92 class ReferenceCount
93 {
94 protected:
95   Int_t fRefCount;
96
97 public:
98   ReferenceCount() : fRefCount(0) {}
99   virtual ~ReferenceCount() {}
100
101   void IncRefCount() { ++fRefCount; }
102   void DecRefCount() { if(--fRefCount <= 0) OnZeroRefCount(); }
103
104   virtual void OnZeroRefCount() { delete this; }
105
106   ClassDef(ReferenceCount, 0);
107 };
108
109 }
110
111 #endif