Logo ROOT  
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:
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 separation
102 
103 #endif
TGenCollectionStreamer::TGenCollectionStreamer
TGenCollectionStreamer(const ROOT::TCollectionProxyInfo &info, TClass *cl)
TGenCollectionStreamer::ReadBufferDefault
void ReadBufferDefault(TBuffer &b, void *obj, const TClass *onFileClass)
Definition: TGenCollectionStreamer.cxx:1235
ROOT::Detail::TCollectionProxyInfo
Definition: TCollectionProxyInfo.h:53
AnyCollectionStreamer::~AnyCollectionStreamer
virtual ~AnyCollectionStreamer()
Definition: TGenCollectionStreamer.h:97
TGenCollectionStreamer::fReadBufferFunc
ReadBuffer_t fReadBufferFunc
Definition: TGenCollectionStreamer.h:33
TGenCollectionStreamer::ReadMap
void ReadMap(int nElements, TBuffer &b, const TClass *onfileClass)
Definition: TGenCollectionStreamer.cxx:726
TGenCollectionStreamer::ConvertBufferVectorPrimitivesDouble32
void ConvertBufferVectorPrimitivesDouble32(TBuffer &b, void *obj, Int_t nElements)
Definition: TGenCollectionStreamer.cxx:1137
AnyCollectionStreamer::AnyCollectionStreamer
AnyCollectionStreamer()
Definition: TGenCollectionStreamer.h:82
TGenCollectionStreamer::Streamer
virtual void Streamer(TBuffer &buff, void *pObj, int siz)
Streamer I/O overload.
Definition: TGenCollectionStreamer.h:69
TGenCollectionStreamer::ReadBufferVectorPrimitives
void ReadBufferVectorPrimitives(TBuffer &b, void *obj, const TClass *onFileClass)
Definition: TGenCollectionStreamer.cxx:1172
TGenCollectionStreamer::ReadBufferVectorPrimitivesFloat16
void ReadBufferVectorPrimitivesFloat16(TBuffer &b, void *obj, const TClass *onFileClass)
Definition: TGenCollectionStreamer.cxx:1187
TGenCollectionStreamer::operator=
TGenCollectionStreamer & operator=(const TGenCollectionStreamer &)
TGenCollectionStreamer::ConvertBufferVectorPrimitivesFloat16
void ConvertBufferVectorPrimitivesFloat16(TBuffer &b, void *obj, Int_t nElements)
Definition: TGenCollectionStreamer.cxx:1125
TBuffer
Buffer base class used for serializing objects.
Definition: TBuffer.h:43
TGenCollectionProxy.h
AnyCollectionStreamer
Definition: TGenCollectionStreamer.h:81
v
@ v
Definition: rootcling_impl.cxx:3635
b
#define b(i)
Definition: RSha256.hxx:100
bool
TGenMapStreamer
TGenCollectionStreamer TGenMapStreamer
Definition: TGenCollectionStreamer.h:101
TGenCollectionStreamer::ReadMapHelper
void ReadMapHelper(StreamHelper *i, Value *v, Bool_t vsn3, TBuffer &b)
Definition: TGenCollectionStreamer.cxx:568
TGenCollectionStreamer::Streamer
virtual void Streamer(TBuffer &refBuffer)
Streamer Function.
Definition: TGenCollectionStreamer.cxx:1387
TGenCollectionStreamer::DispatchConvertBufferVectorPrimitives
void DispatchConvertBufferVectorPrimitives(TBuffer &b, void *obj, Int_t nElements, const TVirtualCollectionProxy *onfileProxy)
Definition: TGenCollectionStreamer.cxx:1149
TGenCollectionStreamer::~TGenCollectionStreamer
virtual ~TGenCollectionStreamer()
Definition: TGenCollectionStreamer.cxx:51
TGenCollectionProxy::fDestruct
Sizing_t fDestruct
Container accessors: block destruct.
Definition: TGenCollectionProxy.h:307
TGenCollectionProxy::Value
Small helper to describe the Value_type or the key_type of an STL container.
Definition: TGenCollectionProxy.h:60
TGenCollectionProxy::fClear
Method fClear
Method cache for container accessors: clear container.
Definition: TGenCollectionProxy.h:301
TGenCollectionStreamer::ReadObjects
void ReadObjects(int nElements, TBuffer &b, const TClass *onfileClass)
Definition: TGenCollectionStreamer.cxx:363
TGenCollectionStreamer::ReadBuffer
virtual void ReadBuffer(TBuffer &b, void *obj, const TClass *onfileClass)
Definition: TGenCollectionStreamer.cxx:1219
TGenCollectionProxy::Method::call
Call_t call
Definition: TGenCollectionProxy.h:196
TCollectionProxyFactory.h
TGenCollectionStreamer::Generate
virtual TVirtualCollectionProxy * Generate() const
Virtual copy constructor.
Definition: TGenCollectionStreamer.cxx:56
TGenCollectionStreamer::ReadBufferVectorPrimitivesDouble32
void ReadBufferVectorPrimitivesDouble32(TBuffer &b, void *obj, const TClass *onFileClass)
Definition: TGenCollectionStreamer.cxx:1202
TGenCollectionProxy::fFeed
Feedfunc_t fFeed
Container accessors: block feed.
Definition: TGenCollectionProxy.h:308
TGenCollectionStreamer::ReadBufferGeneric
void ReadBufferGeneric(TBuffer &b, void *obj, const TClass *onFileClass)
Definition: TGenCollectionStreamer.cxx:1304
TGenCollectionStreamer::ReadBuffer_t
void(TGenCollectionStreamer::* ReadBuffer_t)(TBuffer &b, void *obj, const TClass *onFileClass)
Definition: TGenCollectionStreamer.h:32
TGenCollectionStreamer::WriteMap
void WriteMap(int nElements, TBuffer &b)
Definition: TGenCollectionStreamer.cxx:1024
void
typedef void((*Func_t)())
TGenCollectionProxy::fConstruct
ArrIterfunc_t fConstruct
Container accessors: block construct.
Definition: TGenCollectionProxy.h:306
TGenCollectionProxy::CheckFunctions
void CheckFunctions() const
Check existence of function pointers.
Definition: TGenCollectionProxy.cxx:782
TGenCollectionProxy::fResize
Sizing_t fResize
Container accessors: resize container.
Definition: TGenCollectionProxy.h:303
TGenCollectionProxy::StreamHelper
Helper class to facilitate I/O.
Definition: TGenCollectionProxy.h:88
TGenCollectionProxy::Info_t
const std::type_info & Info_t
Definition: TGenCollectionProxy.h:41
TGenCollectionProxy::fCollect
Collectfunc_t fCollect
Method to collect objects from container.
Definition: TGenCollectionProxy.h:309
TGenCollectionStreamer::ReadPairFromMap
void ReadPairFromMap(int nElements, TBuffer &b)
Definition: TGenCollectionStreamer.cxx:470
TGenCollectionStreamer::TGenCollectionStreamer
TGenCollectionStreamer(const TGenCollectionStreamer &copy)
Definition: TGenCollectionStreamer.cxx:33
TGenCollectionProxy::fSize
Method fSize
Container accessors: size of container.
Definition: TGenCollectionProxy.h:302
TClass
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
TGenCollectionStreamer::StreamerAsMap
virtual void StreamerAsMap(TBuffer &refBuffer)
Definition: TGenCollectionStreamer.cxx:1463
TGenCollectionStreamer::ConvertBufferVectorPrimitives
void ConvertBufferVectorPrimitives(TBuffer &b, void *obj, Int_t nElements)
Definition: TGenCollectionStreamer.cxx:1113
TGenCollectionProxy::fValDiff
int fValDiff
Offset between two consecutive value_types (memory layout).
Definition: TGenCollectionProxy.h:316
TGenCollectionStreamer::ReadPrimitives
void ReadPrimitives(int nElements, TBuffer &b, const TClass *onfileClass)
Definition: TGenCollectionStreamer.cxx:211
ROOT::Math::Chebyshev::T
double T(double x)
Definition: ChebyshevPol.h:34
TGenCollectionProxy
Proxy around an arbitrary container, which implements basic functionality and iteration.
Definition: TGenCollectionProxy.h:31
TGenCollectionProxy::fValOffset
int fValOffset
Offset from key to value (in maps)
Definition: TGenCollectionProxy.h:315
TGenCollectionProxy::Streamer
virtual void Streamer(TBuffer &refBuffer)
Streamer Function.
Definition: TGenCollectionProxy.cxx:1382
TGenCollectionStreamer
Definition: TGenCollectionStreamer.h:17
TGenCollectionProxy::fNext
Method fNext
Container accessors: generic iteration: next.
Definition: TGenCollectionProxy.h:305
TGenCollectionStreamer::WritePrimitives
void WritePrimitives(int nElements, TBuffer &b)
Definition: TGenCollectionStreamer.cxx:892
TGenCollectionProxy::fFirst
Method fFirst
Container accessors: generic iteration: first.
Definition: TGenCollectionProxy.h:304
TGenCollectionStreamer::WriteObjects
void WriteObjects(int nElements, TBuffer &b)
Definition: TGenCollectionStreamer.cxx:966
TVirtualCollectionProxy
Definition: TVirtualCollectionProxy.h:38
int