Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
19protected:
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
45private:
47
48public:
49 // Virtual copy constructor
50 TVirtualCollectionProxy* Generate() const override;
51
52 // Copy constructor
54
55 // Initializing constructor
56 TGenCollectionStreamer(Info_t typ, size_t iter_size);
58
59 // Standard destructor
60 ~TGenCollectionStreamer() override;
61
62 // Streamer I/O overload
63 void Streamer(TBuffer &refBuffer) override;
64
65 // Streamer I/O overload
66 virtual void StreamerAsMap(TBuffer &refBuffer);
67
68 // Streamer I/O overload
69 void Streamer(TBuffer &buff, void *pObj, int siz) override {
70 TGenCollectionProxy::Streamer(buff, pObj, siz);
71 }
72
73 // Routine to read the content of the buffer into 'obj'.
74 void ReadBuffer(TBuffer &b, void *obj, const TClass *onfileClass) override;
75
76 // Routine to read the content of the buffer into 'obj'.
77 void ReadBuffer(TBuffer &b, void *obj) override;
78};
79
80template <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 }
98};
99
100// Forward declaration in the event of later separation
102
103#endif
#define b(i)
Definition RSha256.hxx:100
TGenCollectionStreamer TGenMapStreamer
Buffer base class used for serializing objects.
Definition TBuffer.h:43
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
Proxy around an arbitrary container, which implements basic functionality and iteration.
Method fFirst
Container accessors: generic iteration: first.
Method fNext
Container accessors: generic iteration: next.
virtual void Streamer(TBuffer &refBuffer)
Streamer Function.
int fValOffset
Offset from key to value (in maps)
Collectfunc_t fCollect
Method to collect objects from container.
Sizing_t fDestruct
Container accessors: block destruct.
Sizing_t fResize
Container accessors: resize container.
ArrIterfunc_t fConstruct
Container accessors: block construct.
void CheckFunctions() const
Check existence of function pointers.
Method fSize
Container accessors: size of container.
Method fClear
Method cache for container accessors: clear container.
Feedfunc_t fFeed
Container accessors: block feed.
int fValDiff
Offset between two consecutive value_types (memory layout).
const std::type_info & Info_t
void ReadBufferDefault(TBuffer &b, void *obj, const TClass *onFileClass)
void ReadPrimitives(int nElements, TBuffer &b, const TClass *onfileClass)
void Streamer(TBuffer &buff, void *pObj, int siz) override
Streamer I/O overload.
void WriteObjects(int nElements, TBuffer &b)
void DispatchConvertBufferVectorPrimitives(TBuffer &b, void *obj, Int_t nElements, const TVirtualCollectionProxy *onfileProxy)
void ReadBufferVectorPrimitivesDouble32(TBuffer &b, void *obj, const TClass *onFileClass)
void WriteMap(int nElements, TBuffer &b)
void ReadMapHelper(StreamHelper *i, Value *v, Bool_t vsn3, TBuffer &b)
void Streamer(TBuffer &refBuffer) override
Streamer Function.
void ReadBuffer(TBuffer &b, void *obj, const TClass *onfileClass) override
void ReadBufferVectorPrimitivesFloat16(TBuffer &b, void *obj, const TClass *onFileClass)
void ReadObjects(int nElements, TBuffer &b, const TClass *onfileClass)
void WritePrimitives(int nElements, TBuffer &b)
void ConvertBufferVectorPrimitivesFloat16(TBuffer &b, void *obj, Int_t nElements)
void ReadPairFromMap(int nElements, TBuffer &b)
void ReadMap(int nElements, TBuffer &b, const TClass *onfileClass)
TGenCollectionStreamer & operator=(const TGenCollectionStreamer &)
void ConvertBufferVectorPrimitivesDouble32(TBuffer &b, void *obj, Int_t nElements)
void ConvertBufferVectorPrimitives(TBuffer &b, void *obj, Int_t nElements)
virtual void StreamerAsMap(TBuffer &refBuffer)
void ReadBufferGeneric(TBuffer &b, void *obj, const TClass *onFileClass)
void(TGenCollectionStreamer::* ReadBuffer_t)(TBuffer &b, void *obj, const TClass *onFileClass)
void ReadBufferVectorPrimitives(TBuffer &b, void *obj, const TClass *onFileClass)
TVirtualCollectionProxy * Generate() const override
Virtual copy constructor.
Defines a common interface to inspect/change the contents of an object that represents a collection.
Small helper to describe the Value_type or the key_type of an STL container.
Helper class to facilitate I/O.