Logo ROOT   6.14/05
Reference Guide
TGenCollectionStreamer.h
Go to the documentation of this file.
1 // @(#)root/io:$Id$
2 // Author: Markus Frank 28/10/04
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, 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 #ifndef ROOT_TGenCollectionStreamer
12 #define ROOT_TGenCollectionStreamer
13 
14 #include "TGenCollectionProxy.h"
16 
18 
19 protected:
20  void ReadMapHelper(StreamHelper *i, Value *v, Bool_t vsn3, TBuffer &b);
21  void ReadMap(int nElements, TBuffer &b, const TClass *onfileClass);
22  void ReadPairFromMap(int nElements, TBuffer &b);
23  void ReadObjects(int nElements, TBuffer &b, const TClass *onfileClass);
24  void ReadPrimitives(int nElements, TBuffer &b, const TClass *onfileClass);
25  void WriteMap(int nElements, TBuffer &b);
26  void WriteObjects(int nElements, TBuffer &b);
27  void WritePrimitives(int nElements, TBuffer &b);
28 
29 // typedef void (TGenCollectionStreamer::*ReadBufferConv_t)(TBuffer &b, void *obj, const TClass *onFileClass);
30 // ReadBufferConv_t fReadBufferConvFunc;
31 
32  typedef void (TGenCollectionStreamer::*ReadBuffer_t)(TBuffer &b, void *obj, const TClass *onFileClass);
34 
35  template <typename From, typename To> void ConvertBufferVectorPrimitives(TBuffer &b, void *obj, Int_t nElements);
36  template <typename To> void ConvertBufferVectorPrimitivesFloat16(TBuffer &b, void *obj, Int_t nElements);
37  template <typename To> void ConvertBufferVectorPrimitivesDouble32(TBuffer &b, void *obj, Int_t nElements);
38  template <typename To> void DispatchConvertBufferVectorPrimitives(TBuffer &b, void *obj, Int_t nElements, const TVirtualCollectionProxy *onfileProxy);
39  template <typename basictype> void ReadBufferVectorPrimitives(TBuffer &b, void *obj, const TClass *onFileClass);
40  void ReadBufferVectorPrimitivesFloat16(TBuffer &b, void *obj, const TClass *onFileClass);
41  void ReadBufferVectorPrimitivesDouble32(TBuffer &b, void *obj, const TClass *onFileClass);
42  void ReadBufferDefault(TBuffer &b, void *obj, const TClass *onFileClass);
43  void ReadBufferGeneric(TBuffer &b, void *obj, const TClass *onFileClass);
44 
45 private:
46  TGenCollectionStreamer &operator=(const TGenCollectionStreamer&); // Not implemented.
47 
48 public:
49  // Virtual copy constructor
50  virtual TVirtualCollectionProxy* Generate() const;
51 
52  // Copy constructor
54 
55  // Initializing constructor
56  TGenCollectionStreamer(Info_t typ, size_t iter_size);
58 
59  // Standard destructor
60  virtual ~TGenCollectionStreamer();
61 
62  // Streamer I/O overload
63  virtual void Streamer(TBuffer &refBuffer);
64 
65  // Streamer I/O overload
66  virtual void StreamerAsMap(TBuffer &refBuffer);
67 
68  // Streamer I/O overload
69  virtual void Streamer(TBuffer &buff, void *pObj, int siz) {
70  TGenCollectionProxy::Streamer(buff, pObj, siz);
71  }
72 
73  // Routine to read the content of the buffer into 'obj'.
74  virtual void ReadBuffer(TBuffer &b, void *obj, const TClass *onfileClass);
75 
76  // Routine to read the content of the buffer into 'obj'.
77  virtual void ReadBuffer(TBuffer &b, void *obj);
78 };
79 
80 template <typename T>
83  : TGenCollectionStreamer(typeid(T::Cont_t),sizeof(T::Iter_t)) {
84  fValDiff = sizeof(T::Value_t);
85  fValOffset = T::value_offset();
86  fSize.call = T::size;
87  fFirst.call = T::first;
88  fNext.call = T::next;
89  fClear.call = T::clear;
90  fResize = T::resize;
91  fCollect = T::collect;
92  fConstruct = T::construct;
93  fDestruct = T::destruct;
94  fFeed = T::feed;
96  }
97  virtual ~AnyCollectionStreamer() { }
98 };
99 
100 // Forward declaration in the event of later seperation
102 
103 #endif
Method fSize
Container accessors: size of container.
virtual void ReadBuffer(TBuffer &b, void *obj, const TClass *onfileClass)
void ReadBufferVectorPrimitivesDouble32(TBuffer &b, void *obj, const TClass *onFileClass)
void(TGenCollectionStreamer::* ReadBuffer_t)(TBuffer &b, void *obj, const TClass *onFileClass)
void WriteMap(int nElements, TBuffer &b)
virtual TVirtualCollectionProxy * Generate() const
Virtual copy constructor.
Collectfunc_t fCollect
Method to collect objects from container.
double T(double x)
Definition: ChebyshevPol.h:34
Method fFirst
Container accessors: generic iteration: first.
Buffer base class used for serializing objects.
Definition: TBuffer.h:40
void ReadBufferGeneric(TBuffer &b, void *obj, const TClass *onFileClass)
Feedfunc_t fFeed
Container accessors: block feed.
TGenCollectionStreamer(const TGenCollectionStreamer &copy)
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void CheckFunctions() const
Check existence of function pointers.
void ReadPrimitives(int nElements, TBuffer &b, const TClass *onfileClass)
Sizing_t fResize
Container accessors: resize container.
void ReadPairFromMap(int nElements, TBuffer &b)
virtual void StreamerAsMap(TBuffer &refBuffer)
void ConvertBufferVectorPrimitives(TBuffer &b, void *obj, Int_t nElements)
TGenCollectionStreamer TGenMapStreamer
void WritePrimitives(int nElements, TBuffer &b)
void WriteObjects(int nElements, TBuffer &b)
Method fClear
Method cache for container accessors: clear container.
ArrIterfunc_t fConstruct
Container accessors: block construct.
virtual void Streamer(TBuffer &refBuffer)
Streamer Function.
void ReadBufferDefault(TBuffer &b, void *obj, const TClass *onFileClass)
int fValOffset
Offset from key to value (in maps)
SVector< double, 2 > v
Definition: Dict.h:5
virtual void Streamer(TBuffer &buff, void *pObj, int siz)
Streamer I/O overload.
void ReadBufferVectorPrimitivesFloat16(TBuffer &b, void *obj, const TClass *onFileClass)
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
void ReadMap(int nElements, TBuffer &b, const TClass *onfileClass)
void ConvertBufferVectorPrimitivesDouble32(TBuffer &b, void *obj, Int_t nElements)
int fValDiff
Offset between two consecutive value_types (memory layout).
void ReadBufferVectorPrimitives(TBuffer &b, void *obj, const TClass *onFileClass)
TGenCollectionStreamer & operator=(const TGenCollectionStreamer &)
typedef void((*Func_t)())
void ConvertBufferVectorPrimitivesFloat16(TBuffer &b, void *obj, Int_t nElements)
virtual void Streamer(TBuffer &refBuffer)
Streamer Function.
Helper class to facilitate I/O.
Proxy around an arbitrary container, which implements basic functionality and iteration.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
Sizing_t fDestruct
Container accessors: block destruct.
Method fNext
Container accessors: generic iteration: next.
void ReadObjects(int nElements, TBuffer &b, const TClass *onfileClass)
const std::type_info & Info_t
void ReadMapHelper(StreamHelper *i, Value *v, Bool_t vsn3, TBuffer &b)
void DispatchConvertBufferVectorPrimitives(TBuffer &b, void *obj, Int_t nElements, const TVirtualCollectionProxy *onfileProxy)
Small helper to describe the Value_type or the key_type of an STL container.