]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Reve/Reve.h
Removed code for gled-like object editors (obsolete, somewhat decayed); fix effc...
[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 public:
80   GeoManagerHolder(TGeoManager* new_gmgr=0);
81   virtual ~GeoManagerHolder();
82
83   ClassDef(GeoManagerHolder, 0);
84 };
85
86 /**************************************************************************/
87
88 class ReferenceCount
89 {
90 protected:
91   Int_t fRefCount;
92
93 public:
94   ReferenceCount() : fRefCount(0) {}
95   virtual ~ReferenceCount() {}
96
97   void IncRefCount() { ++fRefCount; }
98   void DecRefCount() { if(--fRefCount <= 0) OnZeroRefCount(); }
99
100   virtual void OnZeroRefCount() { delete this; }
101
102   ClassDef(ReferenceCount, 0);
103 };
104
105 }
106
107 #endif