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