]>
Commit | Line | Data |
---|---|---|
5a5a1232 | 1 | // $Header$ |
2 | ||
3 | #ifndef REVE_Reve_H | |
4 | #define REVE_Reve_H | |
5 | ||
6 | #include <string> | |
7 | #include <TString.h> | |
915dabe1 | 8 | #include <Gtypes.h> |
5a5a1232 | 9 | |
10 | inline bool operator==(const TString& t, const std::string& s) | |
11 | { return (s == t.Data()); } | |
12 | ||
13 | inline bool operator==(const std::string& s, const TString& t) | |
14 | { return (s == t.Data()); } | |
15 | ||
16 | class TVirtualPad; | |
17 | class TGeoManager; | |
18 | ||
19 | namespace Reve { | |
20 | ||
21 | class Exc_t : public std::string | |
22 | { | |
23 | public: | |
24 | Exc_t() {} | |
25 | Exc_t(const std::string& s) : std::string(s) {} | |
26 | Exc_t(const char* s) : std::string(s) {} | |
27 | ||
28 | virtual ~Exc_t() {} | |
29 | ||
30 | const char* Data() const { return c_str(); } | |
31 | ||
32 | ClassDef(Reve::Exc_t, 1); | |
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 | ||
49 | void AssertMacro(const Text_t* mac); | |
50 | void Macro(const Text_t* mac); | |
51 | void LoadMacro(const Text_t* mac); | |
52 | ||
53 | /**************************************************************************/ | |
54 | /**************************************************************************/ | |
55 | ||
56 | TVirtualPad* PushPad(TVirtualPad* new_gpad=0, Int_t subpad=0); | |
57 | TVirtualPad* PopPad(Bool_t modify_update_p=false); | |
58 | ||
59 | class PadHolder | |
60 | { | |
61 | private: | |
62 | Bool_t fModifyUpdateP; | |
63 | public: | |
64 | PadHolder(Bool_t modify_update_p, TVirtualPad* new_gpad=0, Int_t subpad=0) : | |
65 | fModifyUpdateP(modify_update_p) | |
66 | { PushPad(new_gpad, subpad); } | |
67 | ||
68 | virtual ~PadHolder() { PopPad(fModifyUpdateP); } | |
69 | ||
70 | ClassDef(PadHolder, 0); | |
71 | }; | |
72 | ||
73 | class GeoManagerHolder | |
74 | { | |
75 | private: | |
76 | TGeoManager* fManager; | |
77 | public: | |
78 | GeoManagerHolder(TGeoManager* new_gmgr=0); | |
79 | virtual ~GeoManagerHolder(); | |
80 | ||
81 | ClassDef(GeoManagerHolder, 0); | |
82 | }; | |
83 | ||
915dabe1 | 84 | /**************************************************************************/ |
85 | ||
86 | class ReferenceCount | |
87 | { | |
88 | protected: | |
89 | Int_t fRefCount; | |
90 | ||
91 | public: | |
92 | ReferenceCount() : fRefCount(0) {} | |
93 | virtual ~ReferenceCount() {} | |
94 | ||
95 | void IncRefCount() { ++fRefCount; } | |
96 | void DecRefCount() { if(--fRefCount <= 0) OnZeroRefCount(); } | |
97 | ||
98 | virtual void OnZeroRefCount() { delete this; } | |
99 | ||
100 | ClassDef(ReferenceCount, 0); | |
101 | }; | |
102 | ||
5a5a1232 | 103 | } |
104 | ||
105 | #endif |