]>
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> | |
51a6ecc6 | 8 | #include <TObject.h> |
5a5a1232 | 9 | #include <TString.h> |
3cc71cfc | 10 | #include <TError.h> |
915dabe1 | 11 | #include <Gtypes.h> |
843e6acd | 12 | #include <GuiTypes.h> |
5a5a1232 | 13 | |
5a5a1232 | 14 | class TVirtualPad; |
15 | class TGeoManager; | |
16 | ||
17 | namespace Reve { | |
18 | ||
843e6acd | 19 | class RenderElement; |
51a6ecc6 | 20 | |
21 | /**************************************************************************/ | |
22 | // Exceptions, string functions | |
23 | /**************************************************************************/ | |
24 | ||
a8600b56 | 25 | bool operator==(const TString& t, const std::string& s); |
26 | bool operator==(const std::string& s, const TString& t); | |
27 | ||
28 | class Exc_t : public std::exception, public TString | |
5a5a1232 | 29 | { |
30 | public: | |
31 | Exc_t() {} | |
a8600b56 | 32 | Exc_t(const TString& s) : TString(s) {} |
33 | Exc_t(const char* s) : TString(s) {} | |
34 | Exc_t(const std::string& s); | |
5a5a1232 | 35 | |
a8600b56 | 36 | virtual ~Exc_t() throw () {} |
5a5a1232 | 37 | |
a8600b56 | 38 | virtual const char* what() const throw () { return Data(); } |
5a5a1232 | 39 | |
a8600b56 | 40 | ClassDef(Exc_t, 1); |
5a5a1232 | 41 | }; |
42 | ||
43 | Exc_t operator+(const Exc_t &s1, const std::string &s2); | |
44 | Exc_t operator+(const Exc_t &s1, const TString &s2); | |
45 | Exc_t operator+(const Exc_t &s1, const char *s2); | |
46 | ||
51a6ecc6 | 47 | void WarnCaller(const TString& warning); |
5a5a1232 | 48 | |
915dabe1 | 49 | |
5a5a1232 | 50 | /**************************************************************************/ |
51a6ecc6 | 51 | // Environment, Macro functions |
5a5a1232 | 52 | /**************************************************************************/ |
53 | ||
51a6ecc6 | 54 | void SetupEnvironment(); |
5a5a1232 | 55 | |
f8fae956 | 56 | Bool_t CheckMacro(const Text_t* mac); |
57 | void AssertMacro(const Text_t* mac); | |
58 | void Macro(const Text_t* mac); | |
59 | void LoadMacro(const Text_t* mac); | |
5a5a1232 | 60 | |
51a6ecc6 | 61 | |
5a5a1232 | 62 | /**************************************************************************/ |
51a6ecc6 | 63 | // Local cache for global Pad, GeoManager |
5a5a1232 | 64 | /**************************************************************************/ |
65 | ||
66 | TVirtualPad* PushPad(TVirtualPad* new_gpad=0, Int_t subpad=0); | |
67 | TVirtualPad* PopPad(Bool_t modify_update_p=false); | |
68 | ||
69 | class PadHolder | |
70 | { | |
71 | private: | |
72 | Bool_t fModifyUpdateP; | |
73 | public: | |
74 | PadHolder(Bool_t modify_update_p, TVirtualPad* new_gpad=0, Int_t subpad=0) : | |
75 | fModifyUpdateP(modify_update_p) | |
76 | { PushPad(new_gpad, subpad); } | |
77 | ||
78 | virtual ~PadHolder() { PopPad(fModifyUpdateP); } | |
79 | ||
80 | ClassDef(PadHolder, 0); | |
81 | }; | |
82 | ||
83 | class GeoManagerHolder | |
84 | { | |
85 | private: | |
86 | TGeoManager* fManager; | |
265ecb21 | 87 | |
88 | GeoManagerHolder(const GeoManagerHolder&); // Not implemented | |
89 | GeoManagerHolder& operator=(const GeoManagerHolder&); // Not implemented | |
90 | ||
5a5a1232 | 91 | public: |
92 | GeoManagerHolder(TGeoManager* new_gmgr=0); | |
93 | virtual ~GeoManagerHolder(); | |
94 | ||
95 | ClassDef(GeoManagerHolder, 0); | |
96 | }; | |
97 | ||
51a6ecc6 | 98 | |
99 | /**************************************************************************/ | |
100 | // ReferenceCount base-class (interface) | |
915dabe1 | 101 | /**************************************************************************/ |
102 | ||
103 | class ReferenceCount | |
104 | { | |
105 | protected: | |
106 | Int_t fRefCount; | |
107 | ||
108 | public: | |
109 | ReferenceCount() : fRefCount(0) {} | |
110 | virtual ~ReferenceCount() {} | |
111 | ||
843e6acd | 112 | ReferenceCount(const ReferenceCount&) : fRefCount(0) {} |
113 | ReferenceCount& operator=(const ReferenceCount&) { return *this; } | |
114 | ||
915dabe1 | 115 | void IncRefCount() { ++fRefCount; } |
116 | void DecRefCount() { if(--fRefCount <= 0) OnZeroRefCount(); } | |
117 | ||
118 | virtual void OnZeroRefCount() { delete this; } | |
119 | ||
120 | ClassDef(ReferenceCount, 0); | |
121 | }; | |
122 | ||
51a6ecc6 | 123 | |
124 | /**************************************************************************/ | |
843e6acd | 125 | // Color management |
51a6ecc6 | 126 | /**************************************************************************/ |
127 | ||
128 | void ColorFromIdx(Color_t ci, UChar_t* col, Bool_t alpha=kTRUE); | |
129 | void ColorFromIdx(Float_t f1, Color_t c1, Float_t f2, Color_t c2, | |
130 | UChar_t* col, Bool_t alpha=kTRUE); | |
131 | Color_t* FindColorVar(TObject* obj, const Text_t* varname); | |
132 | ||
5a5a1232 | 133 | } |
134 | ||
135 | #endif |