]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Reve/Reve.h
Getting rid of effC++ warnings about missing copy constructor and assignment operator.
[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 <exception>
8 #include <list>
9 #include <set>
10
11 #include <TObject.h>
12 #include <TString.h>
13 #include <TError.h>
14 #include <Gtypes.h>
15 #include <GuiTypes.h>
16
17 class TVirtualPad;
18 class TGeoManager;
19
20 namespace Reve {
21
22 class RenderElement;
23
24 /**************************************************************************/
25 // Exceptions, string functions
26 /**************************************************************************/
27
28 bool operator==(const TString& t, const std::string& s);
29 bool operator==(const std::string& s, const TString& t);
30
31 class Exc_t : public std::exception, public TString
32 {
33  public:
34   Exc_t() {}
35   Exc_t(const TString& s) : TString(s) {}
36   Exc_t(const char* s)    : TString(s) {}
37   Exc_t(const std::string& s);
38
39   virtual ~Exc_t() throw () {}
40
41   virtual const char* what() const throw () { return Data(); }
42
43   ClassDef(Exc_t, 1);
44 };
45
46 Exc_t operator+(const Exc_t &s1, const std::string  &s2);
47 Exc_t operator+(const Exc_t &s1, const TString &s2);
48 Exc_t operator+(const Exc_t &s1, const char    *s2);
49
50 void  WarnCaller(const TString& warning);
51
52
53 /**************************************************************************/
54 // Environment, Macro functions
55 /**************************************************************************/
56
57 void   SetupEnvironment();
58 void   SetupGUI();
59
60 Bool_t CheckMacro(const Text_t* mac);
61 void   AssertMacro(const Text_t* mac);
62 void   Macro(const Text_t* mac);
63 void   LoadMacro(const Text_t* mac);
64
65
66 /**************************************************************************/
67 // Local cache for global Pad, GeoManager 
68 /**************************************************************************/
69
70 TVirtualPad* PushPad(TVirtualPad* new_gpad=0, Int_t subpad=0);
71 TVirtualPad* PopPad(Bool_t modify_update_p=false);
72
73 class PadHolder
74 {
75 private:
76   Bool_t fModifyUpdateP;
77 public:
78   PadHolder(Bool_t modify_update_p, TVirtualPad* new_gpad=0, Int_t subpad=0) :
79     fModifyUpdateP(modify_update_p)
80   { PushPad(new_gpad, subpad); }
81
82   virtual ~PadHolder() { PopPad(fModifyUpdateP); }
83
84   ClassDef(PadHolder, 0);
85 };
86
87 class GeoManagerHolder
88 {
89 private:
90   TGeoManager* fManager;
91
92   GeoManagerHolder(const GeoManagerHolder&);            // Not implemented
93   GeoManagerHolder& operator=(const GeoManagerHolder&); // Not implemented
94
95 public:
96   GeoManagerHolder(TGeoManager* new_gmgr=0);
97   virtual ~GeoManagerHolder();
98
99   ClassDef(GeoManagerHolder, 0);
100 };
101
102
103 /**************************************************************************/
104 // ReferenceCount base-class (interface)
105 /**************************************************************************/
106
107 class ReferenceCount
108 {
109 protected:
110   Int_t fRefCount;
111
112 public:
113   ReferenceCount() : fRefCount(0) {}
114   virtual ~ReferenceCount() {}
115
116   ReferenceCount(const ReferenceCount&) : fRefCount(0) {}
117   ReferenceCount& operator=(const ReferenceCount&) { return *this; }
118
119   void IncRefCount() { ++fRefCount; }
120   void DecRefCount() { if(--fRefCount <= 0) OnZeroRefCount(); }
121
122   virtual void OnZeroRefCount() { delete this; }
123
124   ClassDef(ReferenceCount, 0);
125 };
126
127 /**************************************************************************/
128 // ReferenceBackPtr reference-count with back pointers
129 /**************************************************************************/
130
131 class ReferenceBackPtr : public ReferenceCount
132 {
133 protected:
134   std::list<RenderElement*> fBackRefs;
135
136 public:
137   ReferenceBackPtr();
138   virtual ~ReferenceBackPtr();
139
140   ReferenceBackPtr(const ReferenceBackPtr&);
141   ReferenceBackPtr& operator=(const ReferenceBackPtr&);
142
143   using ReferenceCount::IncRefCount;
144   using ReferenceCount::DecRefCount;
145   virtual void IncRefCount(RenderElement* re);
146   virtual void DecRefCount(RenderElement* re);
147
148   virtual void UpdateBackPtrItems();
149
150   ClassDef(ReferenceBackPtr, 0);
151 };
152
153
154 /**************************************************************************/
155 // Color management
156 /**************************************************************************/
157
158 void     ColorFromIdx(Color_t ci, UChar_t* col, Bool_t alpha=kTRUE);
159 void     ColorFromIdx(Float_t f1, Color_t c1, Float_t f2, Color_t c2,
160                       UChar_t* col, Bool_t alpha=kTRUE);
161 Color_t* FindColorVar(TObject* obj, const Text_t* varname);
162
163 }
164
165 #endif