Logo ROOT  
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
25#include <vector>
26#include <string>
27
28class TSQLRow;
29
30class TBufferSQL final : public TBufferFile {
31
32private:
33 std::vector<Int_t>::const_iterator fIter;
34
35 std::vector<Int_t> *fColumnVec{nullptr}; //!
36 TString *fInsertQuery{nullptr}; //!
37 TSQLRow **fRowPtr{nullptr}; //!
38
39 // TBuffer objects cannot be copied or assigned
40 TBufferSQL(const TBufferSQL &); // not implemented
41 void operator=(const TBufferSQL &); // not implemented
42
43public:
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);
49
50 void ResetOffset();
51
52 void ReadBool(Bool_t &b) final;
53 void ReadChar(Char_t &c) final;
54 void ReadUChar(UChar_t &c) final;
55 void ReadShort(Short_t &s) final;
56 void ReadUShort(UShort_t &s) final;
57 void ReadInt(Int_t &i) final;
58 void ReadUInt(UInt_t &i) final;
59 void ReadLong(Long_t &l) final;
60 void ReadULong(ULong_t &l) final;
61 void ReadLong64(Long64_t &l) final;
62 void ReadULong64(ULong64_t &l) final;
63 void ReadFloat(Float_t &f) final;
64 void ReadDouble(Double_t &d) final;
65 void ReadCharP(Char_t *c) final;
66 void ReadTString(TString &s) final;
67 void ReadStdString(std::string *s) final;
69 void ReadCharStar(char* &s) final;
70
71 void WriteBool(Bool_t b) final;
72 void WriteChar(Char_t c) final;
73 void WriteUChar(UChar_t c) final;
74 void WriteShort(Short_t s) final;
75 void WriteUShort(UShort_t s) final;
76 void WriteInt(Int_t i) final;
77 void WriteUInt(UInt_t i) final;
78 void WriteLong(Long_t l) final;
79 void WriteULong(ULong_t l) final;
80 void WriteLong64(Long64_t l) final;
81 void WriteULong64(ULong64_t l) final;
82 void WriteFloat(Float_t f) final;
83 void WriteDouble(Double_t d) final;
84 void WriteCharP(const Char_t *c) final;
85 void WriteTString(const TString &s) final;
86 void WriteStdString(const std::string *s) final;
88 void WriteCharStar(char *s) final;
89
90 void WriteFastArray(const Bool_t *b, Int_t n) final;
91 void WriteFastArray(const Char_t *c, Int_t n) final;
92 void WriteFastArrayString(const Char_t *c, Int_t n) final;
93 void WriteFastArray(const UChar_t *c, Int_t n) final;
94 void WriteFastArray(const Short_t *h, Int_t n) final;
95 void WriteFastArray(const UShort_t *h, Int_t n) final;
96 void WriteFastArray(const Int_t *i, Int_t n) final;
97 void WriteFastArray(const UInt_t *i, Int_t n) final;
98 void WriteFastArray(const Long_t *l, Int_t n) final;
99 void WriteFastArray(const ULong_t *l, Int_t n) final;
100 void WriteFastArray(const Long64_t *l, Int_t n) final;
101 void WriteFastArray(const ULong64_t *l, Int_t n) final;
102 void WriteFastArray(const Float_t *f, Int_t n) final;
103 void WriteFastArray(const Double_t *d, Int_t n) final;
104 void WriteFastArray(void *start, const TClass *cl, Int_t n=1, TMemberStreamer *s=nullptr) final;
105 Int_t WriteFastArray(void **startp, const TClass *cl, Int_t n=1, Bool_t isPreAlloc=kFALSE, TMemberStreamer *s=nullptr) final;
106
107 void ReadFastArray(Bool_t *, Int_t ) final;
108 void ReadFastArray(Char_t *, Int_t ) final;
109 void ReadFastArrayString(Char_t *, Int_t ) final;
110 void ReadFastArray(UChar_t *, Int_t ) final;
111 void ReadFastArray(Short_t *, Int_t ) final;
112 void ReadFastArray(UShort_t *, Int_t ) final;
113 void ReadFastArray(Int_t *, Int_t ) final;
114 void ReadFastArray(UInt_t *, Int_t ) final;
115 void ReadFastArray(Long_t *, Int_t ) final;
116 void ReadFastArray(ULong_t *, Int_t ) final;
117 void ReadFastArray(Long64_t *, Int_t ) final;
118 void ReadFastArray(ULong64_t *, Int_t ) final;
119 void ReadFastArray(Float_t *, Int_t ) final;
120 void ReadFastArray(Double_t *, Int_t ) final;
121 void ReadFastArrayFloat16(Float_t *f, Int_t n, TStreamerElement *ele=nullptr) final;
122 void ReadFastArrayDouble32(Double_t *d, Int_t n, TStreamerElement *ele=nullptr) final;
123 void ReadFastArrayWithFactor(Float_t *ptr, Int_t n, Double_t factor, Double_t minvalue) final;
124 void ReadFastArrayWithNbits(Float_t *ptr, Int_t n, Int_t nbits) final;
125 void ReadFastArrayWithFactor(Double_t *ptr, Int_t n, Double_t factor, Double_t minvalue) final;
126 void ReadFastArrayWithNbits(Double_t *ptr, Int_t n, Int_t nbits) final;
127 void ReadFastArray(void *, const TClass *, Int_t n=1, TMemberStreamer *s=nullptr, const TClass *onFileClass=nullptr) final;
128 void ReadFastArray(void **, const TClass *, Int_t n=1, Bool_t isPreAlloc=kFALSE, TMemberStreamer *s=nullptr, const TClass *onFileClass=nullptr) final;
129
130 ClassDefOverride(TBufferSQL, 0); // Implementation of TBuffer to load and write to a SQL database
131
132};
133
134#endif
135
136
#define d(i)
Definition: RSha256.hxx:102
#define f(i)
Definition: RSha256.hxx:104
#define c(i)
Definition: RSha256.hxx:101
#define h(i)
Definition: RSha256.hxx:106
unsigned short UShort_t
Definition: RtypesCore.h:40
unsigned char UChar_t
Definition: RtypesCore.h:38
char Char_t
Definition: RtypesCore.h:37
const Bool_t kFALSE
Definition: RtypesCore.h:101
long Long_t
Definition: RtypesCore.h:54
float Float_t
Definition: RtypesCore.h:57
short Short_t
Definition: RtypesCore.h:39
long long Long64_t
Definition: RtypesCore.h:80
unsigned long long ULong64_t
Definition: RtypesCore.h:81
const Bool_t kTRUE
Definition: RtypesCore.h:100
unsigned long ULong_t
Definition: RtypesCore.h:55
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
Option_t Option_t TPoint TPoint const char mode
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
Definition: TBufferFile.h:47
Implement TBuffer for a SQL backend.
Definition: TBufferSQL.h:30
void ReadLong(Long_t &l) final
Operator>>
Definition: TBufferSQL.cxx:132
void WriteDouble(Double_t d) final
Operator<<.
Definition: TBufferSQL.cxx:212
~TBufferSQL()
Destructor.
Definition: TBufferSQL.cxx:74
TBufferSQL()
Constructor.
Definition: TBufferSQL.cxx:67
TBufferSQL(const TBufferSQL &)
void ReadFastArrayFloat16(Float_t *f, Int_t n, TStreamerElement *ele=nullptr) final
ReadFastArray SQL implementation.
Definition: TBufferSQL.cxx:760
void WriteFastArray(const Bool_t *b, Int_t n) final
WriteFastArray SQL implementation.
Definition: TBufferSQL.cxx:426
TSQLRow ** fRowPtr
Definition: TBufferSQL.h:37
void WriteULong(ULong_t l) final
Operator<<.
Definition: TBufferSQL.cxx:385
void WriteUInt(UInt_t i) final
Operator<<.
Definition: TBufferSQL.cxx:375
void WriteFloat(Float_t f) final
Operator<<.
Definition: TBufferSQL.cxx:202
void ReadULong64(ULong64_t &l) final
Operator>>
Definition: TBufferSQL.cxx:278
void ReadCharStar(char *&s) final
Read a char* string.
Definition: TBufferSQL.cxx:336
void ReadInt(Int_t &i) final
Operator>>
Definition: TBufferSQL.cxx:112
void ReadTString(TString &s) final
Read a TString.
Definition: TBufferSQL.cxx:299
void WriteUChar(UChar_t c) final
Operator<<.
Definition: TBufferSQL.cxx:355
void WriteShort(Short_t s) final
Operator<<.
Definition: TBufferSQL.cxx:172
void WriteUShort(UShort_t s) final
Operator<<.
Definition: TBufferSQL.cxx:365
void ReadBool(Bool_t &b) final
Operator>>
Definition: TBufferSQL.cxx:82
void ReadShort(Short_t &s) final
Operator>>
Definition: TBufferSQL.cxx:102
void WriteLong(Long_t l) final
Operator<<.
Definition: TBufferSQL.cxx:192
void ReadLong64(Long64_t &l) final
Operator>>
Definition: TBufferSQL.cxx:266
void operator=(const TBufferSQL &)
TString * fInsertQuery
Definition: TBufferSQL.h:36
void ReadChar(Char_t &c) final
Operator>>
Definition: TBufferSQL.cxx:92
std::vector< Int_t > * fColumnVec
Definition: TBufferSQL.h:35
void WriteFastArrayString(const Char_t *c, Int_t n) final
WriteFastArray SQL implementation.
Definition: TBufferSQL.cxx:450
void ReadFastArrayString(Char_t *, Int_t) final
ReadFastArray SQL implementation.
Definition: TBufferSQL.cxx:633
void WriteStdString(const std::string *s) final
Write a std::string.
Definition: TBufferSQL.cxx:328
void ReadStdString(std::string *s) final
Read a std::string.
Definition: TBufferSQL.cxx:320
void WriteInt(Int_t i) final
Operator<<.
Definition: TBufferSQL.cxx:182
void ReadFastArray(Bool_t *, Int_t) final
ReadFastArray SQL implementation.
Definition: TBufferSQL.cxx:611
void ReadUShort(UShort_t &s) final
Operator>>
Definition: TBufferSQL.cxx:232
void ReadFastArrayWithFactor(Float_t *ptr, Int_t n, Double_t factor, Double_t minvalue) final
Read array of Float16_t from buffer.
Definition: TBufferSQL.cxx:768
void WriteTString(const TString &s) final
Write a TString.
Definition: TBufferSQL.cxx:308
void ReadUInt(UInt_t &i) final
Operator>>
Definition: TBufferSQL.cxx:242
void WriteBool(Bool_t b) final
Operator<<.
Definition: TBufferSQL.cxx:152
void WriteULong64(ULong64_t l) final
Operator<<.
Definition: TBufferSQL.cxx:405
void ReadCharP(Char_t *c) final
Operator>>
Definition: TBufferSQL.cxx:290
void WriteCharStar(char *s) final
Write a char* string.
Definition: TBufferSQL.cxx:344
void ReadFastArrayWithNbits(Float_t *ptr, Int_t n, Int_t nbits) final
Read array of Float16_t from buffer.
Definition: TBufferSQL.cxx:776
std::vector< Int_t >::const_iterator fIter
Definition: TBufferSQL.h:33
void ResetOffset()
Reset Offset.
Definition: TBufferSQL.cxx:824
void WriteCharP(const Char_t *c) final
Operator<<.
Definition: TBufferSQL.cxx:415
void WriteLong64(Long64_t l) final
Operator<<.
Definition: TBufferSQL.cxx:395
void ReadDouble(Double_t &d) final
Operator>>
Definition: TBufferSQL.cxx:142
void ReadULong(ULong_t &l) final
Operator>>
Definition: TBufferSQL.cxx:254
void ReadFastArrayDouble32(Double_t *d, Int_t n, TStreamerElement *ele=nullptr) final
ReadFastArray SQL implementation.
Definition: TBufferSQL.cxx:800
void ReadFloat(Float_t &f) final
Operator>>
Definition: TBufferSQL.cxx:122
void WriteChar(Char_t c) final
Operator<<.
Definition: TBufferSQL.cxx:162
void ReadUChar(UChar_t &c) final
Operator>>
Definition: TBufferSQL.cxx:222
virtual void WriteStdString(const std::string *s)=0
virtual void ReadStdString(std::string *s)=0
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
Basic string class.
Definition: TString.h:136
const Int_t n
Definition: legend1.C:16
static constexpr double s
TLine l
Definition: textangle.C:4