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