ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TBufferFile.h
Go to the documentation of this file.
1 // @(#)root/io:$Id: 697641b2b52ed3d97bb5bde0fb5d2ff4a2f6c24f $
2 // Author: Rene Brun 17/01/2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TBufferFile
13 #define ROOT_TBufferFile
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TBufferFile //
19 // //
20 // The concrete implementation of TBuffer for writing/reading to/from a //
21 // ROOT file or socket. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #ifndef ROOT_TBuffer
26 #include "TBuffer.h"
27 #endif
28 #ifndef ROOT_Bytes
29 #include "Bytes.h"
30 #endif
31 
32 #include <vector>
33 
34 #ifdef R__OLDHPACC
35 namespace std {
36  using ::string;
37  using ::vector;
38 }
39 #endif
40 
42 class TStreamerInfo;
43 class TStreamerElement;
44 class TClass;
45 class TExMap;
46 class TVirtualArray;
47 namespace TStreamerInfoActions {
48  class TActionSequence;
49 }
50 
51 class TBufferFile : public TBuffer {
52 
53 protected:
54  typedef std::vector<TStreamerInfo*> InfoList_t;
55 
56  Int_t fMapCount; ///< Number of objects or classes in map
57  Int_t fMapSize; ///< Default size of map
58  Int_t fDisplacement; ///< Value to be added to the map offsets
59  UShort_t fPidOffset; ///< Offset to be added to the pid index in this key/buffer.
60  TExMap *fMap; ///< Map containing object,offset pairs for reading/writing
61  TExMap *fClassMap; ///< Map containing object,class pairs for reading
62  TStreamerInfo *fInfo; ///< Pointer to TStreamerInfo object writing/reading the buffer
63  InfoList_t fInfoStack; ///< Stack of pointers to the TStreamerInfos
64 
65  static Int_t fgMapSize; ///< Default map size for all TBuffer objects
66 
67  // Default ctor
69  fDisplacement(0),fPidOffset(0), fMap(0), fClassMap(0),
70  fInfo(0), fInfoStack() {}
71 
72  // TBuffer objects cannot be copied or assigned
73  TBufferFile(const TBufferFile &); ///< not implemented
74  void operator=(const TBufferFile &); ///< not implemented
75 
76  Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss, const char* classname);
77  void CheckCount(UInt_t offset);
78  UInt_t CheckObject(UInt_t offset, const TClass *cl, Bool_t readClass = kFALSE);
79 
80  virtual void WriteObjectClass(const void *actualObjStart, const TClass *actualClass);
81 
82 public:
83  enum { kMapSize = 503 };
84  enum { kStreamedMemberWise = BIT(14) }; //added to version number to know if a collection has been stored member-wise
85  enum { kNotDecompressed = BIT(15) }; //indicates a weird buffer, used by TBasket
86  enum { kTextBasedStreaming = BIT(18) }; //indicates if buffer used for XML/SQL object streaming
87  enum { kUser1 = BIT(21), kUser2 = BIT(22), kUser3 = BIT(23)}; //free for user
88 
90  TBufferFile(TBuffer::EMode mode, Int_t bufsiz);
91  TBufferFile(TBuffer::EMode mode, Int_t bufsiz, void *buf, Bool_t adopt = kTRUE, ReAllocCharFun_t reallocfunc = 0);
92  virtual ~TBufferFile();
93 
94  Int_t GetMapCount() const { return fMapCount; }
95  void GetMappedObject(UInt_t tag, void* &ptr, TClass* &ClassPtr) const;
96  void MapObject(const TObject *obj, UInt_t offset = 1);
97  void MapObject(const void *obj, const TClass *cl, UInt_t offset = 1);
98  void Reset() { SetBufferOffset(); ResetMap(); }
99  void InitMap();
100  void ResetMap();
101  void SetReadParam(Int_t mapsize);
102  void SetWriteParam(Int_t mapsize);
103 
104  Bool_t CheckObject(const TObject *obj);
105  Bool_t CheckObject(const void *obj, const TClass *ptrClass);
106 
107  virtual Int_t GetVersionOwner() const;
108  virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss);
109  virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const char *classname);
110  virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion = kFALSE);
111 
112  virtual void SkipVersion(const TClass *cl = 0);
113  virtual Version_t ReadVersion(UInt_t *start = 0, UInt_t *bcnt = 0, const TClass *cl = 0);
114  virtual Version_t ReadVersionNoCheckSum(UInt_t *start = 0, UInt_t *bcnt = 0);
115  virtual Version_t ReadVersionForMemberWise(const TClass *cl = 0);
116  virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt = kFALSE);
117  virtual UInt_t WriteVersionMemberWise(const TClass *cl, Bool_t useBcnt = kFALSE);
118 
119  virtual void *ReadObjectAny(const TClass* cast);
120  virtual void SkipObjectAny();
121 
122  virtual void TagStreamerInfo(TVirtualStreamerInfo* info);
123  virtual void IncrementLevel(TVirtualStreamerInfo* info);
125  virtual void DecrementLevel(TVirtualStreamerInfo*);
127  virtual void ClassBegin(const TClass*, Version_t = -1) {}
128  virtual void ClassEnd(const TClass*) {}
129  virtual void ClassMember(const char*, const char* = 0, Int_t = -1, Int_t = -1) {}
130 
131  virtual Int_t ReadBuf(void *buf, Int_t max);
132  virtual void WriteBuf(const void *buf, Int_t max);
133 
134  virtual char *ReadString(char *s, Int_t max);
135  virtual void WriteString(const char *s);
136 
137  virtual TClass *ReadClass(const TClass *cl = 0, UInt_t *objTag = 0);
138  virtual void WriteClass(const TClass *cl);
139 
140  virtual TObject *ReadObject(const TClass *cl);
141  virtual void WriteObject(const TObject *obj);
142 
143  virtual Int_t WriteObjectAny(const void *obj, const TClass *ptrClass);
144 
146  // See comment in TBuffer::SetPidOffset
147  return fPidOffset;
148  }
153  { fDisplacement = (Int_t)(Length() - skipped); }
154 
155  // basic types and arrays of basic types
156  virtual void ReadFloat16 (Float_t *f, TStreamerElement *ele=0);
157  virtual void WriteFloat16(Float_t *f, TStreamerElement *ele=0);
158  virtual void ReadDouble32 (Double_t *d, TStreamerElement *ele=0);
159  virtual void WriteDouble32(Double_t *d, TStreamerElement *ele=0);
160  virtual void ReadWithFactor(Float_t *ptr, Double_t factor, Double_t minvalue);
161  virtual void ReadWithNbits(Float_t *ptr, Int_t nbits);
162  virtual void ReadWithFactor(Double_t *ptr, Double_t factor, Double_t minvalue);
163  virtual void ReadWithNbits(Double_t *ptr, Int_t nbits);
164 
165  virtual Int_t ReadArray(Bool_t *&b);
166  virtual Int_t ReadArray(Char_t *&c);
167  virtual Int_t ReadArray(UChar_t *&c);
168  virtual Int_t ReadArray(Short_t *&h);
169  virtual Int_t ReadArray(UShort_t *&h);
170  virtual Int_t ReadArray(Int_t *&i);
171  virtual Int_t ReadArray(UInt_t *&i);
172  virtual Int_t ReadArray(Long_t *&l);
173  virtual Int_t ReadArray(ULong_t *&l);
174  virtual Int_t ReadArray(Long64_t *&l);
175  virtual Int_t ReadArray(ULong64_t *&l);
176  virtual Int_t ReadArray(Float_t *&f);
177  virtual Int_t ReadArray(Double_t *&d);
178  virtual Int_t ReadArrayFloat16(Float_t *&f, TStreamerElement *ele=0);
180 
181  virtual Int_t ReadStaticArray(Bool_t *b);
182  virtual Int_t ReadStaticArray(Char_t *c);
183  virtual Int_t ReadStaticArray(UChar_t *c);
184  virtual Int_t ReadStaticArray(Short_t *h);
185  virtual Int_t ReadStaticArray(UShort_t *h);
186  virtual Int_t ReadStaticArray(Int_t *i);
187  virtual Int_t ReadStaticArray(UInt_t *i);
188  virtual Int_t ReadStaticArray(Long_t *l);
189  virtual Int_t ReadStaticArray(ULong_t *l);
190  virtual Int_t ReadStaticArray(Long64_t *l);
191  virtual Int_t ReadStaticArray(ULong64_t *l);
192  virtual Int_t ReadStaticArray(Float_t *f);
193  virtual Int_t ReadStaticArray(Double_t *d);
196 
197  virtual void ReadFastArray(Bool_t *b, Int_t n);
198  virtual void ReadFastArray(Char_t *c, Int_t n);
199  virtual void ReadFastArrayString(Char_t *c, Int_t n);
200  virtual void ReadFastArray(UChar_t *c, Int_t n);
201  virtual void ReadFastArray(Short_t *h, Int_t n);
202  virtual void ReadFastArray(UShort_t *h, Int_t n);
203  virtual void ReadFastArray(Int_t *i, Int_t n);
204  virtual void ReadFastArray(UInt_t *i, Int_t n);
205  virtual void ReadFastArray(Long_t *l, Int_t n);
206  virtual void ReadFastArray(ULong_t *l, Int_t n);
207  virtual void ReadFastArray(Long64_t *l, Int_t n);
208  virtual void ReadFastArray(ULong64_t *l, Int_t n);
209  virtual void ReadFastArray(Float_t *f, Int_t n);
210  virtual void ReadFastArray(Double_t *d, Int_t n);
211  virtual void ReadFastArrayFloat16(Float_t *f, Int_t n, TStreamerElement *ele=0);
212  virtual void ReadFastArrayDouble32(Double_t *d, Int_t n, TStreamerElement *ele=0);
213  virtual void ReadFastArrayWithFactor(Float_t *ptr, Int_t n, Double_t factor, Double_t minvalue) ;
214  virtual void ReadFastArrayWithNbits(Float_t *ptr, Int_t n, Int_t nbits);
215  virtual void ReadFastArrayWithFactor(Double_t *ptr, Int_t n, Double_t factor, Double_t minvalue);
216  virtual void ReadFastArrayWithNbits(Double_t *ptr, Int_t n, Int_t nbits) ;
217  virtual void ReadFastArray(void *start , const TClass *cl, Int_t n=1, TMemberStreamer *s=0, const TClass* onFileClass=0 );
218  virtual void ReadFastArray(void **startp, const TClass *cl, Int_t n=1, Bool_t isPreAlloc=kFALSE, TMemberStreamer *s=0, const TClass* onFileClass=0);
219 
220  virtual void WriteArray(const Bool_t *b, Int_t n);
221  virtual void WriteArray(const Char_t *c, Int_t n);
222  virtual void WriteArray(const UChar_t *c, Int_t n);
223  virtual void WriteArray(const Short_t *h, Int_t n);
224  virtual void WriteArray(const UShort_t *h, Int_t n);
225  virtual void WriteArray(const Int_t *i, Int_t n);
226  virtual void WriteArray(const UInt_t *i, Int_t n);
227  virtual void WriteArray(const Long_t *l, Int_t n);
228  virtual void WriteArray(const ULong_t *l, Int_t n);
229  virtual void WriteArray(const Long64_t *l, Int_t n);
230  virtual void WriteArray(const ULong64_t *l, Int_t n);
231  virtual void WriteArray(const Float_t *f, Int_t n);
232  virtual void WriteArray(const Double_t *d, Int_t n);
233  virtual void WriteArrayFloat16(const Float_t *f, Int_t n, TStreamerElement *ele=0);
234  virtual void WriteArrayDouble32(const Double_t *d, Int_t n, TStreamerElement *ele=0);
235 
236  virtual void WriteFastArray(const Bool_t *b, Int_t n);
237  virtual void WriteFastArray(const Char_t *c, Int_t n);
238  virtual void WriteFastArrayString(const Char_t *c, Int_t n);
239  virtual void WriteFastArray(const UChar_t *c, Int_t n);
240  virtual void WriteFastArray(const Short_t *h, Int_t n);
241  virtual void WriteFastArray(const UShort_t *h, Int_t n);
242  virtual void WriteFastArray(const Int_t *i, Int_t n);
243  virtual void WriteFastArray(const UInt_t *i, Int_t n);
244  virtual void WriteFastArray(const Long_t *l, Int_t n);
245  virtual void WriteFastArray(const ULong_t *l, Int_t n);
246  virtual void WriteFastArray(const Long64_t *l, Int_t n);
247  virtual void WriteFastArray(const ULong64_t *l, Int_t n);
248  virtual void WriteFastArray(const Float_t *f, Int_t n);
249  virtual void WriteFastArray(const Double_t *d, Int_t n);
250  virtual void WriteFastArrayFloat16(const Float_t *f, Int_t n, TStreamerElement *ele=0);
251  virtual void WriteFastArrayDouble32(const Double_t *d, Int_t n, TStreamerElement *ele=0);
252  virtual void WriteFastArray(void *start, const TClass *cl, Int_t n=1, TMemberStreamer *s=0);
253  virtual Int_t WriteFastArray(void **startp, const TClass *cl, Int_t n=1, Bool_t isPreAlloc=kFALSE, TMemberStreamer *s=0);
254 
255  virtual void StreamObject(void *obj, const type_info &typeinfo, const TClass* onFileClass = 0 );
256  virtual void StreamObject(void *obj, const char *className, const TClass* onFileClass = 0 );
257  virtual void StreamObject(void *obj, const TClass *cl, const TClass* onFileClass = 0 );
258  virtual void StreamObject(TObject *obj);
259 
260  virtual void ReadBool(Bool_t &b);
261  virtual void ReadChar(Char_t &c);
262  virtual void ReadUChar(UChar_t &c);
263  virtual void ReadShort(Short_t &s);
264  virtual void ReadUShort(UShort_t &s);
265  virtual void ReadInt(Int_t &i);
266  virtual void ReadUInt(UInt_t &i);
267  virtual void ReadLong(Long_t &l);
268  virtual void ReadULong(ULong_t &l);
269  virtual void ReadLong64(Long64_t &l);
270  virtual void ReadULong64(ULong64_t &l);
271  virtual void ReadFloat(Float_t &f);
272  virtual void ReadDouble(Double_t &d);
273  virtual void ReadCharP(Char_t *c);
274  virtual void ReadTString(TString &s);
275  virtual void ReadStdString(std::string &s);
276 
277  virtual void WriteBool(Bool_t b);
278  virtual void WriteChar(Char_t c);
279  virtual void WriteUChar(UChar_t c);
280  virtual void WriteShort(Short_t s);
281  virtual void WriteUShort(UShort_t s);
282  virtual void WriteInt(Int_t i);
283  virtual void WriteUInt(UInt_t i);
284  virtual void WriteLong(Long_t l);
285  virtual void WriteULong(ULong_t l);
286  virtual void WriteLong64(Long64_t l);
287  virtual void WriteULong64(ULong64_t l);
288  virtual void WriteFloat(Float_t f);
289  virtual void WriteDouble(Double_t d);
290  virtual void WriteCharP(const Char_t *c);
291  virtual void WriteTString(const TString &s);
292  virtual void WriteStdString(const std::string &s);
293 
294  // Special basic ROOT objects and collections
295  virtual TProcessID *GetLastProcessID(TRefTable *reftable) const;
296  virtual UInt_t GetTRefExecId();
297  virtual TProcessID *ReadProcessID(UShort_t pidf);
298  virtual UShort_t WriteProcessID(TProcessID *pid);
299 
300  // Utilities for TStreamerInfo
301  virtual void ForceWriteInfo(TVirtualStreamerInfo *info, Bool_t force);
302  virtual void ForceWriteInfoClones(TClonesArray *a);
303  virtual Int_t ReadClones (TClonesArray *a, Int_t nobjects, Version_t objvers);
304  virtual Int_t WriteClones(TClonesArray *a, Int_t nobjects);
305 
306  // Utilities for TClass
307  virtual Int_t ReadClassEmulated(const TClass *cl, void *object, const TClass *onfile_class);
308  virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class);
309  virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, Int_t version, UInt_t start, UInt_t count, const TClass *onfile_class);
310  virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer);
311 
312  // Utilites to streamer using sequences.
313  Int_t ApplySequence(const TStreamerInfoActions::TActionSequence &sequence, void *object);
314  Int_t ApplySequenceVecPtr(const TStreamerInfoActions::TActionSequence &sequence, void *start_collection, void *end_collection);
315  Int_t ApplySequence(const TStreamerInfoActions::TActionSequence &sequence, void *start_collection, void *end_collection);
316 
317  static void SetGlobalReadParam(Int_t mapsize);
318  static void SetGlobalWriteParam(Int_t mapsize);
319  static Int_t GetGlobalReadParam();
320  static Int_t GetGlobalWriteParam();
321 
322  ClassDef(TBufferFile,0) //concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
323 };
324 
325 
326 //---------------------- TBufferFile inlines ---------------------------------------
327 
328 //______________________________________________________________________________
330 {
331  if (fBufCur + sizeof(UChar_t) > fBufMax) AutoExpand(fBufSize+sizeof(UChar_t));
332  tobuf(fBufCur, b);
333 }
334 
335 //______________________________________________________________________________
337 {
338  if (fBufCur + sizeof(Char_t) > fBufMax) AutoExpand(fBufSize+sizeof(Char_t));
339  tobuf(fBufCur, c);
340 }
341 
342 //______________________________________________________________________________
344 {
345  if (fBufCur + sizeof(UChar_t) > fBufMax) AutoExpand(fBufSize+sizeof(UChar_t));
346  tobuf(fBufCur, (Char_t)c);
347 }
348 
349 //______________________________________________________________________________
351 {
352  if (fBufCur + sizeof(Short_t) > fBufMax) AutoExpand(fBufSize+sizeof(Short_t));
353  tobuf(fBufCur, h);
354 }
355 
356 //______________________________________________________________________________
358 {
359  if (fBufCur + sizeof(UShort_t) > fBufMax) AutoExpand(fBufSize+sizeof(UShort_t));
360  tobuf(fBufCur, (Short_t)h);
361 }
362 
363 //______________________________________________________________________________
365 {
366  if (fBufCur + sizeof(Int_t) > fBufMax) AutoExpand(fBufSize+sizeof(Int_t));
367  tobuf(fBufCur, i);
368 }
369 
370 //______________________________________________________________________________
372 {
373  if (fBufCur + sizeof(UInt_t) > fBufMax) AutoExpand(fBufSize+sizeof(UInt_t));
374  tobuf(fBufCur, (Int_t)i);
375 }
376 
377 //______________________________________________________________________________
379 {
380  if (fBufCur + sizeof(Long_t) > fBufMax) AutoExpand(fBufSize+sizeof(Long_t));
381  tobuf(fBufCur, l);
382 }
383 
384 //______________________________________________________________________________
386 {
387  if (fBufCur + sizeof(ULong_t) > fBufMax) AutoExpand(fBufSize+sizeof(ULong_t));
388  tobuf(fBufCur, (Long_t)l);
389 }
390 
391 //______________________________________________________________________________
393 {
394  if (fBufCur + sizeof(Long64_t) > fBufMax) AutoExpand(fBufSize+sizeof(Long64_t));
395  tobuf(fBufCur, ll);
396 }
397 
398 //______________________________________________________________________________
400 {
401  if (fBufCur + sizeof(ULong64_t) > fBufMax) AutoExpand(fBufSize+sizeof(ULong64_t));
402  tobuf(fBufCur, (Long64_t)ll);
403 }
404 
405 //______________________________________________________________________________
407 {
408  if (fBufCur + sizeof(Float_t) > fBufMax) AutoExpand(fBufSize+sizeof(Float_t));
409  tobuf(fBufCur, f);
410 }
411 
412 //______________________________________________________________________________
414 {
415  if (fBufCur + sizeof(Double_t) > fBufMax) AutoExpand(fBufSize+sizeof(Double_t));
416  tobuf(fBufCur, d);
417 }
418 
419 //______________________________________________________________________________
420 inline void TBufferFile::WriteCharP(const Char_t *c)
421 {
422  WriteString(c);
423 }
424 
425 //______________________________________________________________________________
427 {
428  frombuf(fBufCur, &b);
429 }
430 
431 //______________________________________________________________________________
433 {
434  frombuf(fBufCur, &c);
435 }
436 
437 //______________________________________________________________________________
439 {
441 }
442 
443 //______________________________________________________________________________
445 {
446  frombuf(fBufCur, &h);
447 }
448 
449 //______________________________________________________________________________
451 {
453 }
454 
455 //______________________________________________________________________________
457 {
458  frombuf(fBufCur, &i);
459 }
460 
461 //______________________________________________________________________________
463 {
465 }
466 
467 
468 // in implementation file because special case with old version
469 //______________________________________________________________________________
470 //inline void TBufferFile::ReadLong(Long_t &ll)
471 //{
472 // frombuf(fBufCur, &ll);
473 //}
474 
475 //______________________________________________________________________________
477 {
479 }
480 
481 
482 //______________________________________________________________________________
484 {
485  frombuf(fBufCur, &ll);
486 }
487 
488 //______________________________________________________________________________
490 {
492 }
493 
494 //______________________________________________________________________________
496 {
497  frombuf(fBufCur, &f);
498 }
499 
500 //______________________________________________________________________________
502 {
503  frombuf(fBufCur, &d);
504 }
505 
506 //______________________________________________________________________________
508 {
509  ReadString(c, -1);
510 }
511 
512 //______________________________________________________________________________
514  { return TBufferFile::ReadArray((Char_t *&)c); }
515 //______________________________________________________________________________
517  { return TBufferFile::ReadArray((Short_t *&)h); }
518 //______________________________________________________________________________
520  { return TBufferFile::ReadArray((Int_t *&)i); }
521 //______________________________________________________________________________
523  { return TBufferFile::ReadArray((Long_t *&)l); }
524 //______________________________________________________________________________
526  { return TBufferFile::ReadArray((Long64_t *&)ll); }
527 
528 //______________________________________________________________________________
530  { return TBufferFile::ReadStaticArray((Char_t *)c); }
531 //______________________________________________________________________________
533  { return TBufferFile::ReadStaticArray((Short_t *)h); }
534 //______________________________________________________________________________
536  { return TBufferFile::ReadStaticArray((Int_t *)i); }
537 //______________________________________________________________________________
539  { return TBufferFile::ReadStaticArray((Long_t *)l); }
540 //______________________________________________________________________________
542  { return TBufferFile::ReadStaticArray((Long64_t *)ll); }
543 
544 //______________________________________________________________________________
546  { TBufferFile::ReadFastArray((Char_t *)c, n); }
547 //______________________________________________________________________________
549  { TBufferFile::ReadFastArray((Short_t *)h, n); }
550 //______________________________________________________________________________
552  { TBufferFile::ReadFastArray((Int_t *)i, n); }
553 //______________________________________________________________________________
555  { TBufferFile::ReadFastArray((Long_t *)l, n); }
556 //______________________________________________________________________________
558  { TBufferFile::ReadFastArray((Long64_t *)ll, n); }
559 
560 //______________________________________________________________________________
562  { TBufferFile::WriteArray((const Char_t *)c, n); }
563 //______________________________________________________________________________
565  { TBufferFile::WriteArray((const Short_t *)h, n); }
566 //______________________________________________________________________________
567 inline void TBufferFile::WriteArray(const UInt_t *i, Int_t n)
568  { TBufferFile::WriteArray((const Int_t *)i, n); }
569 //______________________________________________________________________________
570 inline void TBufferFile::WriteArray(const ULong64_t *ll, Int_t n)
571  { TBufferFile::WriteArray((const Long64_t *)ll, n); }
572 
573 //______________________________________________________________________________
575  { TBufferFile::WriteFastArray((const Char_t *)c, n); }
576 //______________________________________________________________________________
578  { TBufferFile::WriteFastArray((const Short_t *)h, n); }
579 //______________________________________________________________________________
581  { TBufferFile::WriteFastArray((const Int_t *)i, n); }
582 //______________________________________________________________________________
584  { TBufferFile::WriteFastArray((const Long64_t *)ll, n); }
585 
586 #endif
virtual TClass * ReadClass(const TClass *cl=0, UInt_t *objTag=0)
Read class definition from I/O buffer.
Describe Streamer information for one class version.
Definition: TStreamerInfo.h:47
virtual void IncrementLevel(TVirtualStreamerInfo *info)
Increment level.
virtual UInt_t GetTRefExecId()
Return the exec id stored in the current TStreamerInfo element.
void SetReadParam(Int_t mapsize)
Set the initial size of the map used to store object and class references during reading.
void SetBufferOffset(Int_t offset=0)
Definition: TBuffer.h:90
virtual Int_t WriteClones(TClonesArray *a, Int_t nobjects)
Interface to TStreamerInfo::WriteBufferClones.
virtual ~TBufferFile()
Delete an I/O buffer object.
void frombuf(char *&buf, Bool_t *x)
Definition: Bytes.h:282
void CheckCount(UInt_t offset)
Check if offset is not too large (< kMaxMapCount) when writing.
virtual void WriteString(const char *s)
Write string to I/O buffer.
virtual Int_t ReadArray(Bool_t *&b)
Read array of bools from the I/O buffer.
virtual void WriteFastArrayFloat16(const Float_t *f, Int_t n, TStreamerElement *ele=0)
Write array of n floats (as truncated float) into the I/O buffer.
virtual Version_t ReadVersionForMemberWise(const TClass *cl=0)
Read class version from I/O buffer.
void SetWriteParam(Int_t mapsize)
Set the initial size of the hashtable used to store object and class references during writing...
virtual void WriteObjectClass(const void *actualObjStart, const TClass *actualClass)
Write object to I/O buffer.
virtual Int_t ReadClones(TClonesArray *a, Int_t nobjects, Version_t objvers)
Interface to TStreamerInfo::ReadBufferClones.
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket...
Definition: TBufferFile.h:51
virtual void WriteClass(const TClass *cl)
Write class description to I/O buffer.
long long Long64_t
Definition: RtypesCore.h:69
UShort_t GetPidOffset() const
Definition: TBufferFile.h:145
void SetBufferDisplacement()
Definition: TBufferFile.h:151
virtual void WriteFloat16(Float_t *f, TStreamerElement *ele=0)
Write a Float16_t to the buffer.
Int_t ApplySequence(const TStreamerInfoActions::TActionSequence &sequence, void *object)
Read one collection of objects from the buffer using the StreamerInfoLoopAction.
short Version_t
Definition: RtypesCore.h:61
static Int_t GetGlobalWriteParam()
Get default write map size.
float Float_t
Definition: RtypesCore.h:53
return c
tuple offset
Definition: tree.py:93
virtual void WriteArrayDouble32(const Double_t *d, Int_t n, TStreamerElement *ele=0)
Write array of n doubles (as float) into the I/O buffer.
virtual void ReadFastArrayWithNbits(Float_t *ptr, Int_t n, Int_t nbits)
Read array of n floats (written as truncated float) from the I/O buffer.
virtual Int_t ReadArrayDouble32(Double_t *&d, TStreamerElement *ele=0)
Read array of doubles (written as float) from the I/O buffer.
virtual void ReadFastArrayWithFactor(Float_t *ptr, Int_t n, Double_t factor, Double_t minvalue)
Read array of n floats (written as truncated float) from the I/O buffer.
virtual void ReadTString(TString &s)
Read TString from TBuffer.
unsigned short UShort_t
Definition: RtypesCore.h:36
virtual UInt_t WriteVersionMemberWise(const TClass *cl, Bool_t useBcnt=kFALSE)
Write class version to I/O buffer after setting the kStreamedMemberWise bit in the version number...
#define BIT(n)
Definition: Rtypes.h:120
TH1 * h
Definition: legend2.C:5
virtual void ReadDouble32(Double_t *d, TStreamerElement *ele=0)
Read a Double32_t from the buffer, see comments about Double32_t encoding at TBufferFile::WriteDouble...
static void SetGlobalReadParam(Int_t mapsize)
Set the initial size of the map used to store object and class references during reading.
static Int_t fgMapSize
Default map size for all TBuffer objects.
Definition: TBufferFile.h:65
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)
Write class version to I/O buffer.
Basic string class.
Definition: TString.h:137
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)
Set byte count at position cntpos in the buffer.
virtual Int_t ReadStaticArrayDouble32(Double_t *d, TStreamerElement *ele=0)
Read array of doubles (written as float) from the I/O buffer.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
std::vector< TStreamerInfo * > InfoList_t
Definition: TBufferFile.h:54
TArc * a
Definition: textangle.C:12
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void ReadChar(Char_t &c)
Definition: TBufferFile.h:432
virtual void * ReadObjectAny(const TClass *cast)
Read object from I/O buffer.
virtual void ClassMember(const char *, const char *=0, Int_t=-1, Int_t=-1)
Definition: TBufferFile.h:129
virtual void ReadUInt(UInt_t &i)
Definition: TBufferFile.h:462
UInt_t CheckObject(UInt_t offset, const TClass *cl, Bool_t readClass=kFALSE)
Check for object in the read map.
void MapObject(const TObject *obj, UInt_t offset=1)
Add object to the fMap container.
virtual void WriteArrayFloat16(const Float_t *f, Int_t n, TStreamerElement *ele=0)
Write array of n floats (as truncated float) into the I/O buffer.
virtual void ReadLong(Long_t &l)
Read Long from TBuffer.
virtual void WriteBool(Bool_t b)
Definition: TBufferFile.h:329
void SetPidOffset(UShort_t offset)
This offset is used when a key (or basket) is transfered from one file to the other.
virtual void WriteULong(ULong_t l)
Definition: TBufferFile.h:385
static void SetGlobalWriteParam(Int_t mapsize)
Set the initial size of the map used to store object and class references during reading.
TFile * f
virtual void WriteULong64(ULong64_t l)
Definition: TBufferFile.h:399
virtual void WriteFastArrayString(const Char_t *c, Int_t n)
Write array of n characters into the I/O buffer.
virtual void ReadFloat(Float_t &f)
Definition: TBufferFile.h:495
virtual void WriteUChar(UChar_t c)
Definition: TBufferFile.h:343
virtual TObject * ReadObject(const TClass *cl)
Read object from I/O buffer.
Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss, const char *classname)
Check byte count with current buffer position.
Int_t fDisplacement
Value to be added to the map offsets.
Definition: TBufferFile.h:58
Int_t GetMapCount() const
Definition: TBufferFile.h:94
virtual void WriteUShort(UShort_t s)
Definition: TBufferFile.h:357
virtual void ReadLong64(Long64_t &l)
Definition: TBufferFile.h:483
virtual void SkipObjectAny()
Skip any kind of object from buffer.
TExMap * fMap
Map containing object,offset pairs for reading/writing.
Definition: TBufferFile.h:60
virtual Int_t ReadArrayFloat16(Float_t *&f, TStreamerElement *ele=0)
Read array of floats (written as truncated float) from the I/O buffer.
virtual void ReadInt(Int_t &i)
Definition: TBufferFile.h:456
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual char * ReadString(char *s, Int_t max)
Read string from I/O buffer.
virtual void StreamObject(void *obj, const type_info &typeinfo, const TClass *onFileClass=0)
Stream an object given its C++ typeinfo information.
int d
Definition: tornado.py:11
virtual void TagStreamerInfo(TVirtualStreamerInfo *info)
Mark the classindex of the current file as using this TStreamerInfo.
virtual Int_t ReadBuf(void *buf, Int_t max)
Read max bytes from the I/O buffer into buf.
virtual void SetStreamerElementNumber(TStreamerElement *, Int_t)
Definition: TBufferFile.h:124
virtual void ReadUChar(UChar_t &c)
Definition: TBufferFile.h:438
void tobuf(char *&buf, Bool_t x)
Definition: Bytes.h:59
A TProcessID identifies a ROOT job in a unique way in time and space.
Definition: TProcessID.h:34
char *(* ReAllocCharFun_t)(char *, size_t, size_t)
Definition: TStorage.h:31
virtual void WriteShort(Short_t s)
Definition: TBufferFile.h:350
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)
Function called by the Streamer functions to serialize object at p to buffer b.
virtual Version_t ReadVersionNoCheckSum(UInt_t *start=0, UInt_t *bcnt=0)
Read class version from I/O buffer, when the caller knows for sure that there is no checksum written/...
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class)
Deserialize information from a buffer into an object.
virtual void ReadULong64(ULong64_t &l)
Definition: TBufferFile.h:489
virtual Int_t ReadStaticArrayFloat16(Float_t *f, TStreamerElement *ele=0)
Read array of floats (written as truncated float) from the I/O buffer.
Int_t fMapCount
Number of objects or classes in map.
Definition: TBufferFile.h:56
virtual void WriteTString(const TString &s)
Write TString to TBuffer.
void ResetMap()
Delete existing fMap and reset map counter.
void operator=(const TBufferFile &)
not implemented
TStreamerInfo * fInfo
Pointer to TStreamerInfo object writing/reading the buffer.
Definition: TBufferFile.h:62
Int_t ApplySequenceVecPtr(const TStreamerInfoActions::TActionSequence &sequence, void *start_collection, void *end_collection)
Read one collection of objects from the buffer using the StreamerInfoLoopAction.
virtual void WriteUInt(UInt_t i)
Definition: TBufferFile.h:371
virtual Int_t ReadStaticArray(Bool_t *b)
Read array of bools from the I/O buffer.
virtual TProcessID * GetLastProcessID(TRefTable *reftable) const
Return the last TProcessID in the file.
Wrapper around an object and giving indirect access to its content even if the object is not of a cla...
Definition: TVirtualArray.h:26
virtual void ReadStdString(std::string &s)
Read std::string from TBuffer.
virtual void ForceWriteInfoClones(TClonesArray *a)
Make sure TStreamerInfo is not optimized, otherwise it will not be possible to support schema evoluti...
void InitMap()
Create the fMap container and initialize them with the null object.
virtual Int_t ReadClassEmulated(const TClass *cl, void *object, const TClass *onfile_class)
Read emulated class.
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)
Read class version from I/O buffer.
short Short_t
Definition: RtypesCore.h:35
TLine * l
Definition: textangle.C:4
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
virtual void WriteInt(Int_t i)
Definition: TBufferFile.h:364
virtual void SkipVersion(const TClass *cl=0)
Skip class version from I/O buffer.
virtual void ReadCharP(Char_t *c)
Definition: TBufferFile.h:507
char * fBufCur
Definition: TBuffer.h:51
virtual void WriteBuf(const void *buf, Int_t max)
Write max bytes from buf into the I/O buffer.
virtual void ClassEnd(const TClass *)
Definition: TBufferFile.h:128
virtual void WriteFloat(Float_t f)
Definition: TBufferFile.h:406
virtual void ReadWithNbits(Float_t *ptr, Int_t nbits)
Read a Float16_t from the buffer when the number of bits is specified (explicitly or not) see comment...
UShort_t fPidOffset
Offset to be added to the pid index in this key/buffer.
Definition: TBufferFile.h:59
virtual void WriteArray(const Bool_t *b, Int_t n)
Write array of n bools into the I/O buffer.
TExMap * fClassMap
Map containing object,class pairs for reading.
Definition: TBufferFile.h:61
virtual void ReadFastArrayDouble32(Double_t *d, Int_t n, TStreamerElement *ele=0)
Read array of n doubles (written as float) from the I/O buffer.
long Long_t
Definition: RtypesCore.h:50
Int_t fMapSize
Default size of map.
Definition: TBufferFile.h:57
virtual void WriteLong(Long_t l)
Definition: TBufferFile.h:378
double Double_t
Definition: RtypesCore.h:55
virtual void ReadFastArrayFloat16(Float_t *f, Int_t n, TStreamerElement *ele=0)
Read array of n floats (written as truncated float) from the I/O buffer.
virtual void WriteDouble32(Double_t *d, TStreamerElement *ele=0)
Write a Double32_t to the buffer.
unsigned long long ULong64_t
Definition: RtypesCore.h:70
unsigned long ULong_t
Definition: RtypesCore.h:51
A TRefTable maintains the association between a referenced object and the parent object supporting th...
Definition: TRefTable.h:37
virtual void WriteDouble(Double_t d)
Definition: TBufferFile.h:413
void SetBufferDisplacement(Int_t skipped)
Definition: TBufferFile.h:152
virtual void ForceWriteInfo(TVirtualStreamerInfo *info, Bool_t force)
force writing the TStreamerInfo to the file
virtual void WriteObject(const TObject *obj)
Write object to I/O buffer.
virtual Int_t GetVersionOwner() const
Return the version number of the owner file.
virtual void ReadFloat16(Float_t *f, TStreamerElement *ele=0)
Read a Float16_t from the buffer, see comments about Float16_t encoding at TBufferFile::WriteFloat16(...
static Int_t GetGlobalReadParam()
Get default read map size.
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
Definition: vector.h:440
Mother of all ROOT objects.
Definition: TObject.h:58
virtual void ReadBool(Bool_t &b)
Definition: TBufferFile.h:426
char Char_t
Definition: RtypesCore.h:29
virtual void WriteCharP(const Char_t *c)
Definition: TBufferFile.h:420
An array of clone (identical) objects.
Definition: TClonesArray.h:32
virtual void WriteLong64(Long64_t l)
Definition: TBufferFile.h:392
Int_t Length() const
Definition: TBuffer.h:96
virtual void ClassBegin(const TClass *, Version_t=-1)
Definition: TBufferFile.h:127
virtual void WriteStdString(const std::string &s)
Write std::string to TBuffer.
virtual void WriteFastArray(const Bool_t *b, Int_t n)
Write array of n bools into the I/O buffer.
Int_t fBufSize
Definition: TBuffer.h:49
virtual void ReadUShort(UShort_t &s)
Definition: TBufferFile.h:450
InfoList_t fInfoStack
Stack of pointers to the TStreamerInfos.
Definition: TBufferFile.h:63
virtual void DecrementLevel(TVirtualStreamerInfo *)
Decrement level.
virtual Int_t WriteObjectAny(const void *obj, const TClass *ptrClass)
Write object to I/O buffer.
void Reset()
Definition: TBufferFile.h:98
unsigned char UChar_t
Definition: RtypesCore.h:34
virtual void ReadWithFactor(Float_t *ptr, Double_t factor, Double_t minvalue)
Read a Float16_t from the buffer when the factor and minimun value have been specified see comments a...
virtual void ReadShort(Short_t &s)
Definition: TBufferFile.h:444
Int_t GetBufferDisplacement() const
Definition: TBufferFile.h:150
Abstract Interface class describing Streamer information for one class.
TVirtualStreamerInfo * GetInfo()
Definition: TBufferFile.h:126
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void ReadULong(ULong_t &l)
Definition: TBufferFile.h:476
TObject * obj
virtual TProcessID * ReadProcessID(UShort_t pidf)
The TProcessID with number pidf is read from file.
virtual void ReadFastArrayString(Char_t *c, Int_t n)
Read array of n characters from the I/O buffer.
virtual UShort_t WriteProcessID(TProcessID *pid)
Check if the ProcessID pid is already in the file.
const Int_t n
Definition: legend1.C:16
char * fBufMax
Definition: TBuffer.h:52
virtual void WriteFastArrayDouble32(const Double_t *d, Int_t n, TStreamerElement *ele=0)
Write array of n doubles (as float) into the I/O buffer.
virtual void WriteChar(Char_t c)
Definition: TBufferFile.h:336
This class stores a (key,value) pair using an external hash.
Definition: TExMap.h:35
void GetMappedObject(UInt_t tag, void *&ptr, TClass *&ClassPtr) const
Retrieve the object stored in the buffer's object map at 'tag' Set ptr and ClassPtr respectively to t...
void AutoExpand(Int_t size_needed)
Automatically calculate a new size and expand the buffer to fit at least size_needed.
Definition: TBuffer.cxx:140
virtual void ReadFastArray(Bool_t *b, Int_t n)
Read array of n bools from the I/O buffer.
virtual void ReadDouble(Double_t &d)
Definition: TBufferFile.h:501