41 #include "Compression.h"
66 #ifdef R__VISUAL_CPLUSPLUS
67 #define FLong64 "%I64d"
68 #define FULong64 "%I64u"
70 #define FLong64 "%lld"
71 #define FULong64 "%llu"
84 class TJSONStackObj : public
TObject {
113 virtual ~TJSONStackObj()
115 if (fIsElemOwner)
delete fElem;
118 Bool_t IsStreamerInfo()
const
120 return fIsStreamerInfo;
122 Bool_t IsStreamerElement()
const
124 return !fIsStreamerInfo && (fElem != 0);
165 char* loc = setlocale(LC_NUMERIC, 0);
166 if ((loc!=0) && (strcmp(loc,
"C")!=0)) {
168 setlocale(LC_NUMERIC,
"C");
188 return ConvertToJSON(obj, (obj ? obj->IsA() : 0), compact, member_name);
217 Int_t compact,
const char *member_name)
219 if ((member_name!=0) && (obj!=0)) {
221 if (rdata==0)
return TString();
223 if (member==0)
return TString();
230 arraylen = *((
int *) ((
char *) obj + idata->
GetThisOffset()));
235 if (member->
IsaPointer()) ptr = *((
char **) ptr);
258 if ((ptr == 0) || (member == 0))
return TString(
"null");
266 if ((mcl != 0) && (mcl !=
TString::Class()) && !stlstring && !isstl &&
284 if (member == 0)
return "null";
287 Info(
"JsonWriteMember",
"Write member %s type %s ndim %d",
299 }
else if ((member->
GetArrayDim() == 0) && (arraylen<0)) {
363 }
else if ((member->
GetArrayDim() == 1) || (arraylen>=0)) {
439 if (cnt >= 0) indexes[
cnt]++;
443 if (indexes[cnt] > 0)
448 if (++cnt == indexes.GetSize()) {
450 for (
Int_t k = 0; k < indexes.GetSize(); k++) {
451 shift = shift * member->
GetMaxIndex(k) + indexes[k];
541 ((
TClass *)memberClass)->Streamer((
void *)ptr, *
this);
549 if ((arr != 0) && (arr->
GetSize() > 0)) {
550 arr->Streamer(*
this);
552 if (
Stack()->fValues.GetLast() > 0) {
553 Warning(
"TBufferJSON",
"When streaming TArray, more than 1 object in the stack, use second item");
558 }
else if (memberClass && !strcmp(memberClass->
GetName(),
"string")) {
560 ((
TClass *)memberClass)->Streamer((
void *)ptr, *
this);
566 if ((memberClass == 0) || (member->
GetArrayDim() > 0))
return "\"not supported\"";
577 if (obj == 0)
return kTRUE;
587 if (ptr == 0)
return kTRUE;
601 Info(
"WriteObject",
"Object %p", obj);
611 TJSONStackObj *curr =
Stack();
612 TJSONStackObj *stack =
new TJSONStackObj();
613 stack->fLevel = (curr ? curr->fLevel : 0) + inclevel;
629 return dynamic_cast<TJSONStackObj *
>(
fStack.
Last());
637 TJSONStackObj *stack = 0;
653 if (strlen(line1) > 0) {
655 TJSONStackObj *stack =
Stack();
656 if ((stack != 0) && (stack->fLevel > 0))
668 const char *elem_name = 0;
670 if (base_class == 0) {
675 elem_name =
"fVector";
681 elem_name =
"fDeque";
687 elem_name =
"fMultiMap";
693 elem_name =
"fMultiSet";
696 elem_name =
"fBitSet";
699 elem_name =
"fArray";
703 elem_name =
"fString";
708 if (elem_name != 0) {
720 TJSONStackObj *stack =
Stack();
721 if (stack != 0) stack->fIsPostProcessed =
kTRUE;
730 if (cl == 0)
return 0;
734 if (isarray)
return 100;
745 if (isstlcont > 0)
return isstlcont;
748 if (isstd && !strcmp(cl->
GetName(),
"string"))
return 120;
767 Info(
"JsonWriteObject",
"Object %p class %s check_map %s", obj, cl ? cl->
GetName() :
"null", check_map ?
"true" :
"false");
771 TString fObjectOutput, *fPrevOutput(0);
773 TJSONStackObj *stack =
Stack();
775 if (stack && stack->fAccObjects && ((
fValue.
Length() > 0) || (stack->fValues.GetLast() >= 0))) {
786 }
else if ((special_kind <= 0) || (special_kind > 100)) {
796 if (special_kind <= 0) {
799 std::map<const void *, unsigned>::const_iterator
iter =
fJsonrMap.find(obj);
822 Info(
"JsonWriteObject",
"Starting object %p write for class: %s",
825 stack->fAccObjects = special_kind < 10;
827 if (special_kind == -130)
830 ((
TClass *)cl)->Streamer((
void *)obj, *
this);
833 Info(
"JsonWriteObject",
"Done object %p write for class: %s",
836 if (special_kind == 100) {
837 if (stack->fValues.GetLast() != 0)
838 Error(
"JsonWriteObject",
"Problem when writing array");
839 stack->fValues.Delete();
840 }
else if ((special_kind == 110) || (special_kind == 120)) {
841 if (stack->fValues.GetLast() > 1)
842 Error(
"JsonWriteObject",
"Problem when writing TString or std::string");
843 stack->fValues.Delete();
849 if (stack->fValues.GetLast() < 0) {
851 if (
fValue !=
"0")
Error(
"JsonWriteObject",
"With empty stack fValue!=0");
853 }
else if (stack->fValues.GetLast() == 0) {
855 stack->fValues.Delete();
857 Error(
"JsonWriteObject",
"Empty value when it should contain something");
862 const char *separ =
"[";
869 Int_t size =
TString(stack->fValues.At(0)->GetName()).Atoi();
871 if ((size * 2 == stack->fValues.GetLast()) &&
874 for (
Int_t k = 1; k < stack->fValues.GetLast(); k += 2) {
890 for (
Int_t k = 1; k <= stack->fValues.GetLast(); k++) {
898 stack->fValues.Delete();
902 if ((special_kind == 0) &&
903 ((stack->fValues.GetLast() >= 0) || (
fValue.
Length() > 0))) {
905 Info(
"JsonWriteObject",
"Create blob value for class %s", cl->
GetName());
910 const char *separ =
"[";
912 for (
Int_t k = 0; k <= stack->fValues.GetLast(); k++) {
926 stack->fValues.Delete();
931 if (special_kind <= 0) {
937 if (fPrevOutput != 0) {
940 if ((special_kind <= 0) || (special_kind > 100))
942 else if (fObjectOutput.
Length() != 0)
943 Error(
"JsonWriteObject",
"Non-empty object output for special class %s", cl->
GetName());
970 while ((obj =
iter()) != 0) {
1021 if (sinfo != 0) cl = sinfo->
GetClass();
1023 if (cl == 0)
return;
1027 TJSONStackObj *stack =
Stack();
1029 if ((stack != 0) && stack->IsStreamerElement() && !stack->fIsObjStarted &&
1033 stack->fIsObjStarted =
kTRUE;
1047 stack->fInfo = sinfo;
1048 stack->fIsStreamerInfo =
kTRUE;
1060 Info(
"DecrementLevel",
"Class: %s",
1063 TJSONStackObj *stack =
Stack();
1065 if (stack->IsStreamerElement()) {
1067 Info(
"DecrementLevel",
" Perform post-processing elem: %s",
1068 stack->fElem->GetName());
1076 Error(
"DecrementLevel",
" Mismatch of streamer info");
1081 Info(
"DecrementLevel",
"Class: %s done",
1093 Info(
"SetStreamerElementNumber",
"Element name %s", elem->
GetName());
1107 TJSONStackObj *stack =
Stack();
1109 Error(
"WorkWithElement",
"stack is empty");
1114 Info(
"WorkWithElement",
" Start element %s type %d typename %s",
1117 if (stack->IsStreamerElement()) {
1121 Info(
"WorkWithElement",
" Perform post-processing elem: %s",
1122 stack->fElem->GetName());
1132 Error(
"WorkWithElement",
"Lost of stack");
1137 if (!stack->IsStreamerInfo()) {
1138 Error(
"WorkWithElement",
"Problem in Inc/Dec level");
1145 Error(
"WorkWithElement",
"streamer info returns elem = 0");
1154 Info(
"WorkWithElement",
" Expects chain for elem %s number %d",
1161 stack->fElemNumber = number;
1162 stack->fIsElemOwner = (number < 0);
1220 if (typeName == 0) typeName =
name;
1222 if ((name == 0) || (strlen(name) == 0)) {
1223 Error(
"ClassMember",
"Invalid member name");
1231 if (strcmp(typeName,
"raw:data") == 0)
1242 if (strcmp(name, typeName) == 0) {
1249 if (tname[tname.
Length() - 1] ==
'*') {
1255 Error(
"ClassMember",
"Invalid class specifier %s", typeName);
1279 }
else if ((typ_id > 0) && (typ_id < 20)) {
1296 Error(
"ClassMember",
"Invalid combination name = %s type = %s",
1318 if ((elem == 0) && stack->fIsPostProcessed)
return;
1319 if (elem == 0) elem = stack->fElem;
1320 if (elem == 0)
return;
1323 Info(
"PerformPostProcessing",
"Element %s type %s",
1326 stack->fIsPostProcessed =
kTRUE;
1329 if (stack->fIsObjStarted) {
1340 Bool_t isTArray = (strncmp(
"TArray", typname, 6) == 0);
1342 if (isTString || isSTLstring) {
1346 Info(
"PerformPostProcessing",
"reformat string value = '%s'",
fValue.
Data());
1348 stack->fValues.Delete();
1349 }
else if (isOffsetPArray) {
1352 if ((stack->fValues.GetLast() < 0) && (
fValue ==
"0")) {
1354 }
else if ((stack->fValues.GetLast() == 0) &&
1355 (strcmp(stack->fValues.Last()->GetName(),
"1") == 0)) {
1356 stack->fValues.Delete();
1358 Error(
"PerformPostProcessing",
"Wrong values for kOffsetP type %s name %s",
1359 typname, (elem ? elem->
GetName() :
"---"));
1360 stack->fValues.Delete();
1363 }
else if (isTObject) {
1364 if (stack->fValues.GetLast() != 0) {
1366 Error(
"PerformPostProcessing",
"When storing TObject, number of items %d not equal to 2", stack->fValues.GetLast());
1377 stack->fValues.Delete();
1378 }
else if (isTArray) {
1380 stack->fValues.Delete();
1388 if (stack->fValues.GetLast() >= 0) {
1391 for (
Int_t n = 0;
n <= stack->fValues.GetLast();
n++) {
1404 if (stack->fValues.GetLast() >= 0)
1463 if (start) *start = 0;
1464 if (bcnt) *bcnt = 0;
1466 if (
gDebug > 3)
Info(
"ReadVersion",
"Version = %d", res);
1498 const TClass *actualClass)
1501 Info(
"WriteObjectClass",
"Class %s", (actualClass ? actualClass->
GetName() :
" null"));
1506 #define TJSONPushValue() \
1507 if (fValue.Length() > 0) Stack()->PushValue(fValue);
1511 #define TBufferJSON_ReadArray(tname, vname) \
1513 if (!vname) return 0; \
1714 #define TBufferJSON_ReadStaticArray(vname) \
1716 if (!vname) return 0; \
1843 #define TBufferJSON_ReadFastArray(vname) \
1845 if (n <= 0) return; \
1846 if (!vname) return; \
2035 #define TJSONWriteArrayContent(vname, arrsize) \
2037 fValue.Append("["); \
2038 for (Int_t indx=0;indx<arrsize;indx++) { \
2039 if (indx>0) fValue.Append(fArraySepar.Data()); \
2040 JsonWriteBasic(vname[indx]); \
2042 fValue.Append("]"); \
2046 #define TBufferJSON_WriteArray(vname) \
2049 TJSONWriteArrayContent(vname, n); \
2177 #define TBufferJSON_WriteFastArray(vname) \
2180 if (n <= 0) { fValue.Append("[]"); return; } \
2181 TStreamerElement* elem = Stack(0)->fElem; \
2182 if ((elem != 0) && (elem->GetType()>TStreamerInfo::kOffsetL) && \
2183 (elem->GetType() < TStreamerInfo::kOffsetP) && \
2184 (elem->GetArrayLength() != n)) fExpectedChain = kTRUE; \
2185 if (fExpectedChain) { \
2186 TStreamerInfo* info = Stack(1)->fInfo; \
2187 Int_t startnumber = Stack(0)->fElemNumber; \
2188 fExpectedChain = kFALSE; \
2191 elem = (TStreamerElement*)info->GetElements()->At(startnumber++);\
2192 if (index>0) JsonStartElement(elem); \
2193 if (elem->GetType()<TStreamerInfo::kOffsetL) { \
2194 JsonWriteBasic(vname[index]); \
2197 TJSONWriteArrayContent((vname+index), elem->GetArrayLength());\
2198 index+=elem->GetArrayLength(); \
2200 PerformPostProcessing(Stack(0), elem); \
2203 if ((elem!=0) && (elem->GetArrayDim()>1) && (elem->GetArrayLength()==n)) { \
2204 TArrayI indexes(elem->GetArrayDim() - 1); \
2207 while (cnt >= 0) { \
2208 if (indexes[cnt] >= elem->GetMaxIndex(cnt)) { \
2209 fValue.Append("]"); \
2210 indexes[cnt--] = 0; \
2211 if (cnt >= 0) indexes[cnt]++; \
2214 fValue.Append(indexes[cnt] == 0 ? "[" : fArraySepar.Data()); \
2215 if (++cnt == indexes.GetSize()) { \
2217 for (Int_t k = 0; k < indexes.GetSize(); k++) \
2218 shift = shift * elem->GetMaxIndex(k) + indexes[k]; \
2219 Int_t len = elem->GetMaxIndex(indexes.GetSize()); \
2221 TJSONWriteArrayContent((vname+shift), len); \
2226 TJSONWriteArrayContent(vname, n); \
2376 Info(
"WriteFastArray",
"void *start cl %s n %d streamer %p",
2377 cl ? cl->
GetName() :
"---",
n, streamer);
2381 (*streamer)(*
this, start, 0);
2385 char *
obj = (
char *)start;
2387 int size = cl->
Size();
2395 for (
Int_t j = 0; j <
n; j++, obj += size) {
2414 Info(
"WriteFastArray",
"void **startp cl %s n %d streamer %p",
2419 (*streamer)(*
this, (
void *)start, 0);
2433 for (
Int_t j = 0; j <
n; j++) {
2441 for (
Int_t j = 0; j <
n; j++) {
2444 if (!start[j]) start[j] = ((
TClass *)cl)->New();
2489 Info(
"StreamObject",
"Class: %s", (cl ? cl->
GetName() :
"none"));
2772 snprintf(buf,
sizeof(buf),
"%d", value);
2782 snprintf(buf,
sizeof(buf),
"%hd", value);
2792 snprintf(buf,
sizeof(buf),
"%d", value);
2802 snprintf(buf,
sizeof(buf),
"%ld", value);
2812 snprintf(buf,
sizeof(buf),
FLong64, value);
2822 if (value ==
floor(value))
2823 snprintf(buf,
sizeof(buf),
"%1.0f", value);
2825 snprintf(buf,
sizeof(buf),
fgFloatFmt, value);
2835 if (value ==
floor(value))
2836 snprintf(buf,
sizeof(buf),
"%1.0f", value);
2838 snprintf(buf,
sizeof(buf),
fgFloatFmt, value);
2856 snprintf(buf,
sizeof(buf),
"%u", value);
2866 snprintf(buf,
sizeof(buf),
"%hu", value);
2876 snprintf(buf,
sizeof(buf),
"%u", value);
2886 snprintf(buf,
sizeof(buf),
"%lu", value);
2896 snprintf(buf,
sizeof(buf),
FULong64, value);
2908 if (len<0) len = strlen(value);
2938 if ((c > 31) && (c < 127))
2955 if (fmt == 0) fmt =
"%e";
2979 TStreamerInfoActions::ActionContainer_t::const_iterator end = sequence.
fActions.end();
2980 for (TStreamerInfoActions::ActionContainer_t::const_iterator
iter = sequence.
fActions.begin();
2984 (*iter).PrintDebug(*
this, obj);
2985 (*iter)(*
this,
obj);
2989 TStreamerInfoActions::ActionContainer_t::const_iterator end = sequence.
fActions.end();
2990 for (TStreamerInfoActions::ActionContainer_t::const_iterator
iter = sequence.
fActions.begin();
2994 (*iter)(*
this,
obj);
3006 void *start_collection,
void *end_collection)
3013 TStreamerInfoActions::ActionContainer_t::const_iterator end = sequence.
fActions.end();
3014 for (TStreamerInfoActions::ActionContainer_t::const_iterator
iter = sequence.
fActions.begin();
3018 (*iter).PrintDebug(*
this, *(
char **)start_collection);
3019 (*iter)(*
this, start_collection, end_collection);
3023 TStreamerInfoActions::ActionContainer_t::const_iterator end = sequence.
fActions.end();
3024 for (TStreamerInfoActions::ActionContainer_t::const_iterator
iter = sequence.
fActions.begin();
3028 (*iter)(*
this, start_collection, end_collection);
3039 void *start_collection,
void *end_collection)
3050 void *arr0 = loopconfig->
GetFirstAddress(start_collection, end_collection);
3052 TStreamerInfoActions::ActionContainer_t::const_iterator end = sequence.
fActions.end();
3053 for (TStreamerInfoActions::ActionContainer_t::const_iterator
iter = sequence.
fActions.begin();
3057 (*iter).PrintDebug(*
this, arr0);
3058 (*iter)(*
this, start_collection, end_collection, loopconfig);
3062 TStreamerInfoActions::ActionContainer_t::const_iterator end = sequence.
fActions.end();
3063 for (TStreamerInfoActions::ActionContainer_t::const_iterator
iter = sequence.
fActions.begin();
3067 (*iter)(*
this, start_collection, end_collection, loopconfig);
3080 Info(
"WriteClones",
"Not yet tested");
3089 struct DynamicType {
3093 virtual ~DynamicType() {}
3115 Error(
"WriteObjectAny",
"ptrClass argument may not be 0");
3121 if (clActual == 0) {
3125 DynamicType *d_ptr = (DynamicType *)obj;
3127 "An object of type %s (from type_info) passed through a %s pointer was truncated (due a missing dictionary)!!!",
3128 typeid(*d_ptr).name(), ptrClass->
GetName());
3131 }
else if (clActual && (clActual != ptrClass)) {
3132 const char *temp = (
const char *) obj;
3157 sinfo = (
TStreamerInfo *)const_cast<TClass *>(cl)->GetCurrentStreamerInfo();
3159 const_cast<TClass *
>(cl)->BuildRealData(pointer);
3161 const_cast<TClass *
>(cl)->SetCurrentStreamerInfo(sinfo);
3162 const_cast<TClass *
>(cl)->RegisterStreamerInfo(sinfo);
3164 printf(
"Creating StreamerInfo for class: %s, version: %d\n",
3172 const_cast<TClass *
>(cl)->BuildRealData(pointer);
Abstract array base class.
Describe Streamer information for one class version.
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)
Ignored in TBufferJSON.
TStreamerInfoActions::TActionSequence * GetWriteObjectWiseActions()
TString JsonWriteMember(const void *ptr, TDataMember *member, TClass *memberClass, Int_t arraylen)
Convert single data member to JSON structures Returns string with converted member.
virtual void WriteUChar(UChar_t c)
Writes UChar_t value to buffer.
virtual void WriteArrayFloat16(const Float_t *f, Int_t n, TStreamerElement *ele=0)
Write array of Float16_t to buffer.
virtual Int_t WriteClones(TClonesArray *a, Int_t nobjects)
Interface to TStreamerInfo::WriteBufferClones.
void WorkWithElement(TStreamerElement *elem, Int_t comp_type)
This is call-back from streamer which indicates that class member will be streamed Name of element us...
virtual TClass * ReadClass(const TClass *cl=0, UInt_t *objTag=0)
suppressed function of TBuffer
virtual Int_t ReadStaticArray(Bool_t *b)
Read array of Bool_t from buffer.
ActionContainer_t fActions
virtual Int_t ReadArray(Bool_t *&b)
Read array of Bool_t from buffer.
void JsonDisablePostprocessing()
const char * GetTypeName() const
virtual void ReadShort(Short_t &s)
Reads Short_t value from buffer.
virtual Int_t WriteObjectAny(const void *obj, const TClass *ptrClass)
Write object to I/O buffer.
virtual Int_t ReadStaticArrayFloat16(Float_t *f, TStreamerElement *ele=0)
Read array of Float16_t from buffer.
virtual const char * GetName() const
Return name of this collection.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void WriteLong64(Long64_t l)
Writes Long64_t value to buffer.
#define TBufferJSON_ReadArray(tname, vname)
virtual TClass * GetClass() const =0
TLoopConfiguration * fLoopConfig
If this is a bundle of memberwise streaming action, this configures the looping.
#define TBufferJSON_WriteFastArray(vname)
Collectable string class.
Int_t GetLast() const
Return index of last object in array.
virtual void ReadFloat(Float_t &f)
Reads Float_t value from buffer.
virtual void ReadWithFactor(Float_t *ptr, Double_t factor, Double_t minvalue)
Read a Double32_t from the buffer when the factor and minimun value have been specified see comments ...
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
All ROOT classes may have RTTI (run time type identification) support added.
R__EXTERN TVirtualMutex * gInterpreterMutex
virtual void ReadWithNbits(Float_t *ptr, Int_t nbits)
Read a Float16_t from the buffer when the number of bits is specified (explicitly or not) see comment...
TString fSemicolon
0 - no any compression, 1 - no spaces in the begin, 2 - no new lines, 3 - no spaces at all ...
virtual void StreamObject(void *obj, const type_info &typeinfo, const TClass *onFileClass=0)
stream object to/from buffer
virtual void SkipObjectAny()
Skip any kind of object from buffer.
virtual void ReadCharP(Char_t *c)
Reads array of characters from buffer.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual void DecrementLevel(TVirtualStreamerInfo *)
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and decrease level in json...
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
TString fArraySepar
depending from compression level, " : " or ":"
virtual void ReadFastArrayWithFactor(Float_t *ptr, Int_t n, Double_t factor, Double_t minvalue)
read array of Float16_t from buffer
virtual void ReadBool(Bool_t &b)
Reads Bool_t value from buffer.
Int_t fCompact
flag to resolve situation when several elements of same basic type stored as FastArray ...
virtual void WriteDouble(Double_t d)
Writes Double_t value to buffer.
virtual void ReadLong64(Long64_t &l)
Reads Long64_t value from buffer.
Buffer base class used for serializing objects.
void JsonWriteBasic(Char_t value)
converts Char_t to string and add to json value buffer
virtual TObject * Remove(TObject *obj)
Remove object from array.
virtual void ReadFastArrayFloat16(Float_t *f, Int_t n, TStreamerElement *ele=0)
read array of Float16_t from buffer
virtual void WriteULong64(ULong64_t l)
Writes ULong64_t value to buffer.
virtual void ReadFastArray(Bool_t *b, Int_t n)
read array of Bool_t from buffer
virtual void ReadStdString(std::string &s)
Reads a std::string.
TDataType * GetDataType() const
Bool_t IsaPointer() const
Return true if data member is a pointer.
virtual void ReadLong(Long_t &l)
Reads Long_t value from buffer.
virtual void WriteLong(Long_t l)
Writes Long_t value to buffer.
virtual Int_t ApplySequence(const TStreamerInfoActions::TActionSequence &sequence, void *object)
Read one collection of objects from the buffer using the StreamerInfoLoopAction.
void SetParent(TObject *parent)
Set parent owning this buffer.
virtual Bool_t IsBase() const
Return kTRUE if the element represent a base class.
virtual void SetArrayDim(Int_t dim)
Set number of array dimensions.
virtual void WriteFastArrayString(const Char_t *c, Int_t n)
Write array of Char_t to buffer.
Int_t GetMaxIndex(Int_t dim) const
Return maximum index for array dimension "dim".
virtual void SetMaxIndex(Int_t dim, Int_t max)
set maximum index for array with dimension dim
Array of integers (32 bits per element).
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
const char * GetArrayIndex() const
If the data member is pointer and has a valid array size in its comments GetArrayIndex returns a stri...
virtual void WriteInt(Int_t i)
Writes Int_t value to buffer.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)
suppressed function of TBuffer
#define TBufferJSON_WriteArray(vname)
const char * Data() const
Int_t GetBaseClassOffset(const TClass *toBase, void *address=0, bool isDerivedObject=true)
virtual void ReadChar(Char_t &c)
Reads Char_t value from buffer.
const char * GetTrueTypeName() const
Get full type description of data member, e,g.: "class TDirectory*".
virtual void ReadFastArrayDouble32(Double_t *d, Int_t n, TStreamerElement *ele=0)
read array of Double32_t from buffer
virtual void * GetFirstAddress(void *start, const void *end) const =0
virtual void WriteFastArray(const Bool_t *b, Int_t n)
Write array of Bool_t to buffer.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
Bool_t IsCompiled() const
virtual void ReadUShort(UShort_t &s)
Reads UShort_t value from buffer.
TClass * GetActualClass(const void *object) const
Return a pointer the the real class of the object.
std::map< std::string, std::string >::const_iterator iter
void Clear()
Clear string without changing its capacity.
virtual void ReadDouble(Double_t &d)
Reads Double_t value from buffer.
virtual void WriteObject(const TObject *obj)
Convert object into json structures.
Int_t JsonSpecialClass(const TClass *cl) const
return non-zero value when class has special handling in JSON it is TCollection (-130), TArray (100), TString (110), std::string (120) and STL containers (1..6)
TJSONStackObj * Stack(Int_t depth=0)
return stack object of specified depth
TString & Append(const char *cs)
std::map< const void *, unsigned > fJsonrMap
buffer for current value
unsigned fJsonrCnt
map of recorded objects, used in JsonR to restore references
TObjArray fStack
counter for all objects and arrays
virtual void ReadUChar(UChar_t &c)
Reads UChar_t value from buffer.
TClass * GetClass() const
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
#define TBufferJSON_ReadStaticArray(vname)
Base class of the Configurations for the member wise looping routines.
void SetCompact(int level)
Set level of space/newline compression 0 - no any compression 1 - exclude spaces in the begin 2 - rem...
virtual void WriteFastArrayDouble32(const Double_t *d, Int_t n, TStreamerElement *ele=0)
Write array of Double32_t to buffer.
void JsonWriteConstChar(const char *value, Int_t len=-1)
writes string value, processing all kind of special characters
virtual Int_t ReadStaticArrayDouble32(Double_t *d, TStreamerElement *ele=0)
Read array of Double32_t from buffer.
TString fNumericLocale
depending from compression level, ", " or ","
virtual void ReadInt(Int_t &i)
Reads Int_t value from buffer.
TString fValue
current output buffer for json code
virtual void SetStreamerElementNumber(TStreamerElement *elem, Int_t comp_type)
Function is called from TStreamerInfo WriteBuffer and Readbuffer functions and add/verify next elemen...
static const char * fgFloatFmt
stored value of setlocale(LC_NUMERIC), which should be recovered at the end
TRealData * GetRealData(const char *name) const
Return pointer to TRealData element with name "name".
const char * GetTypeName() const
Get type of data member, e,g.: "class TDirectory*" -> "TDirectory".
virtual void IncrementLevel(TVirtualStreamerInfo *)
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and indent new level in js...
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)
suppressed function of TBuffer
Int_t IndexOf(const TObject *obj) const
TObjArray * GetElements() const
void BuildOld()
rebuild the TStreamerInfo structure
virtual void TagStreamerInfo(TVirtualStreamerInfo *)
virtual void ReadULong(ULong_t &l)
Reads ULong_t value from buffer.
virtual void WriteObjectClass(const void *actualObjStart, const TClass *actualClass)
Write object to buffer. Only used from TBuffer.
Basic data type descriptor (datatype information is obtained from CINT).
virtual void ClassBegin(const TClass *, Version_t=-1)
Should be called in the beginning of custom class streamer.
virtual Int_t ApplySequenceVecPtr(const TStreamerInfoActions::TActionSequence &sequence, void *start_collection, void *end_collection)
Read one collection of objects from the buffer using the StreamerInfoLoopAction.
TString * fOutput
main output buffer for json code
Collection abstract base class.
void AppendOutput(const char *line0, const char *line1=0)
Info("AppendOutput"," '%s' '%s'", line0, line1?line1 : "---");.
virtual void ReadDouble32(Double_t *d, TStreamerElement *ele=0)
read a Double32_t from the buffer
char * Form(const char *fmt,...)
virtual void SkipVersion(const TClass *cl=0)
Skip class version from I/O buffer.
The TRealData class manages the effective list of all data members for a given class.
virtual const char * GetName() const
Returns name of object.
The ROOT global object gROOT contains a list of all defined classes.
virtual void WriteUShort(UShort_t s)
Writes UShort_t value to buffer.
Version_t GetClassVersion() const
virtual void WriteBool(Bool_t b)
Writes Bool_t value to buffer.
virtual void WriteDouble32(Double_t *d, TStreamerElement *ele=0)
write a Double32_t to the buffer
void WorkWithClass(TStreamerInfo *info, const TClass *cl=0)
Prepares buffer to stream data of specified class.
bool IsStdClass(const char *type)
return true if the class belongs to the std namespace
void JsonStartElement(const TStreamerElement *elem, const TClass *base_class=0)
virtual void ReadTString(TString &s)
Reads a TString.
virtual void WriteFloat(Float_t f)
Writes Float_t value to buffer.
void PerformPostProcessing(TJSONStackObj *stack, const TStreamerElement *elem=0)
Function is converts TObject and TString structures to more compact representation.
Option_t * GetOption() const
virtual void WriteFastArrayFloat16(const Float_t *d, Int_t n, TStreamerElement *ele=0)
Write array of Float16_t to buffer.
virtual void WriteTString(const TString &s)
Writes a TString.
void Build()
Build the I/O data structure for the current class version.
static const char * GetFloatFormat()
return current printf format for float/double members, default "%e"
virtual void WriteShort(Short_t s)
Writes Short_t value to buffer.
virtual void ReadFloat16(Float_t *f, TStreamerElement *ele=0)
read a Float16_t from the buffer
virtual Bool_t CheckObject(const TObject *)
Check that object already stored in the buffer.
virtual TClass * GetClassPointer() const
Returns a pointer to the TClass of this element.
virtual void WriteUInt(UInt_t i)
Writes UInt_t value to buffer.
virtual void WriteFloat16(Float_t *f, TStreamerElement *ele=0)
write a Float16_t to the buffer
virtual void WriteULong(ULong_t l)
Writes ULong_t value to buffer.
virtual void WriteArrayDouble32(const Double_t *d, Int_t n, TStreamerElement *ele=0)
Write array of Double32_t to buffer.
unsigned long long ULong64_t
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
Bool_t fExpectedChain
stack of streamer infos
static TString ConvertToJSON(const TObject *obj, Int_t compact=0, const char *member_name=0)
converts object, inherited from TObject class, to JSON string
virtual void * ReadObjectAny(const TClass *clCast)
Read object from buffer. Only used from TBuffer.
#define R__LOCKGUARD(mutex)
TBufferJSON()
Creates buffer object to serialize data into json.
void JsonWriteObject(const void *obj, const TClass *objClass, Bool_t check_map=kTRUE)
Write object to buffer If object was written before, only pointer will be stored If check_map==kFALSE...
virtual void ReadULong64(ULong64_t &l)
Reads ULong64_t value from buffer.
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.
virtual void ClassEnd(const TClass *)
Should be called at the end of custom streamer See TBufferJSON::ClassBegin for more details...
virtual Int_t ReadArrayDouble32(Double_t *&d, TStreamerElement *ele=0)
Read array of Double32_t from buffer.
Mother of all ROOT objects.
static void SetFloatFormat(const char *fmt="%e")
set printf format for float/double members, default "%e"
Int_t GetArrayDim() const
Return number of array dimensions.
Int_t IsSTLContainer()
The return type is defined in TDictionary (kVector, kList, etc.)
TJSONStackObj * PopStack()
remove one level from stack
virtual void WriteStdString(const std::string &s)
Writes a std::string.
virtual void WriteChar(Char_t c)
Writes Char_t value to buffer.
TObject * Last() const
Return the object in the last filled slot. Returns 0 if no entries.
An array of clone (identical) objects.
virtual Int_t ReadArrayFloat16(Float_t *&f, TStreamerElement *ele=0)
Read array of Float16_t from buffer.
virtual void WriteCharP(const Char_t *c)
Writes array of characters to buffer.
TJSONStackObj * PushStack(Int_t inclevel=0)
add new level to the structures stack
#define TBufferJSON_ReadFastArray(vname)
ROOT::ESTLType GetCollectionType() const
Return the 'type' of the STL the TClass is representing.
Bool_t IsBasic() const
Return true if data member is a basic type, e.g. char, int, long...
void SetBaseVersion(Int_t v)
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)
Function called by the Streamer functions to serialize object at p to buffer b.
void JsonStreamCollection(TCollection *obj, const TClass *objClass)
store content of collection
TDataMember * GetDataMember() const
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)
read version value from buffer
virtual ~TBufferJSON()
destroy buffer
TObject * At(Int_t idx) const
virtual void WriteClass(const TClass *cl)
suppressed function of TBuffer
virtual void ReadFastArrayString(Char_t *c, Int_t n)
read array of Char_t from buffer
virtual void Compress()
Remove empty slots from array.
Abstract Interface class describing Streamer information for one class.
Long_t GetThisOffset() const
virtual void WriteArray(const Bool_t *b, Int_t n)
Write array of Bool_t to buffer.
virtual void ReadFastArrayWithNbits(Float_t *ptr, Int_t n, Int_t nbits)
read array of Float16_t from buffer
Int_t Size() const
Return size of object of this class.
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
virtual void ReadUInt(UInt_t &i)
Reads UInt_t value from buffer.
virtual void ClassMember(const char *name, const char *typeName=0, Int_t arrsize1=-1, Int_t arrsize2=-1)
Method indicates name and typename of class member, which should be now streamed in custom streamer F...
TVirtualStreamerInfo * fStreamerInfo
StreamerInfo used to derive these actions.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.