Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:34

0001 // @(#)root/tree:$Id$
0002 // Author: Philippe Canal 2005
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TBufferSQL
0013 #define ROOT_TBufferSQL
0014 
0015 //////////////////////////////////////////////////////////////////////////
0016 //                                                                      //
0017 // TBufferSQL                                                           //
0018 //                                                                      //
0019 // Implement TBuffer for a SQL backend                                  //
0020 //                                                                      //
0021 //////////////////////////////////////////////////////////////////////////
0022 
0023 #include "TBufferFile.h"
0024 
0025 #include <vector>
0026 #include <string>
0027 
0028 class TSQLRow;
0029 
0030 class TBufferSQL final : public TBufferFile {
0031 
0032 private:
0033    std::vector<Int_t>::const_iterator fIter;
0034 
0035    std::vector<Int_t>  *fColumnVec{nullptr};   //!
0036    TString             *fInsertQuery{nullptr}; //!
0037    TSQLRow            **fRowPtr{nullptr};      //!
0038 
0039    // TBuffer objects cannot be copied or assigned
0040    TBufferSQL(const TBufferSQL &);        // not implemented
0041    void operator=(const TBufferSQL &);    // not implemented
0042 
0043 public:
0044    TBufferSQL();
0045    TBufferSQL(TBuffer::EMode mode, std::vector<Int_t> *vc, TString *insert_query, TSQLRow **rowPtr);
0046    TBufferSQL(TBuffer::EMode mode, Int_t bufsiz, std::vector<Int_t> *vc, TString *insert_query, TSQLRow **rowPtr);
0047    TBufferSQL(TBuffer::EMode mode, Int_t bufsiz, std::vector<Int_t> *vc, TString *insert_query, TSQLRow **rowPtr,void *buf, bool adopt = true);
0048    ~TBufferSQL() override;
0049 
0050    void ResetOffset();
0051 
0052    void     ReadBool(bool         &b) final;
0053    void     ReadChar(Char_t       &c) final;
0054    void     ReadUChar(UChar_t     &c) final;
0055    void     ReadShort(Short_t     &s) final;
0056    void     ReadUShort(UShort_t   &s) final;
0057    void     ReadInt(Int_t         &i) final;
0058    void     ReadUInt(UInt_t       &i) final;
0059    void     ReadLong(Long_t       &l) final;
0060    void     ReadULong(ULong_t     &l) final;
0061    void     ReadLong64(Long64_t   &l) final;
0062    void     ReadULong64(ULong64_t &l) final;
0063    void     ReadFloat(Float_t     &f) final;
0064    void     ReadDouble(Double_t   &d) final;
0065    void     ReadCharP(Char_t      *c) final;
0066    void     ReadTString(TString   &s) final;
0067    void     ReadStdString(std::string *s) final;
0068    using    TBuffer::ReadStdString;
0069    void     ReadCharStar(char* &s) final;
0070 
0071    void     WriteBool(bool         b) final;
0072    void     WriteChar(Char_t       c) final;
0073    void     WriteUChar(UChar_t     c) final;
0074    void     WriteShort(Short_t     s) final;
0075    void     WriteUShort(UShort_t   s) final;
0076    void     WriteInt(Int_t         i) final;
0077    void     WriteUInt(UInt_t       i) final;
0078    void     WriteLong(Long_t       l) final;
0079    void     WriteULong(ULong_t     l) final;
0080    void     WriteLong64(Long64_t   l) final;
0081    void     WriteULong64(ULong64_t l) final;
0082    void     WriteFloat(Float_t     f) final;
0083    void     WriteDouble(Double_t   d) final;
0084    void     WriteCharP(const Char_t *c) final;
0085    void     WriteTString(const TString  &s) final;
0086    void     WriteStdString(const std::string *s) final;
0087    using    TBuffer::WriteStdString;
0088    void     WriteCharStar(char *s) final;
0089 
0090    void     WriteFastArray(const bool      *b, Long64_t n) final;
0091    void     WriteFastArray(const Char_t    *c, Long64_t n) final;
0092    void     WriteFastArrayString(const Char_t   *c, Long64_t n) final;
0093    void     WriteFastArray(const UChar_t   *c, Long64_t n) final;
0094    void     WriteFastArray(const Short_t   *h, Long64_t n) final;
0095    void     WriteFastArray(const UShort_t  *h, Long64_t n) final;
0096    void     WriteFastArray(const Int_t     *i, Long64_t n) final;
0097    void     WriteFastArray(const UInt_t    *i, Long64_t n) final;
0098    void     WriteFastArray(const Long_t    *l, Long64_t n) final;
0099    void     WriteFastArray(const ULong_t   *l, Long64_t n) final;
0100    void     WriteFastArray(const Long64_t  *l, Long64_t n) final;
0101    void     WriteFastArray(const ULong64_t *l, Long64_t n) final;
0102    void     WriteFastArray(const Float_t   *f, Long64_t n) final;
0103    void     WriteFastArray(const Double_t  *d, Long64_t n) final;
0104    void     WriteFastArray(void  *start,  const TClass *cl, Long64_t n=1, TMemberStreamer *s=nullptr) final;
0105    Int_t    WriteFastArray(void **startp, const TClass *cl, Long64_t n=1, bool isPreAlloc=false, TMemberStreamer *s=nullptr) final;
0106 
0107    void     ReadFastArray(bool      *, Int_t ) final;
0108    void     ReadFastArray(Char_t    *, Int_t ) final;
0109    void     ReadFastArrayString(Char_t   *, Int_t ) final;
0110    void     ReadFastArray(UChar_t   *, Int_t ) final;
0111    void     ReadFastArray(Short_t   *, Int_t ) final;
0112    void     ReadFastArray(UShort_t  *, Int_t ) final;
0113    void     ReadFastArray(Int_t     *, Int_t ) final;
0114    void     ReadFastArray(UInt_t    *, Int_t ) final;
0115    void     ReadFastArray(Long_t    *, Int_t ) final;
0116    void     ReadFastArray(ULong_t   *, Int_t ) final;
0117    void     ReadFastArray(Long64_t  *, Int_t ) final;
0118    void     ReadFastArray(ULong64_t *, Int_t ) final;
0119    void     ReadFastArray(Float_t   *, Int_t ) final;
0120    void     ReadFastArray(Double_t  *, Int_t ) final;
0121    void     ReadFastArrayFloat16(Float_t  *f, Int_t n, TStreamerElement *ele=nullptr) final;
0122    void     ReadFastArrayDouble32(Double_t  *d, Int_t n, TStreamerElement *ele=nullptr) final;
0123    void     ReadFastArrayWithFactor(Float_t *ptr, Int_t n, Double_t factor, Double_t minvalue)  final;
0124    void     ReadFastArrayWithNbits(Float_t *ptr, Int_t n, Int_t nbits) final;
0125    void     ReadFastArrayWithFactor(Double_t *ptr, Int_t n, Double_t factor, Double_t minvalue) final;
0126    void     ReadFastArrayWithNbits(Double_t *ptr, Int_t n, Int_t nbits)  final;
0127    void     ReadFastArray(void  *, const TClass *, Int_t n=1, TMemberStreamer *s=nullptr, const TClass *onFileClass=nullptr) final;
0128    void     ReadFastArray(void **, const TClass *, Int_t n=1, bool isPreAlloc=false, TMemberStreamer *s=nullptr, const TClass *onFileClass=nullptr) final;
0129 
0130    ClassDefOverride(TBufferSQL, 0); // Implementation of TBuffer to load and write to a SQL database
0131 
0132 };
0133 
0134 #endif
0135 
0136