59 :
TBufferText(), fSQL(nullptr), fIOVersion(1), fStructure(nullptr), fStk(nullptr), fReadBuffer(), fErrorFlag(0),
60 fCompressLevel(
ROOT::RCompressionSetting::EAlgorithm::kUseGlobal), fReadVersionBuffer(-1), fObjIdCounter(1), fIgnoreVerification(
kFALSE),
61 fCurrentData(nullptr), fObjectsInfos(nullptr), fFirstObjId(0), fLastObjId(0), fPoolsMap(nullptr)
71 :
TBufferText(
mode, file), fSQL(nullptr), fIOVersion(1), fStructure(nullptr), fStk(nullptr), fReadBuffer(), fErrorFlag(0),
72 fCompressLevel(
ROOT::RCompressionSetting::EAlgorithm::kUseGlobal), fReadVersionBuffer(-1), fObjIdCounter(1), fIgnoreVerification(
kFALSE),
73 fCurrentData(nullptr), fObjectsInfos(nullptr), fFirstObjId(0), fLastObjId(0), fPoolsMap(nullptr)
119 std::cout <<
"==== Printout of Sql structures ===== " << std::endl;
121 std::cout <<
"=========== End printout ============ " << std::endl;
172 if (
info->GetObjId() != objid)
178 Info(
"SqlObjectInfo",
"Standard not works %lld", objid);
181 if (
info->GetObjId() == objid)
210 if (
sqlinfo->IsClassTableExist()) {
219 Info(
"SqlObjectData",
"Before request to %s",
sqlinfo->GetClassTableName());
222 Info(
"SqlObjectData",
"After request res = 0x%zx", (
size_t)
alldata);
224 Error(
"SqlObjectData",
"Cannot get data from table %s",
sqlinfo->GetClassTableName());
238 Error(
"SqlObjectData",
"Missmatch in pools map !!! CANNOT BE !!!");
246 Error(
"SqlObjectData",
"Can not find row for objid = %lld in table %s", objid,
sqlinfo->GetClassTableName());
269 Info(
"SqlWriteObject",
"Object: %p Class: %s", obj, (cl ? cl->
GetName() :
"null"));
287 Info(
"SqlWriteObject",
"Find objectid %ld", (
long)objid);
305 ((
TClass *)cl)->Streamer((
void *)obj, *
this);
308 Info(
"SqlWriteObject",
"Done write of %s", cl->
GetName());
331 Error(
"SqlReadObject",
"Invalid object reference value");
345 }
else if (objid == -1) {
348 void *
obj1 =
nullptr;
360 Info(
"SqlReadObject",
"Found pointer %p cl %s", obj, ((cl && *cl) ? (*cl)->GetName() :
"null"));
369 Error(
"SqlReadObject",
"Object reference or pointer is not found in blob data");
376 if ((
gDebug > 2) || (objid < 0))
377 Info(
"SqlReadObject",
"Found object reference %ld", (
long)objid);
396 Info(
"SqlReadObjectDirect",
"objid = %lld clname = %s ver = %d", objid,
clname.Data(),
version);
405 Error(
"SqlReadObjectDirect",
"Class %s is not known",
clname.Data());
418 if (
sqlinfo->IsClassTableExist()) {
437 Error(
"SqlReadObjectDirect",
"No found raw data for obj %lld in class %s version %d table", objid,
458 Info(
"SqlReadObjectDirect",
"Read object of class %s done",
objClass->GetName());
482 Info(
"IncrementLevel",
"Info: %s",
info->GetName());
493 if (
Stack()->GetElement())
501 Info(
"DecrementLevel",
"Info: %s",
info->GetName());
511 if (
Stack()->GetElement())
517 Error(
"SetStreamerElementNumber",
"Error in structures stack");
598 Error(
"ClassMember",
"Invalid member name");
607 if (
strcmp(typeName,
"raw:data") == 0)
613 if ((
dt->GetType() > 0) && (
dt->GetType() < 20))
632 Error(
"ClassMember",
"Invalid class specifier %s", typeName);
673 Error(
"ClassMember",
"Invalid combination name = %s type = %s",
name, typeName);
709 sobjid.Form(
"%lld", objid);
714 Error(
"WorkWithClass",
"cannot define object id");
721 Error(
"WorkWithClass",
"Can not find table for class %s version %d", classname,
classversion);
728 Error(
"WorkWithClass",
"Request error for data of object %lld for class %s version %d", objid, classname,
749 Info(
"WorkWithElement",
"elem = %s",
elem->GetName());
763 Error(
"WorkWithElement",
"Object data is lost");
773 Error(
"WorkWithElement",
"Cannot locate correct column in the table");
817 Info(
"ReadVersion",
"from buffer = %d", (
int)res);
825 Error(
"ReadVersion",
"No correspondent tags to read version");
882 Info(
"SqlReadArrayContent",
"size %d", (
int)(
arrsize));
894 if ((first !=
indx) || (last < first) || (last >=
arrsize)) {
895 Error(
"SqlReadArrayContent",
"Error reading array content %s",
name);
909 Info(
"SqlReadArrayContent",
"done");
1138template <
typename T>
1161 if (!buf || (
n <= 0))
1279 Info(
"ReadFastArray",
"(void *");
1288 char *obj = (
char *)start;
1322 start[
j] = ((
TClass *)cl)->New();
1326 (*streamer)(*
this, (
void *)start,
n);
1337 start[
j] = ((
TClass *)cl)->New();
1338 ((
TClass *)cl)->Streamer(start[
j], *
this);
1352 start[
j] = ((
TClass *)cl)->New();
1358 Info(
"ReadFastArray",
"(void ** Done");
1376template <
typename T>
1383 Fatal(
"SqlWriteArray",
"Not enough space left in the buffer (1GB limit). %lld elements is greater than the max left of %d",
arrsize,
maxElements);
1658 char *obj = (
char *)start;
1687 (*streamer)(*
this, (
void *)start,
n);
1705 ((
TClass *)cl)->Streamer(start[
j], *
this);
1715 start[
j] = ((
TClass *)cl)->New();
1732 ((
TObject *)obj)->TObject::Streamer(*
this);
1735 ((
TNamed *)obj)->TNamed::Streamer(*
this);
1741 Info(
"StreamObject",
"class %s", (cl ? cl->
GetName() :
"none"));
1758 Info(
"StreamObjectExtra",
"class = %s", cl->
GetName());
1942 Error(
"ReadStdString",
"The std::string address is nullptr but should not");
1957 obj->resize(
nbig,
'\0');
1960 obj->resize(
nwh,
'\0');
2008 s =
new char[
nch + 1];
2186 std::string buf = std::to_string(
value);
2263 std::string buf = std::to_string(
value);
2447 Error(
"SqlReadValue",
"No object data to read from");
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
unsigned long long ULong64_t
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char mode
void ForceWriteInfo(TVirtualStreamerInfo *info, Bool_t force) override
force writing the TStreamerInfo to the file
void MapObject(const TObject *obj, UInt_t offset=1) override
Add object to the fMap container.
Long64_t GetObjectTag(const void *obj)
Returns tag for specified object from objects map (if exists) Returns 0 if object not included into o...
void GetMappedObject(UInt_t tag, void *&ptr, TClass *&ClassPtr) const override
Retrieve the object stored in the buffer's object map at 'tag' Set ptr and ClassPtr respectively to t...
Int_t WriteObjectAny(const void *obj, const TClass *ptrClass, Bool_t cacheReuse=kTRUE) override
Write object to I/O buffer.
Converts data to SQL statements or read data from SQL tables.
Long64_t fObjIdCounter
! counter of objects id
void SetStreamerElementNumber(TStreamerElement *elem, Int_t comp_type) final
Function is called from TStreamerInfo WriteBuffer and Readbuffer functions and add/verify next elemen...
TSQLStructure * PopStack()
Pop stack.
Bool_t SqlObjectInfo(Long64_t objid, TString &clname, Version_t &version)
Returns object info like classname and version Should be taken from buffer, which is produced in the ...
void ClassBegin(const TClass *, Version_t=-1) final
This method inform buffer data of which class now will be streamed.
void StreamObjectExtra(void *obj, TMemberStreamer *streamer, const TClass *cl, Int_t n=0, const TClass *onFileClass=nullptr)
Stream object to/from buffer.
void ReadUShort(UShort_t &s) final
Reads UShort_t value from buffer.
Long64_t fFirstObjId
! id of first object to be read from the database
Bool_t SqlWriteBasic(Char_t value)
converts Char_t to string and creates correspondent sql structure
void WriteFastArrayString(const Char_t *c, Long64_t n) final
Write array of n characters into the I/O buffer.
TSQLObjectData * fCurrentData
!
Int_t fErrorFlag
! Error id value
void WriteShort(Short_t s) final
Writes Short_t value to buffer.
void DecrementLevel(TVirtualStreamerInfo *) final
Function is called from TStreamerInfo WriteBuffer and Readbuffer functions and decrease level in sql ...
void WriteULong64(ULong64_t l) final
Writes ULong64_t value to buffer.
void WriteChar(Char_t c) final
Writes Char_t value to buffer.
void WriteCharStar(char *s) final
Write a char* string.
void WriteCharP(const Char_t *c) final
Writes array of characters to buffer.
void WriteFastArray(const Bool_t *b, Long64_t n) final
Write array of Bool_t to buffer.
Long64_t fLastObjId
! id of last object correspond to this key
void WriteInt(Int_t i) final
Writes Int_t value to buffer.
TSQLStructure * PushStack()
Push stack with structural information about streamed object.
void * ReadObjectAny(const TClass *clCast) final
Read object from buffer. Only used from TBuffer.
void ReadLong64(Long64_t &l) final
Reads Long64_t value from buffer.
void WriteULong(ULong_t l) final
Writes ULong_t value to buffer.
void WriteUInt(UInt_t i) final
Writes UInt_t value to buffer.
void ReadLong(Long_t &l) final
Reads Long_t value from buffer.
void WriteLong(Long_t l) final
Writes Long_t value to buffer.
Int_t fIOVersion
! I/O version from TSQLFile
void WriteUShort(UShort_t s) final
Writes UShort_t value to buffer.
TSQLFile * fSQL
! instance of TSQLFile
Int_t ReadStaticArray(Bool_t *b) final
Read array of Bool_t from buffer.
void WriteStdString(const std::string *s) final
Write a std::string.
Int_t fReadVersionBuffer
! buffer, used to by ReadVersion method
void ClassMember(const char *name, const char *typeName=nullptr, Int_t arrsize1=-1, Int_t arrsize2=-1) final
Method indicates name and typename of class memeber, which should be now streamed in custom streamer ...
void ReadFastArray(Bool_t *b, Int_t n) final
Read array of Bool_t from buffer.
void StreamObject(void *obj, const TClass *cl, const TClass *onFileClass=nullptr) final
Stream object to/from buffer.
Bool_t fIgnoreVerification
! ignore verification of names
void ReadUChar(UChar_t &c) final
Reads UChar_t value from buffer.
void ReadShort(Short_t &s) final
Reads Short_t value from buffer.
void ReadBool(Bool_t &b) final
Reads Bool_t value from buffer.
R__ALWAYS_INLINE Int_t SqlReadArray(T *&arr, Bool_t is_static=kFALSE)
void ReadTString(TString &s) final
Read a TString.
TBufferSQL2()
Default constructor, should not be used.
R__ALWAYS_INLINE void SqlReadFastArray(T *arr, Int_t arrsize)
Template method to read content of array, which not include size of array.
void ReadFastArrayString(Char_t *c, Int_t n) final
Read array of n characters from the I/O buffer.
TVirtualStreamerInfo * GetInfo() final
Return current streamer info element.
TSQLStructure * fStructure
! structures, created by object storing
void WriteBool(Bool_t b) final
Writes Bool_t value to buffer.
TClass * ReadClass(const TClass *cl=nullptr, UInt_t *objTag=nullptr) final
Suppressed function of TBuffer.
UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE) final
Copies class version to buffer, but not writes it to sql immidiately Version will be used to produce ...
void ReadCharP(Char_t *c) final
Reads array of characters from buffer.
TMap * fPoolsMap
! map of pools with data from different tables
TSQLStructure * Stack(Int_t depth=0)
returns head of stack
void ClassEnd(const TClass *) final
Method indicates end of streaming of classdata in custom streamer.
void ReadFloat(Float_t &f) final
Reads Float_t value from buffer.
void SetCompressionLevel(int level)
const char * SqlReadValue(const char *tname)
Read string value from current stack node.
TString fReadBuffer
! Buffer for read value
TSQLStructure * fStk
! pointer on current active structure (stack head)
void ReadUInt(UInt_t &i) final
Reads UInt_t value from buffer.
const char * SqlReadCharStarValue()
Read CharStar value, if it has special code, request it from large table.
R__ALWAYS_INLINE void SqlWriteArray(T *arr, Long64_t arrsize, Bool_t withsize=kFALSE)
friend class TSQLStructure
void WriteClass(const TClass *cl) final
Suppressed function of TBuffer.
Int_t SqlReadArraySize()
Reads array size, written in raw data table.
void * SqlReadObject(void *obj, TClass **cl=nullptr, TMemberStreamer *streamer=nullptr, Int_t streamer_index=0, const TClass *onFileClass=nullptr)
Read object from the buffer.
void WorkWithClass(const char *classname, Version_t classversion)
This function is a part of IncrementLevel method.
void IncrementLevel(TVirtualStreamerInfo *) final
Function is called from TStreamerInfo WriteBuffer and Readbuffer functions and indent new level in da...
Int_t ReadArray(Bool_t *&b) final
Read array of Bool_t from buffer.
void ReadChar(Char_t &c) final
Reads Char_t value from buffer.
Int_t SqlWriteObject(const void *obj, const TClass *objClass, Bool_t cacheReuse, TMemberStreamer *streamer=nullptr, Int_t streamer_index=0)
Write object to buffer.
void WriteArray(const Bool_t *b, Int_t n) final
Write array of Bool_t to buffer.
void ReadStdString(std::string *s) final
Read a std::string.
void ReadDouble(Double_t &d) final
Reads Double_t value from buffer.
void ReadCharStar(char *&s) final
Read a char* string.
void ReadInt(Int_t &i) final
Reads Int_t value from buffer.
void SkipObjectAny() final
?????? Skip any kind of object from buffer !!!!!! fix me, not yet implemented Should be just skip of ...
Bool_t SqlWriteValue(const char *value, const char *tname)
void WriteTString(const TString &s) final
Write a TString.
void * SqlReadObjectDirect(void *obj, TClass **cl, Long64_t objid, TMemberStreamer *streamer=nullptr, Int_t streamer_index=0, const TClass *onFileClass=nullptr)
Read object data.
void WriteFloat(Float_t f) final
Writes Float_t value to buffer.
void WorkWithElement(TStreamerElement *elem, Int_t comp_type)
This function is a part of SetStreamerElementNumber method.
void WriteObjectClass(const void *actualObjStart, const TClass *actualClass, Bool_t cacheReuse) final
Write object to buffer. Only used from TBuffer.
TSQLObjectData * SqlObjectData(Long64_t objid, TSQLClassInfo *sqlinfo)
Creates TSQLObjectData for specified object id and specified class.
TSQLStructure * SqlWriteAny(const void *obj, const TClass *cl, Long64_t objid)
Convert object of any class to sql structures Return pointer on created TSQLStructure TSQLStructure o...
void WriteDouble(Double_t d) final
Writes Double_t value to buffer.
void ReadULong64(ULong64_t &l) final
Reads ULong64_t value from buffer.
void WriteUChar(UChar_t c) final
Writes UChar_t value to buffer.
void * SqlReadAny(Long64_t keyid, Long64_t objid, TClass **cl, void *obj=nullptr)
Recreate object from sql structure.
Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr) final
Read version value from buffer actually version is normally defined by table name and kept in interme...
TObjArray * fObjectsInfos
! array of objects info for selected key
R__ALWAYS_INLINE void SqlReadArrayContent(T *arr, Int_t arrsize, Bool_t withsize)
Template method to read array content.
~TBufferSQL2() override
Destroy sql buffer.
void WriteLong64(Long64_t l) final
Writes Long64_t value to buffer.
void SqlReadBasic(Char_t &value)
Read current value from table and convert it to Char_t value.
Int_t fCompressLevel
! compress level used to minimize size of data in database
void ReadULong(ULong_t &l) final
Reads ULong_t value from buffer.
Base class for text-based streamers like TBufferJSON or TBufferXML Special actions list will use meth...
static const char * ConvertFloat(Float_t v, char *buf, unsigned len, Bool_t not_optimize=kFALSE)
convert float to string with configured format
static const char * ConvertDouble(Double_t v, char *buf, unsigned len, Bool_t not_optimize=kFALSE)
convert float to string with configured format
TClass instances represent classes, structs and namespaces in the ROOT type system.
Int_t Size() const
Return size of object of this class.
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
Version_t GetClassVersion() const
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Basic data type descriptor (datatype information is obtained from CINT).
Int_t GetCompressionLevel() const
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
void Add(TObject *obj) override
This function may not be used (but we need to provide it since it is a pure virtual in TCollection).
void DeleteValues()
Remove all (key,value) pairs from the map AND delete the values when they are allocated on the heap.
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
TObject * Last() const override
Return the object in the last filled slot. Returns 0 if no entries.
void Delete(Option_t *option="") override
Remove all objects from the array AND delete all heap based objects.
TObject * At(Int_t idx) const override
Int_t GetLast() const override
Return index of last object in array.
Mother of all ROOT objects.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Contains information about tables specific to one class and version.
Access an SQL db via the TFile interface.
Int_t GetIOVersion() const
Int_t IsLongStringCode(Long64_t objid, const char *value)
Checks if this is long string code returns 0, if not or string id.
TSQLClassInfo * FindSQLClassInfo(const char *clname, Int_t version)
Return (if exists) TSQLClassInfo for specified class name and version.
TObjArray * SQLObjectsInfo(Long64_t keyid)
Produce array of TSQLObjectInfo objects for all objects, belong to that key Array should be deleted b...
TSQLStatement * GetBlobClassDataStmt(Long64_t objid, TSQLClassInfo *sqlinfo)
Method return request results for specified objid from streamer classtable Data returned in form of s...
TSQLResult * GetBlobClassData(Long64_t objid, TSQLClassInfo *sqlinfo)
Method return request results for specified objid from streamer classtable.
TSQLResult * GetNormalClassDataAll(Long64_t minobjid, Long64_t maxobjid, TSQLClassInfo *sqlinfo)
Return data for several objects from the range from normal class table.
Bool_t GetLongString(Long64_t objid, Int_t strid, TString &value)
Returns value of string, extracted from special table, where long strings are stored.
TSQLObjectData is used in TBufferSQL2 class in reading procedure.
const char * GetLocatedField() const
void ShiftToNextValue()
shift to next column or next row in blob data
Bool_t IsBlobData() const
const char * GetValue() const
const char * GetBlobPrefixName() const
Bool_t VerifyDataType(const char *tname, Bool_t errormsg=kTRUE)
checks if data type corresponds to that stored in raw table
Info (classname, version) about object in database.
This is hierarchical structure, which is created when data is written by TBufferSQL2.
TSQLStructure * GetParent() const
Int_t LocateElementColumn(TSQLFile *f, TBufferSQL2 *buf, TSQLObjectData *data)
find column in TSQLObjectData object, which correspond to current element
void Add(TSQLStructure *child)
Add child structure.
void AddVersion(const TClass *cl, Int_t version=-100)
add child as version
void SetObjectPointer(Long64_t ptrid)
set structure type as kSqlPointer
void SetArray(Int_t sz=-1)
Set structure as array element.
TSQLObjectData * GetObjectData(Bool_t search=false)
searches for objects data
TStreamerInfo * GetStreamerInfo() const
return TStreamerInfo* if type is kSqlStreamerInfo
void SetCustomClass(const TClass *cl, Version_t version)
set structure type as kSqlCustomClass
static Bool_t UnpackTString(TSQLFile *f, TBufferSQL2 *buf, TSQLObjectData *data, Long64_t objid, Int_t clversion)
Unpack TString data in form, accepted by custom TString streamer.
void AddValue(const char *value, const char *tname=nullptr)
Add child structure as value.
void SetStreamerInfo(const TStreamerInfo *info)
set structure type as kSqlStreamerInfo
void AddObjectData(TSQLObjectData *objdata)
add element with pointer to object data
static Bool_t UnpackTObject(TSQLFile *f, TBufferSQL2 *buf, TSQLObjectData *data, Long64_t objid, Int_t clversion)
Unpack TObject data in form, accepted by custom TObject streamer.
void ChangeValueOnly(const char *value)
change value of this structure used as "workaround" to keep object id in kSqlElement node
void Print(Option_t *option="") const override
print content of complete structure
void SetCustomElement(TStreamerElement *elem)
set structure type as kSqlCustomElement
void SetObjectRef(Long64_t refid, const TClass *cl)
set structure type as kSqlObject
Long64_t DefineObjectId(Bool_t recursive=kTRUE)
defines current object id, to which this structure belong make life complicated, because some objects...
TStreamerElement * GetElement() const
return TStremerElement* if type is kSqlElement
void SetStreamerElement(const TStreamerElement *elem, Int_t number)
set structure type as kSqlElement
void ChildArrayIndex(Int_t index, Int_t cnt=1)
set array index for last child element if (cnt<=1) return;
Describes a persistent version of a class.
const char * Data() const
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
Abstract Interface class describing Streamer information for one class.
static Bool_t CanDelete()
static function returning true if ReadBuffer can delete object
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...