Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TBufferSQL.h
Go to the documentation of this file.
1 // @(#)root/tree:$Id$
2 // Author: Philippe Canal 2005
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, 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 
12 #ifndef ROOT_TBufferSQL
13 #define ROOT_TBufferSQL
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TBufferSQL //
18 // //
19 // Implement TBuffer for a SQL backend //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #include "TBufferFile.h"
24 
25 class TSQLRow;
26 
27 class TBufferSQL final : public TBufferFile {
28 
29 private:
30  std::vector<Int_t>::const_iterator fIter;
31 
32  std::vector<Int_t> *fColumnVec{nullptr}; //!
33  TString *fInsertQuery{nullptr}; //!
34  TSQLRow **fRowPtr{nullptr}; //!
35 
36  // TBuffer objects cannot be copied or assigned
37  TBufferSQL(const TBufferSQL &); // not implemented
38  void operator=(const TBufferSQL &); // not implemented
39 
40 public:
41  TBufferSQL();
42  TBufferSQL(TBuffer::EMode mode, std::vector<Int_t> *vc, TString *insert_query, TSQLRow **rowPtr);
43  TBufferSQL(TBuffer::EMode mode, Int_t bufsiz, std::vector<Int_t> *vc, TString *insert_query, TSQLRow **rowPtr);
44  TBufferSQL(TBuffer::EMode mode, Int_t bufsiz, std::vector<Int_t> *vc, TString *insert_query, TSQLRow **rowPtr,void *buf, Bool_t adopt = kTRUE);
45  ~TBufferSQL();
46 
47  void ResetOffset();
48 
49  void ReadBool(Bool_t &b) final;
50  void ReadChar(Char_t &c) final;
51  void ReadUChar(UChar_t &c) final;
52  void ReadShort(Short_t &s) final;
53  void ReadUShort(UShort_t &s) final;
54  void ReadInt(Int_t &i) final;
55  void ReadUInt(UInt_t &i) final;
56  void ReadLong(Long_t &l) final;
57  void ReadULong(ULong_t &l) final;
58  void ReadLong64(Long64_t &l) final;
59  void ReadULong64(ULong64_t &l) final;
60  void ReadFloat(Float_t &f) final;
61  void ReadDouble(Double_t &d) final;
62  void ReadCharP(Char_t *c) final;
63  void ReadTString(TString &s) final;
64  void ReadStdString(std::string *s) final;
65  using TBuffer::ReadStdString;
66  void ReadCharStar(char* &s) final;
67 
68  void WriteBool(Bool_t b) final;
69  void WriteChar(Char_t c) final;
70  void WriteUChar(UChar_t c) final;
71  void WriteShort(Short_t s) final;
72  void WriteUShort(UShort_t s) final;
73  void WriteInt(Int_t i) final;
74  void WriteUInt(UInt_t i) final;
75  void WriteLong(Long_t l) final;
76  void WriteULong(ULong_t l) final;
77  void WriteLong64(Long64_t l) final;
78  void WriteULong64(ULong64_t l) final;
79  void WriteFloat(Float_t f) final;
80  void WriteDouble(Double_t d) final;
81  void WriteCharP(const Char_t *c) final;
82  void WriteTString(const TString &s) final;
83  void WriteStdString(const std::string *s) final;
84  using TBuffer::WriteStdString;
85  void WriteCharStar(char *s) final;
86 
87  void WriteFastArray(const Bool_t *b, Int_t n) final;
88  void WriteFastArray(const Char_t *c, Int_t n) final;
89  void WriteFastArrayString(const Char_t *c, Int_t n) final;
90  void WriteFastArray(const UChar_t *c, Int_t n) final;
91  void WriteFastArray(const Short_t *h, Int_t n) final;
92  void WriteFastArray(const UShort_t *h, Int_t n) final;
93  void WriteFastArray(const Int_t *i, Int_t n) final;
94  void WriteFastArray(const UInt_t *i, Int_t n) final;
95  void WriteFastArray(const Long_t *l, Int_t n) final;
96  void WriteFastArray(const ULong_t *l, Int_t n) final;
97  void WriteFastArray(const Long64_t *l, Int_t n) final;
98  void WriteFastArray(const ULong64_t *l, Int_t n) final;
99  void WriteFastArray(const Float_t *f, Int_t n) final;
100  void WriteFastArray(const Double_t *d, Int_t n) final;
101  void WriteFastArray(void *start, const TClass *cl, Int_t n=1, TMemberStreamer *s=nullptr) final;
102  Int_t WriteFastArray(void **startp, const TClass *cl, Int_t n=1, Bool_t isPreAlloc=kFALSE, TMemberStreamer *s=nullptr) final;
103 
104  void ReadFastArray(Bool_t *, Int_t ) final;
105  void ReadFastArray(Char_t *, Int_t ) final;
106  void ReadFastArrayString(Char_t *, Int_t ) final;
107  void ReadFastArray(UChar_t *, Int_t ) final;
108  void ReadFastArray(Short_t *, Int_t ) final;
109  void ReadFastArray(UShort_t *, Int_t ) final;
110  void ReadFastArray(Int_t *, Int_t ) final;
111  void ReadFastArray(UInt_t *, Int_t ) final;
112  void ReadFastArray(Long_t *, Int_t ) final;
113  void ReadFastArray(ULong_t *, Int_t ) final;
114  void ReadFastArray(Long64_t *, Int_t ) final;
115  void ReadFastArray(ULong64_t *, Int_t ) final;
116  void ReadFastArray(Float_t *, Int_t ) final;
117  void ReadFastArray(Double_t *, Int_t ) final;
118  void ReadFastArrayFloat16(Float_t *f, Int_t n, TStreamerElement *ele=nullptr) final;
119  void ReadFastArrayDouble32(Double_t *d, Int_t n, TStreamerElement *ele=nullptr) final;
120  void ReadFastArrayWithFactor(Float_t *ptr, Int_t n, Double_t factor, Double_t minvalue) final;
121  void ReadFastArrayWithNbits(Float_t *ptr, Int_t n, Int_t nbits) final;
122  void ReadFastArrayWithFactor(Double_t *ptr, Int_t n, Double_t factor, Double_t minvalue) final;
123  void ReadFastArrayWithNbits(Double_t *ptr, Int_t n, Int_t nbits) final;
124  void ReadFastArray(void *, const TClass *, Int_t n=1, TMemberStreamer *s=nullptr, const TClass *onFileClass=nullptr) final;
125  void ReadFastArray(void **, const TClass *, Int_t n=1, Bool_t isPreAlloc=kFALSE, TMemberStreamer *s=nullptr, const TClass *onFileClass=nullptr) final;
126 
127  ClassDefOverride(TBufferSQL, 0); // Implementation of TBuffer to load and write to a SQL database
128 
129 };
130 
131 #endif
132 
133