]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Reve/Reve.h
First big commit of the mchview program and its accompanying library,
[u/mrichter/AliRoot.git] / EVE / Reve / Reve.h
CommitLineData
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 17class TVirtualPad;
18class TGeoManager;
19
20namespace Reve {
21
843e6acd 22class RenderElement;
51a6ecc6 23
24/**************************************************************************/
25// Exceptions, string functions
26/**************************************************************************/
27
a8600b56 28bool operator==(const TString& t, const std::string& s);
29bool operator==(const std::string& s, const TString& t);
30
31class 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
46Exc_t operator+(const Exc_t &s1, const std::string &s2);
47Exc_t operator+(const Exc_t &s1, const TString &s2);
48Exc_t operator+(const Exc_t &s1, const char *s2);
49
51a6ecc6 50void WarnCaller(const TString& warning);
5a5a1232 51
915dabe1 52
5a5a1232 53/**************************************************************************/
51a6ecc6 54// Environment, Macro functions
5a5a1232 55/**************************************************************************/
56
51a6ecc6 57void SetupEnvironment();
83f960dc 58void SetupGUI();
5a5a1232 59
f8fae956 60Bool_t CheckMacro(const Text_t* mac);
61void AssertMacro(const Text_t* mac);
62void Macro(const Text_t* mac);
63void LoadMacro(const Text_t* mac);
5a5a1232 64
51a6ecc6 65
5a5a1232 66/**************************************************************************/
51a6ecc6 67// Local cache for global Pad, GeoManager
5a5a1232 68/**************************************************************************/
69
70TVirtualPad* PushPad(TVirtualPad* new_gpad=0, Int_t subpad=0);
71TVirtualPad* PopPad(Bool_t modify_update_p=false);
72
73class PadHolder
74{
75private:
76 Bool_t fModifyUpdateP;
77public:
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
87class GeoManagerHolder
88{
89private:
90 TGeoManager* fManager;
265ecb21 91
92 GeoManagerHolder(const GeoManagerHolder&); // Not implemented
93 GeoManagerHolder& operator=(const GeoManagerHolder&); // Not implemented
94
5a5a1232 95public:
96 GeoManagerHolder(TGeoManager* new_gmgr=0);
97 virtual ~GeoManagerHolder();
98
99 ClassDef(GeoManagerHolder, 0);
100};
101
51a6ecc6 102
103/**************************************************************************/
104// ReferenceCount base-class (interface)
915dabe1 105/**************************************************************************/
106
107class ReferenceCount
108{
109protected:
110 Int_t fRefCount;
111
112public:
113 ReferenceCount() : fRefCount(0) {}
114 virtual ~ReferenceCount() {}
115
843e6acd 116 ReferenceCount(const ReferenceCount&) : fRefCount(0) {}
117 ReferenceCount& operator=(const ReferenceCount&) { return *this; }
118
915dabe1 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
465af230 127/**************************************************************************/
128// ReferenceBackPtr reference-count with back pointers
129/**************************************************************************/
130
131class ReferenceBackPtr : public ReferenceCount
132{
133protected:
134 std::list<RenderElement*> fBackRefs;
135
136public:
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
51a6ecc6 153
154/**************************************************************************/
843e6acd 155// Color management
51a6ecc6 156/**************************************************************************/
157
158void ColorFromIdx(Color_t ci, UChar_t* col, Bool_t alpha=kTRUE);
159void ColorFromIdx(Float_t f1, Color_t c1, Float_t f2, Color_t c2,
160 UChar_t* col, Bool_t alpha=kTRUE);
161Color_t* FindColorVar(TObject* obj, const Text_t* varname);
162
5a5a1232 163}
164
165#endif