File indexing completed on 2025-01-18 10:11:49
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef ROOT_TGenCollectionStreamer
0012 #define ROOT_TGenCollectionStreamer
0013
0014 #include "TGenCollectionProxy.h"
0015 #include "TCollectionProxyFactory.h"
0016
0017 class TGenCollectionStreamer : public TGenCollectionProxy {
0018
0019 protected:
0020 void ReadMapHelper(StreamHelper *i, Value *v, Bool_t vsn3, TBuffer &b);
0021 void ReadMap(int nElements, TBuffer &b, const TClass *onfileClass);
0022 void ReadPairFromMap(int nElements, TBuffer &b);
0023 void ReadObjects(int nElements, TBuffer &b, const TClass *onfileClass);
0024 void ReadPrimitives(int nElements, TBuffer &b, const TClass *onfileClass);
0025 void WriteMap(int nElements, TBuffer &b);
0026 void WriteObjects(int nElements, TBuffer &b);
0027 void WritePrimitives(int nElements, TBuffer &b);
0028
0029
0030
0031
0032 typedef void (TGenCollectionStreamer::*ReadBuffer_t)(TBuffer &b, void *obj, const TClass *onFileClass);
0033 ReadBuffer_t fReadBufferFunc;
0034
0035 template <typename From, typename To> void ConvertBufferVectorPrimitives(TBuffer &b, void *obj, Int_t nElements);
0036 template <typename To> void ConvertBufferVectorPrimitivesFloat16(TBuffer &b, void *obj, Int_t nElements);
0037 template <typename To> void ConvertBufferVectorPrimitivesDouble32(TBuffer &b, void *obj, Int_t nElements);
0038 template <typename To> void DispatchConvertBufferVectorPrimitives(TBuffer &b, void *obj, Int_t nElements, const TVirtualCollectionProxy *onfileProxy);
0039 template <typename basictype> void ReadBufferVectorPrimitives(TBuffer &b, void *obj, const TClass *onFileClass);
0040 void ReadBufferVectorPrimitivesFloat16(TBuffer &b, void *obj, const TClass *onFileClass);
0041 void ReadBufferVectorPrimitivesDouble32(TBuffer &b, void *obj, const TClass *onFileClass);
0042 void ReadBufferDefault(TBuffer &b, void *obj, const TClass *onFileClass);
0043 void ReadBufferGeneric(TBuffer &b, void *obj, const TClass *onFileClass);
0044
0045 private:
0046 TGenCollectionStreamer &operator=(const TGenCollectionStreamer&);
0047
0048 public:
0049
0050 TVirtualCollectionProxy* Generate() const override;
0051
0052
0053 TGenCollectionStreamer(const TGenCollectionStreamer& copy);
0054
0055
0056 TGenCollectionStreamer(Info_t typ, size_t iter_size);
0057 TGenCollectionStreamer(const ROOT::TCollectionProxyInfo &info, TClass *cl);
0058
0059
0060 ~TGenCollectionStreamer() override;
0061
0062
0063 void Streamer(TBuffer &refBuffer) override;
0064
0065
0066 virtual void StreamerAsMap(TBuffer &refBuffer);
0067
0068
0069 void Streamer(TBuffer &buff, void *pObj, int siz) override {
0070 TGenCollectionProxy::Streamer(buff, pObj, siz);
0071 }
0072
0073
0074 void ReadBuffer(TBuffer &b, void *obj, const TClass *onfileClass) override;
0075
0076
0077 void ReadBuffer(TBuffer &b, void *obj) override;
0078 };
0079
0080 template <typename T>
0081 struct AnyCollectionStreamer : public TGenCollectionStreamer {
0082 AnyCollectionStreamer()
0083 : TGenCollectionStreamer(typeid(T::Cont_t),sizeof(T::Iter_t)) {
0084 fValDiff = sizeof(T::Value_t);
0085 fValOffset = T::value_offset();
0086 fSize.call = T::size;
0087 fFirst.call = T::first;
0088 fNext.call = T::next;
0089 fClear.call = T::clear;
0090 fResize = T::resize;
0091 fCollect = T::collect;
0092 fConstruct = T::construct;
0093 fDestruct = T::destruct;
0094 fFeed = T::feed;
0095 CheckFunctions();
0096 }
0097 ~AnyCollectionStreamer() override {}
0098 };
0099
0100
0101 typedef TGenCollectionStreamer TGenMapStreamer;
0102
0103 #endif