]>
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> | |
5a5a1232 | 8 | #include <TString.h> |
3cc71cfc | 9 | #include <TError.h> |
915dabe1 | 10 | #include <Gtypes.h> |
5a5a1232 | 11 | |
5a5a1232 | 12 | class TVirtualPad; |
13 | class TGeoManager; | |
14 | ||
15 | namespace Reve { | |
16 | ||
a8600b56 | 17 | bool operator==(const TString& t, const std::string& s); |
18 | bool operator==(const std::string& s, const TString& t); | |
19 | ||
20 | class Exc_t : public std::exception, public TString | |
5a5a1232 | 21 | { |
22 | public: | |
23 | Exc_t() {} | |
a8600b56 | 24 | Exc_t(const TString& s) : TString(s) {} |
25 | Exc_t(const char* s) : TString(s) {} | |
26 | Exc_t(const std::string& s); | |
5a5a1232 | 27 | |
a8600b56 | 28 | virtual ~Exc_t() throw () {} |
5a5a1232 | 29 | |
a8600b56 | 30 | virtual const char* what() const throw () { return Data(); } |
5a5a1232 | 31 | |
a8600b56 | 32 | ClassDef(Exc_t, 1); |
5a5a1232 | 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 | ||
092578a7 | 41 | void ColorFromIdx(Color_t ci, UChar_t* col); |
42 | Color_t* FindColorVar(TObject* obj, const Text_t* varname); | |
915dabe1 | 43 | |
5a5a1232 | 44 | /**************************************************************************/ |
45 | /**************************************************************************/ | |
46 | ||
47 | void SetupEnvironment(); | |
48 | ||
f8fae956 | 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); | |
5a5a1232 | 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; | |
265ecb21 | 78 | |
79 | GeoManagerHolder(const GeoManagerHolder&); // Not implemented | |
80 | GeoManagerHolder& operator=(const GeoManagerHolder&); // Not implemented | |
81 | ||
5a5a1232 | 82 | public: |
83 | GeoManagerHolder(TGeoManager* new_gmgr=0); | |
84 | virtual ~GeoManagerHolder(); | |
85 | ||
86 | ClassDef(GeoManagerHolder, 0); | |
87 | }; | |
88 | ||
915dabe1 | 89 | /**************************************************************************/ |
90 | ||
91 | class ReferenceCount | |
92 | { | |
93 | protected: | |
94 | Int_t fRefCount; | |
95 | ||
96 | public: | |
97 | ReferenceCount() : fRefCount(0) {} | |
98 | virtual ~ReferenceCount() {} | |
99 | ||
100 | void IncRefCount() { ++fRefCount; } | |
101 | void DecRefCount() { if(--fRefCount <= 0) OnZeroRefCount(); } | |
102 | ||
103 | virtual void OnZeroRefCount() { delete this; } | |
104 | ||
105 | ClassDef(ReferenceCount, 0); | |
106 | }; | |
107 | ||
5a5a1232 | 108 | } |
109 | ||
110 | #endif |