StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StObject.h
1 // $Id: StObject.h,v 1.21 2021/05/11 23:57:40 perev Exp $
2 // $Log: StObject.h,v $
3 // Revision 1.21 2021/05/11 23:57:40 perev
4 // TBuffer.h added fpr compatibility Star6
5 //
6 // Revision 1.20 2015/08/28 19:54:18 perev
7 // Add specific copy constructor to StObject.
8 // This ctr set zero to bit 1<<22. This boit means that object belongs
9 // to structured container. But copy obviously not.
10 //
11 // Revision 1.19 2012/06/11 15:08:41 fisyak
12 // std namespace, warn off for x64
13 //
14 // Revision 1.18 2012/02/21 18:48:37 perev
15 // I/O mode flag added
16 //
17 // Revision 1.15 2007/04/26 04:16:41 perev
18 // Remove senseless comment
19 //
20 // Revision 1.14 2007/03/15 16:27:32 fine
21 // Allow user to select the arbitrary StEvent object to be drawn with StEventDisplay
22 //
23 // Revision 1.13 2002/11/26 02:23:38 perev
24 // new ROOT adoptation
25 //
26 // Revision 1.12 2001/05/30 17:46:42 perev
27 // StEvent branching
28 //
29 // Revision 1.11 2000/12/09 02:11:02 perev
30 // clone() called Clone()
31 //
32 //
33 
34 #ifndef STAR_StObject
35 #define STAR_StObject
36 
37 
39 // //
40 // StObject class is a base class to implement StEvent //
41 // //
43 #include "TBuffer.h"
44 #include "TDataSet.h"
45 
46 class StXRefManager;
47 class StXRefMain;
48 class StRefArray;
49 class StStrArray;
50 
51 enum EStObjectDrawBit { kMark2Draw = BIT(24)}; // mark object to be rendered by "EventDisplay"
52 
53 //_____________________________________________________________________________
54 class StObject : public TObject {
55 
56 public:
57  StObject(){;}
58  StObject(const StObject &sto);
59  StObject &operator=(const StObject &sto);
60  virtual ~StObject();
61 
62  virtual TObject *clone() const {return ((TObject*)this)->Clone();}
63  Int_t isZombie() const {return IsZombie();}
64  virtual void makeZombie(int flg=1)
65  {if (flg) {MakeZombie();} else {((UInt_t*)this)[1] &=~(kZombie);}}
66  UInt_t Ztreamer(TBuffer &R__b);
67  ClassDef(StObject,3) // Base class for StEvent
68 
69 static UInt_t fgTally;
70 
71 };
72 
73 //_____________________________________________________________________________
75 // //
76 // StUUDGen //
77 // The uuidgen creates a new universally unique identifier (UUID) //
78 // using the libuuid(3) library. //
79 // //
81 class StUUId
82 {
83 protected:
84  UInt_t fID[4];
85 public:
86  StUUId();
87 virtual ~StUUId(){};
88 void Generate();
89 StUUId &operator=(const StUUId &from);
90 StUUId &operator=(const char *from);
91 Int_t IsNull() const {return (fID[3]==0);}
92 
93 //void Streamer(TBuffer &b);
94 int Compare(const StUUId &u2) const;
95 ClassDef(StUUId,1)
96 };
97 
98 
99 #include "TDataSet.h"
100 
101 //_____________________________________________________________________________
102 class StXRef :public TDataSet
103 {
104 public:
105 StXRef(const char *brName="", StXRefMain *evt=0, UInt_t tally=0);
106 virtual ~StXRef();
107 
108 virtual StXRefMain *MakeMain() = 0 ;
109  virtual void Synchro(int /* toMain */) = 0 ;
110 virtual StXRefMain *GetMain();
111 virtual int IsMain() const {return 0;}
112 virtual void SetMain(StXRefMain *m) {fMain = m;}
113 virtual void Add(TDataSet *ds);
114  const StUUId &GetUUId() const {return fUUId;}
115  void SetUUId(const StUUId &id){fUUId = id;}
116  void GenUUId() {fUUId.Generate();}
117  void SetTally(UInt_t tally) {fTally = tally;}
118  UInt_t GetTally() {return fTally;}
119 private:
120 
121 StUUId fUUId;
122 UInt_t fTally;
123 StXRefMain *fMain;
124 ClassDef(StXRef,1)
125 };
126 
127 
128 
129 //_____________________________________________________________________________
130 class StXRefMain :public StXRef {
131 public:
132  StXRefMain(const char *name="") : StXRef(name){};
133 virtual ~StXRefMain();
134 virtual void Split()=0;
135 virtual StXRefMain *MakeMain() {return this;}
136 virtual void Synchro(int toMain){};
137 ClassDef(StXRefMain,1)
138 };
139 
140 //_____________________________________________________________________________
141 class TPageMap {
142 
143 enum EPageMap {kPAGE=2048,kBITS=11,kBITZ=22,kMASK=0x7ff,kLAST=0xfffff800};
144 public:
145  TPageMap();
146 ~TPageMap();
147 
148 ULong_t *GET(UInt_t udx) ;
149 ULong_t *Get(UInt_t udx) ;
150 void GetMiMax(UInt_t &udxMin,UInt_t &udxMax) {udxMin=fMinUdx;udxMax=fMaxUdx;}
151 
152 static void Test();
153 private:
154 ULong_t *NewPage();
155 
156 ULong_t *fTopPage;
157 ULong_t *fLstPage;
158 UInt_t fLstUdx;
159 ULong_t *fList;
160 UInt_t fMinUdx;
161 UInt_t fMaxUdx;
162 
163 
164 };
165 #ifndef __CINT__
166 #include <list>
167 #include <vector>
168 #ifndef ST_NO_NAMESPACES
169 using namespace std;
170 #endif
171 class StProxyUrr;
172 
173 typedef list<StProxyUrr*> StCollList;
174 typedef StCollList::iterator StCollListIter;
175 typedef list<StXRefManager*> StXRefManagerList;
176 typedef StXRefManagerList::iterator StXRefManagerListIter;
177 typedef vector<UInt_t> UIntVector;
178 typedef UIntVector::iterator UIntVectorIter;
179 //_____________________________________________________________________________
180 
181 
182 //_____________________________________________________________________________
183 class StProxyUrr : public UIntVector {
184 public:
185  StProxyUrr(TObject *coll){fArr = coll; fType=0;}
186  StProxyUrr(TObject **adr){fAdr = adr; fType=1;}
187  StProxyUrr(StObject **adr){fAdr = (TObject **)adr; fType=1;}
188  ~StProxyUrr(){fArr = 0;}
189 int GetType() {return fType;}
190 TObject *GetArr() {return fArr;}
191 TObject **GetAdr() {return fAdr;}
192 
193 private:
194 int fType;
195 union {
196  TObject *fArr;
197  TObject **fAdr;};
198 };
199 
200 
201 class StXRefManager : public TObject
202 {
203 public:
204  StXRefManager(const StUUId &id);
205  ~StXRefManager();
206 
207  void Cd();
208  void AddColl ( StProxyUrr *rarr);
209  void AddColl (const StStrArray *sarr);
210  void Update ();
211  void Clear (Option_t*);
212 static void Cd (StXRef *xref);
213 static void Open (StXRef *xref);
214 static void Close (StXRef *xref);
215 static TDataSet *GetMain();
216 
217 private:
218  Int_t fUpd;
219  UInt_t fTally;
220  StUUId fUUId;
221  StCollList fColList;
222  TPageMap fObjTab;
223  StXRefMain *fMain;
224 public:
225 static StXRefManagerList fgManagerList;
226 static StXRefManager *fgManager;
227 static int fgRWmode; //0=read,1=write,-1=undefined
228 
229 };
230 
231 #endif // -__CINT__
232 #endif
233 
234 
235 
236 
237 
238 
239 
240 
241 
242 
243 
244 
245 
246 
247 
248 
249 
250