Logo ROOT   6.14/05
Reference Guide
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 #include "TString.h"
25 
26 
27 class TSQLResult;
28 class TSQLRow;
29 
30 class TBufferSQL : public TBufferFile {
31 
32 private:
33  std::vector<Int_t>::const_iterator fIter;
34 
35  std::vector<Int_t> *fColumnVec; //!
38 
39  // TBuffer objects cannot be copied or assigned
40  TBufferSQL(const TBufferSQL &); // not implemented
41  void operator=(const TBufferSQL &); // not implemented
42 
43 public:
44  TBufferSQL();
45  TBufferSQL(TBuffer::EMode mode, std::vector<Int_t> *vc, TString *insert_query, TSQLRow **rowPtr);
46  TBufferSQL(TBuffer::EMode mode, Int_t bufsiz, std::vector<Int_t> *vc, TString *insert_query, TSQLRow **rowPtr);
47  TBufferSQL(TBuffer::EMode mode, Int_t bufsiz, std::vector<Int_t> *vc, TString *insert_query, TSQLRow **rowPtr,void *buf, Bool_t adopt = kTRUE);
48  ~TBufferSQL();
49 
50  void ResetOffset();
51 
52  virtual void ReadBool(Bool_t &b);
53  virtual void ReadChar(Char_t &c);
54  virtual void ReadUChar(UChar_t &c);
55  virtual void ReadShort(Short_t &s);
56  virtual void ReadUShort(UShort_t &s);
57  virtual void ReadInt(Int_t &i);
58  virtual void ReadUInt(UInt_t &i);
59  virtual void ReadLong(Long_t &l);
60  virtual void ReadULong(ULong_t &l);
61  virtual void ReadLong64(Long64_t &l);
62  virtual void ReadULong64(ULong64_t &l);
63  virtual void ReadFloat(Float_t &f);
64  virtual void ReadDouble(Double_t &d);
65  virtual void ReadCharP(Char_t *c);
66  virtual void ReadTString(TString &s);
67  virtual void ReadStdString(std::string *s);
69  virtual void ReadCharStar(char* &s);
70 
71  virtual void WriteBool(Bool_t b);
72  virtual void WriteChar(Char_t c);
73  virtual void WriteUChar(UChar_t c);
74  virtual void WriteShort(Short_t s);
75  virtual void WriteUShort(UShort_t s);
76  virtual void WriteInt(Int_t i);
77  virtual void WriteUInt(UInt_t i);
78  virtual void WriteLong(Long_t l);
79  virtual void WriteULong(ULong_t l);
80  virtual void WriteLong64(Long64_t l);
81  virtual void WriteULong64(ULong64_t l);
82  virtual void WriteFloat(Float_t f);
83  virtual void WriteDouble(Double_t d);
84  virtual void WriteCharP(const Char_t *c);
85  virtual void WriteTString(const TString &s);
86  virtual void WriteStdString(const std::string *s);
88  virtual void WriteCharStar(char *s);
89 
90  virtual void WriteFastArray(const Bool_t *b, Int_t n);
91  virtual void WriteFastArray(const Char_t *c, Int_t n);
92  virtual void WriteFastArrayString(const Char_t *c, Int_t n);
93  virtual void WriteFastArray(const UChar_t *c, Int_t n);
94  virtual void WriteFastArray(const Short_t *h, Int_t n);
95  virtual void WriteFastArray(const UShort_t *h, Int_t n);
96  virtual void WriteFastArray(const Int_t *i, Int_t n);
97  virtual void WriteFastArray(const UInt_t *i, Int_t n);
98  virtual void WriteFastArray(const Long_t *l, Int_t n);
99  virtual void WriteFastArray(const ULong_t *l, Int_t n);
100  virtual void WriteFastArray(const Long64_t *l, Int_t n);
101  virtual void WriteFastArray(const ULong64_t *l, Int_t n);
102  virtual void WriteFastArray(const Float_t *f, Int_t n);
103  virtual void WriteFastArray(const Double_t *d, Int_t n);
104  virtual void WriteFastArray(void *start, const TClass *cl, Int_t n=1, TMemberStreamer *s=0);
105  virtual Int_t WriteFastArray(void **startp, const TClass *cl, Int_t n=1, Bool_t isPreAlloc=kFALSE, TMemberStreamer *s=0);
106 
107  virtual void ReadFastArray(Bool_t *, Int_t );
108  virtual void ReadFastArray(Char_t *, Int_t );
109  virtual void ReadFastArrayString(Char_t *, Int_t );
110  virtual void ReadFastArray(UChar_t *, Int_t );
111  virtual void ReadFastArray(Short_t *, Int_t );
112  virtual void ReadFastArray(UShort_t *, Int_t );
113  virtual void ReadFastArray(Int_t *, Int_t );
114  virtual void ReadFastArray(UInt_t *, Int_t );
115  virtual void ReadFastArray(Long_t *, Int_t );
116  virtual void ReadFastArray(ULong_t *, Int_t );
117  virtual void ReadFastArray(Long64_t *, Int_t );
118  virtual void ReadFastArray(ULong64_t *, Int_t );
119  virtual void ReadFastArray(Float_t *, Int_t );
120  virtual void ReadFastArray(Double_t *, Int_t );
121  virtual void ReadFastArrayFloat16(Float_t *f, Int_t n, TStreamerElement *ele=0);
122  virtual void ReadFastArrayDouble32(Double_t *d, Int_t n, TStreamerElement *ele=0);
123  virtual void ReadFastArrayWithFactor(Float_t *ptr, Int_t n, Double_t factor, Double_t minvalue) ;
124  virtual void ReadFastArrayWithNbits(Float_t *ptr, Int_t n, Int_t nbits);
125  virtual void ReadFastArrayWithFactor(Double_t *ptr, Int_t n, Double_t factor, Double_t minvalue);
126  virtual void ReadFastArrayWithNbits(Double_t *ptr, Int_t n, Int_t nbits) ;
127  virtual void ReadFastArray(void *, const TClass *, Int_t n=1, TMemberStreamer *s=0, const TClass *onFileClass=0);
128  virtual void ReadFastArray(void **, const TClass *, Int_t n=1, Bool_t isPreAlloc=kFALSE, TMemberStreamer *s=0, const TClass *onFileClass=0);
129 
130  ClassDef(TBufferSQL, 0); // Implementation of TBuffer to load and write to a SQL database
131 
132 };
133 
134 #endif
135 
136 
virtual void ReadLong64(Long64_t &l)
Operator>>
Definition: TBufferSQL.cxx:265
virtual void WriteUShort(UShort_t s)
Operator<<.
Definition: TBufferSQL.cxx:359
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket...
Definition: TBufferFile.h:46
virtual void WriteUChar(UChar_t c)
Operator<<.
Definition: TBufferSQL.cxx:349
virtual void ReadStdString(std::string *s)
Read a std::string.
Definition: TBufferSQL.cxx:314
long long Long64_t
Definition: RtypesCore.h:69
Implement TBuffer for a SQL backend.
Definition: TBufferSQL.h:30
float Float_t
Definition: RtypesCore.h:53
virtual void WriteChar(Char_t c)
Operator<<.
Definition: TBufferSQL.cxx:161
unsigned short UShort_t
Definition: RtypesCore.h:36
virtual void WriteCharP(const Char_t *c)
Operator<<.
Definition: TBufferSQL.cxx:409
Basic string class.
Definition: TString.h:131
TString * fInsertQuery
Definition: TBufferSQL.h:36
#define f(i)
Definition: RSha256.hxx:104
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void ResetOffset()
Reset Offset.
Definition: TBufferSQL.cxx:818
virtual void ReadFastArrayWithFactor(Float_t *ptr, Int_t n, Double_t factor, Double_t minvalue)
Read array of Float16_t from buffer.
Definition: TBufferSQL.cxx:762
virtual void WriteShort(Short_t s)
Operator<<.
Definition: TBufferSQL.cxx:171
virtual void ReadUChar(UChar_t &c)
Operator>>
Definition: TBufferSQL.cxx:221
std::vector< Int_t >::const_iterator fIter
Definition: TBufferSQL.h:33
virtual void ReadLong(Long_t &l)
Operator>>
Definition: TBufferSQL.cxx:131
#define ClassDef(name, id)
Definition: Rtypes.h:320
virtual void ReadChar(Char_t &c)
Operator>>
Definition: TBufferSQL.cxx:91
virtual void ReadCharP(Char_t *c)
Operator>>
Definition: TBufferSQL.cxx:289
virtual void ReadInt(Int_t &i)
Operator>>
Definition: TBufferSQL.cxx:111
virtual void ReadUShort(UShort_t &s)
Operator>>
Definition: TBufferSQL.cxx:231
virtual void ReadFloat(Float_t &f)
Operator>>
Definition: TBufferSQL.cxx:121
virtual void ReadStdString(std::string *s)=0
virtual void WriteFastArray(const Bool_t *b, Int_t n)
WriteFastArray SQL implementation.
Definition: TBufferSQL.cxx:420
virtual void WriteFastArrayString(const Char_t *c, Int_t n)
WriteFastArray SQL implementation.
Definition: TBufferSQL.cxx:444
virtual void ReadTString(TString &s)
Read a TString.
Definition: TBufferSQL.cxx:298
virtual void WriteFloat(Float_t f)
Operator<<.
Definition: TBufferSQL.cxx:201
virtual void ReadShort(Short_t &s)
Operator>>
Definition: TBufferSQL.cxx:101
TBufferSQL()
Constructor.
Definition: TBufferSQL.cxx:66
virtual void WriteInt(Int_t i)
Operator<<.
Definition: TBufferSQL.cxx:181
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual void WriteLong(Long_t l)
Operator<<.
Definition: TBufferSQL.cxx:191
std::vector< Int_t > * fColumnVec
Definition: TBufferSQL.h:35
short Short_t
Definition: RtypesCore.h:35
virtual void WriteLong64(Long64_t l)
Operator<<.
Definition: TBufferSQL.cxx:389
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
virtual void WriteCharStar(char *s)
Write a char* string.
Definition: TBufferSQL.cxx:338
virtual void ReadFastArray(Bool_t *, Int_t)
ReadFastArray SQL implementation.
Definition: TBufferSQL.cxx:605
#define h(i)
Definition: RSha256.hxx:106
const Bool_t kFALSE
Definition: RtypesCore.h:88
virtual void WriteStdString(const std::string *s)
Write a std::string.
Definition: TBufferSQL.cxx:322
long Long_t
Definition: RtypesCore.h:50
void operator=(const TBufferSQL &)
#define d(i)
Definition: RSha256.hxx:102
virtual void ReadULong(ULong_t &l)
Operator>>
Definition: TBufferSQL.cxx:253
virtual void ReadFastArrayFloat16(Float_t *f, Int_t n, TStreamerElement *ele=0)
ReadFastArray SQL implementation.
Definition: TBufferSQL.cxx:754
virtual void ReadCharStar(char *&s)
Read a char* string.
Definition: TBufferSQL.cxx:330
virtual void WriteBool(Bool_t b)
Operator<<.
Definition: TBufferSQL.cxx:151
double Double_t
Definition: RtypesCore.h:55
virtual void ReadUInt(UInt_t &i)
Operator>>
Definition: TBufferSQL.cxx:241
unsigned long long ULong64_t
Definition: RtypesCore.h:70
unsigned long ULong_t
Definition: RtypesCore.h:51
virtual void ReadFastArrayString(Char_t *, Int_t)
ReadFastArray SQL implementation.
Definition: TBufferSQL.cxx:627
virtual void WriteUInt(UInt_t i)
Operator<<.
Definition: TBufferSQL.cxx:369
static constexpr double s
~TBufferSQL()
Destructor.
Definition: TBufferSQL.cxx:73
char Char_t
Definition: RtypesCore.h:29
virtual void WriteULong(ULong_t l)
Operator<<.
Definition: TBufferSQL.cxx:379
virtual void ReadDouble(Double_t &d)
Operator>>
Definition: TBufferSQL.cxx:141
virtual void WriteDouble(Double_t d)
Operator<<.
Definition: TBufferSQL.cxx:211
auto * l
Definition: textangle.C:4
virtual void WriteULong64(ULong64_t l)
Operator<<.
Definition: TBufferSQL.cxx:399
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
#define c(i)
Definition: RSha256.hxx:101
virtual void WriteTString(const TString &s)
Write a TString.
Definition: TBufferSQL.cxx:306
virtual void ReadFastArrayWithNbits(Float_t *ptr, Int_t n, Int_t nbits)
Read array of Float16_t from buffer.
Definition: TBufferSQL.cxx:770
virtual void ReadBool(Bool_t &b)
Operator>>
Definition: TBufferSQL.cxx:81
unsigned char UChar_t
Definition: RtypesCore.h:34
TSQLRow ** fRowPtr
Definition: TBufferSQL.h:37
virtual void WriteStdString(const std::string *s)=0
const Bool_t kTRUE
Definition: RtypesCore.h:87
virtual void ReadULong64(ULong64_t &l)
Operator>>
Definition: TBufferSQL.cxx:277
const Int_t n
Definition: legend1.C:16
virtual void ReadFastArrayDouble32(Double_t *d, Int_t n, TStreamerElement *ele=0)
ReadFastArray SQL implementation.
Definition: TBufferSQL.cxx:794