Logo ROOT   6.14/05
Reference Guide
TBufferJSON.h
Go to the documentation of this file.
1 // $Id$
2 // Author: Sergey Linev 4.03.2014
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, 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_TBufferJSON
13 #define ROOT_TBufferJSON
14 
15 #include "TBufferText.h"
16 #include "TString.h"
17 
18 #include <deque>
19 
21 class TStreamerInfo;
22 class TStreamerElement;
23 class TMemberStreamer;
24 class TDataMember;
25 class TJSONStackObj;
26 
27 class TBufferJSON : public TBufferText {
28 
29 public:
31  virtual ~TBufferJSON();
32 
33  void SetCompact(int level);
34 
35  static TString ConvertToJSON(const TObject *obj, Int_t compact = 0, const char *member_name = nullptr);
36  static TString
37  ConvertToJSON(const void *obj, const TClass *cl, Int_t compact = 0, const char *member_name = nullptr);
38  static TString ConvertToJSON(const void *obj, TDataMember *member, Int_t compact = 0, Int_t arraylen = -1);
39 
40  static Int_t ExportToFile(const char *filename, const TObject *obj, const char *option = nullptr);
41  static Int_t ExportToFile(const char *filename, const void *obj, const TClass *cl, const char *option = nullptr);
42 
43  static TObject *ConvertFromJSON(const char *str);
44  static void *ConvertFromJSONAny(const char *str, TClass **cl = nullptr);
45 
46  template <class T>
47  static TString ToJSON(const T *obj, Int_t compact = 0, const char *member_name = nullptr)
48  {
49  return ConvertToJSON(obj, TBuffer::GetClass(typeid(T)), compact, member_name);
50  }
51 
52  template <class T>
53  static Bool_t FromJSON(T *&obj, const char *json)
54  {
55  if (obj)
56  return kFALSE;
57  obj = (T *)ConvertFromJSONChecked(json, TBuffer::GetClass(typeid(T)));
58  return obj != nullptr;
59  }
60 
61  // suppress class writing/reading
62 
63  virtual TClass *ReadClass(const TClass *cl = nullptr, UInt_t *objTag = nullptr);
64  virtual void WriteClass(const TClass *cl);
65 
66  // redefined virtual functions of TBuffer
67 
68  virtual Version_t ReadVersion(UInt_t *start = nullptr, UInt_t *bcnt = nullptr, const TClass *cl = nullptr);
69  virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt = kFALSE);
70 
71  virtual void *ReadObjectAny(const TClass *clCast);
72  virtual void SkipObjectAny();
73 
74  // these methods used in streamer info to indicate currently streamed element,
75  virtual void IncrementLevel(TVirtualStreamerInfo *);
76  virtual void SetStreamerElementNumber(TStreamerElement *elem, Int_t comp_type);
77  virtual void DecrementLevel(TVirtualStreamerInfo *);
78 
79  virtual void ClassBegin(const TClass *, Version_t = -1);
80  virtual void ClassEnd(const TClass *);
81  virtual void ClassMember(const char *name, const char *typeName = nullptr, Int_t arrsize1 = -1, Int_t arrsize2 = -1);
82 
83  virtual Int_t ReadArray(Bool_t *&b);
84  virtual Int_t ReadArray(Char_t *&c);
85  virtual Int_t ReadArray(UChar_t *&c);
86  virtual Int_t ReadArray(Short_t *&h);
87  virtual Int_t ReadArray(UShort_t *&h);
88  virtual Int_t ReadArray(Int_t *&i);
89  virtual Int_t ReadArray(UInt_t *&i);
90  virtual Int_t ReadArray(Long_t *&l);
91  virtual Int_t ReadArray(ULong_t *&l);
92  virtual Int_t ReadArray(Long64_t *&l);
93  virtual Int_t ReadArray(ULong64_t *&l);
94  virtual Int_t ReadArray(Float_t *&f);
95  virtual Int_t ReadArray(Double_t *&d);
96 
97  virtual Int_t ReadStaticArray(Bool_t *b);
98  virtual Int_t ReadStaticArray(Char_t *c);
99  virtual Int_t ReadStaticArray(UChar_t *c);
100  virtual Int_t ReadStaticArray(Short_t *h);
101  virtual Int_t ReadStaticArray(UShort_t *h);
102  virtual Int_t ReadStaticArray(Int_t *i);
103  virtual Int_t ReadStaticArray(UInt_t *i);
104  virtual Int_t ReadStaticArray(Long_t *l);
105  virtual Int_t ReadStaticArray(ULong_t *l);
106  virtual Int_t ReadStaticArray(Long64_t *l);
107  virtual Int_t ReadStaticArray(ULong64_t *l);
108  virtual Int_t ReadStaticArray(Float_t *f);
109  virtual Int_t ReadStaticArray(Double_t *d);
110 
111  virtual void ReadFastArray(Bool_t *b, Int_t n);
112  virtual void ReadFastArray(Char_t *c, Int_t n);
113  virtual void ReadFastArrayString(Char_t *c, Int_t n);
114  virtual void ReadFastArray(UChar_t *c, Int_t n);
115  virtual void ReadFastArray(Short_t *h, Int_t n);
116  virtual void ReadFastArray(UShort_t *h, Int_t n);
117  virtual void ReadFastArray(Int_t *i, Int_t n);
118  virtual void ReadFastArray(UInt_t *i, Int_t n);
119  virtual void ReadFastArray(Long_t *l, Int_t n);
120  virtual void ReadFastArray(ULong_t *l, Int_t n);
121  virtual void ReadFastArray(Long64_t *l, Int_t n);
122  virtual void ReadFastArray(ULong64_t *l, Int_t n);
123  virtual void ReadFastArray(Float_t *f, Int_t n);
124  virtual void ReadFastArray(Double_t *d, Int_t n);
125  virtual void ReadFastArray(void *start, const TClass *cl, Int_t n = 1, TMemberStreamer *s = nullptr,
126  const TClass *onFileClass = nullptr);
127  virtual void ReadFastArray(void **startp, const TClass *cl, Int_t n = 1, Bool_t isPreAlloc = kFALSE,
128  TMemberStreamer *s = nullptr, const TClass *onFileClass = nullptr);
129 
130  virtual void WriteArray(const Bool_t *b, Int_t n);
131  virtual void WriteArray(const Char_t *c, Int_t n);
132  virtual void WriteArray(const UChar_t *c, Int_t n);
133  virtual void WriteArray(const Short_t *h, Int_t n);
134  virtual void WriteArray(const UShort_t *h, Int_t n);
135  virtual void WriteArray(const Int_t *i, Int_t n);
136  virtual void WriteArray(const UInt_t *i, Int_t n);
137  virtual void WriteArray(const Long_t *l, Int_t n);
138  virtual void WriteArray(const ULong_t *l, Int_t n);
139  virtual void WriteArray(const Long64_t *l, Int_t n);
140  virtual void WriteArray(const ULong64_t *l, Int_t n);
141  virtual void WriteArray(const Float_t *f, Int_t n);
142  virtual void WriteArray(const Double_t *d, Int_t n);
143 
144  virtual void WriteFastArray(const Bool_t *b, Int_t n);
145  virtual void WriteFastArray(const Char_t *c, Int_t n);
146  virtual void WriteFastArrayString(const Char_t *c, Int_t n);
147  virtual void WriteFastArray(const UChar_t *c, Int_t n);
148  virtual void WriteFastArray(const Short_t *h, Int_t n);
149  virtual void WriteFastArray(const UShort_t *h, Int_t n);
150  virtual void WriteFastArray(const Int_t *i, Int_t n);
151  virtual void WriteFastArray(const UInt_t *i, Int_t n);
152  virtual void WriteFastArray(const Long_t *l, Int_t n);
153  virtual void WriteFastArray(const ULong_t *l, Int_t n);
154  virtual void WriteFastArray(const Long64_t *l, Int_t n);
155  virtual void WriteFastArray(const ULong64_t *l, Int_t n);
156  virtual void WriteFastArray(const Float_t *f, Int_t n);
157  virtual void WriteFastArray(const Double_t *d, Int_t n);
158  virtual void WriteFastArray(void *start, const TClass *cl, Int_t n = 1, TMemberStreamer *s = nullptr);
159  virtual Int_t WriteFastArray(void **startp, const TClass *cl, Int_t n = 1, Bool_t isPreAlloc = kFALSE,
160  TMemberStreamer *s = nullptr);
161 
162  virtual void StreamObject(void *obj, const TClass *cl, const TClass *onFileClass = nullptr);
164 
165  virtual void ReadBool(Bool_t &b);
166  virtual void ReadChar(Char_t &c);
167  virtual void ReadUChar(UChar_t &c);
168  virtual void ReadShort(Short_t &s);
169  virtual void ReadUShort(UShort_t &s);
170  virtual void ReadInt(Int_t &i);
171  virtual void ReadUInt(UInt_t &i);
172  virtual void ReadLong(Long_t &l);
173  virtual void ReadULong(ULong_t &l);
174  virtual void ReadLong64(Long64_t &l);
175  virtual void ReadULong64(ULong64_t &l);
176  virtual void ReadFloat(Float_t &f);
177  virtual void ReadDouble(Double_t &d);
178  virtual void ReadCharP(Char_t *c);
179  virtual void ReadTString(TString &s);
180  virtual void ReadStdString(std::string *s);
182  virtual void ReadCharStar(char *&s);
183 
184  virtual void WriteBool(Bool_t b);
185  virtual void WriteChar(Char_t c);
186  virtual void WriteUChar(UChar_t c);
187  virtual void WriteShort(Short_t s);
188  virtual void WriteUShort(UShort_t s);
189  virtual void WriteInt(Int_t i);
190  virtual void WriteUInt(UInt_t i);
191  virtual void WriteLong(Long_t l);
192  virtual void WriteULong(ULong_t l);
193  virtual void WriteLong64(Long64_t l);
194  virtual void WriteULong64(ULong64_t l);
195  virtual void WriteFloat(Float_t f);
196  virtual void WriteDouble(Double_t d);
197  virtual void WriteCharP(const Char_t *c);
198  virtual void WriteTString(const TString &s);
199  virtual void WriteStdString(const std::string *s);
201  virtual void WriteCharStar(char *s);
202 
203  virtual TVirtualStreamerInfo *GetInfo();
204 
205  // end of redefined virtual functions
206 
207  virtual void ReadBaseClass(void *start, TStreamerBase *elem);
208 
209 protected:
210  // redefined protected virtual functions
211 
212  virtual void WriteObjectClass(const void *actualObjStart, const TClass *actualClass, Bool_t cacheReuse);
213 
214  // end redefined protected virtual functions
215 
216  static void *ConvertFromJSONChecked(const char *str, const TClass *expectedClass);
217 
218  TString JsonWriteMember(const void *ptr, TDataMember *member, TClass *memberClass, Int_t arraylen);
219 
220  TJSONStackObj *PushStack(Int_t inclevel = 0, void *readnode = nullptr);
221  TJSONStackObj *PopStack();
222  TJSONStackObj *Stack() { return fStack.back(); }
223 
224  void WorkWithClass(TStreamerInfo *info, const TClass *cl = nullptr);
226 
228  Int_t JsonSpecialClass(const TClass *cl) const;
229 
230  void JsonStartElement(const TStreamerElement *elem, const TClass *base_class = nullptr);
231 
232  void PerformPostProcessing(TJSONStackObj *stack, const TClass *obj_cl = nullptr);
233 
234  void JsonWriteBasic(Char_t value);
235  void JsonWriteBasic(Short_t value);
236  void JsonWriteBasic(Int_t value);
237  void JsonWriteBasic(Long_t value);
238  void JsonWriteBasic(Long64_t value);
239  void JsonWriteBasic(Float_t value);
240  void JsonWriteBasic(Double_t value);
241  void JsonWriteBasic(Bool_t value);
242  void JsonWriteBasic(UChar_t value);
243  void JsonWriteBasic(UShort_t value);
244  void JsonWriteBasic(UInt_t value);
245  void JsonWriteBasic(ULong_t value);
246  void JsonWriteBasic(ULong64_t value);
247 
248  void JsonWriteConstChar(const char *value, Int_t len = -1, const char * /*typname*/ = nullptr);
249 
250  void JsonWriteObject(const void *obj, const TClass *objClass, Bool_t check_map = kTRUE);
251 
252  void JsonWriteCollection(TCollection *obj, const TClass *objClass);
253 
254  void JsonReadCollection(TCollection *obj, const TClass *objClass);
255 
256  void JsonReadTObjectMembers(TObject *obj, void *node = nullptr);
257 
258  void *JsonReadObject(void *obj, const TClass *objClass = nullptr, TClass **readClass = nullptr);
259 
260  void AppendOutput(const char *line0, const char *line1 = nullptr);
261 
262  void JsonPushValue();
263 
264  template <typename T>
265  R__ALWAYS_INLINE void JsonWriteArrayCompress(const T *vname, Int_t arrsize, const char *typname);
266 
267  template <typename T>
268  R__ALWAYS_INLINE void JsonReadBasic(T &value);
269 
270  template <typename T>
272 
273  template <typename T>
274  R__ALWAYS_INLINE void JsonReadFastArray(T *arr, Int_t arrsize, bool asstring = false);
275 
276  template <typename T>
277  R__ALWAYS_INLINE void JsonWriteFastArray(const T *arr, Int_t arrsize, const char *typname,
278  void (TBufferJSON::*method)(const T *, Int_t, const char *));
279 
280  TString fOutBuffer; ///<! main output buffer for json code
281  TString *fOutput; ///<! current output buffer for json code
282  TString fValue; ///<! buffer for current value
283  unsigned fJsonrCnt; ///<! counter for all objects, used for referencing
284  std::deque<TJSONStackObj *> fStack; ///<! hierarchy of currently streamed element
285  Int_t fCompact; ///<! 0 - no any compression, 1 - no spaces in the begin, 2 - no new lines, 3 - no spaces at all
286  TString fSemicolon; ///<! depending from compression level, " : " or ":"
287  TString fArraySepar; ///<! depending from compression level, ", " or ","
288  TString fNumericLocale; ///<! stored value of setlocale(LC_NUMERIC), which should be recovered at the end
289 
290  ClassDef(TBufferJSON, 1) // a specialized TBuffer to only write objects into JSON format
291 };
292 
293 #endif
Describe Streamer information for one class version.
Definition: TStreamerInfo.h:43
void WorkWithClass(TStreamerInfo *info, const TClass *cl=nullptr)
Prepares buffer to stream data of specified class.
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)
Ignored in TBufferJSON.
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 Int_t ReadStaticArray(Bool_t *b)
Read array of Bool_t from buffer.
long long Long64_t
Definition: RtypesCore.h:69
static TObject * ConvertFromJSON(const char *str)
Read TObject-based class from JSON, produced by ConvertToJSON() method.
virtual Int_t ReadArray(Bool_t *&b)
Read array of Bool_t from buffer.
void JsonDisablePostprocessing()
disable post-processing of the code
virtual void ReadShort(Short_t &s)
Reads Short_t value from buffer.
#define R__ALWAYS_INLINE
Definition: RConfig.h:556
short Version_t
Definition: RtypesCore.h:61
virtual void WriteLong64(Long64_t l)
Writes Long64_t value to buffer.
float Float_t
Definition: RtypesCore.h:53
virtual void ReadFloat(Float_t &f)
Reads Float_t value from buffer.
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:31
double T(double x)
Definition: ChebyshevPol.h:34
static Bool_t FromJSON(T *&obj, const char *json)
Definition: TBufferJSON.h:53
TString fSemicolon
! depending from compression level, " : " or ":"
Definition: TBufferJSON.h:286
virtual void SkipObjectAny()
Skip any kind of object from buffer.
unsigned short UShort_t
Definition: RtypesCore.h:36
R__ALWAYS_INLINE void JsonReadBasic(T &value)
Template function to read basic value from JSON.
virtual void ReadCharP(Char_t *c)
Reads array of characters from buffer.
virtual void DecrementLevel(TVirtualStreamerInfo *)
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and decrease level in json...
TString fArraySepar
! depending from compression level, ", " or ","
Definition: TBufferJSON.h:287
virtual void ReadBool(Bool_t &b)
Reads Bool_t value from buffer.
Int_t fCompact
! 0 - no any compression, 1 - no spaces in the begin, 2 - no new lines, 3 - no spaces at all ...
Definition: TBufferJSON.h:285
virtual void WriteDouble(Double_t d)
Writes Double_t value to buffer.
virtual void ReadLong64(Long64_t &l)
Reads Long64_t value from buffer.
virtual void ReadStdString(std::string *s)
Reads a std::string.
void JsonWriteBasic(Char_t value)
converts Char_t to string and add to json value buffer
virtual void WriteULong64(ULong64_t l)
Writes ULong64_t value to buffer.
Basic string class.
Definition: TString.h:131
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)
virtual void ReadFastArray(Bool_t *b, Int_t n)
read array of Bool_t from buffer
#define f(i)
Definition: RSha256.hxx:104
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
R__ALWAYS_INLINE void JsonReadFastArray(T *arr, Int_t arrsize, bool asstring=false)
Template method to read array from the JSON.
virtual void ReadLong(Long_t &l)
Reads Long_t value from buffer.
virtual void WriteLong(Long_t l)
Writes Long_t value to buffer.
static Int_t ExportToFile(const char *filename, const TObject *obj, const char *option=nullptr)
Convert object into JSON and store in text file Returns size of the produce file Used in TObject::Sav...
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)
read version value from buffer
virtual void WriteFastArrayString(const Char_t *c, Int_t n)
Write array of Char_t to buffer.
virtual void WriteInt(Int_t i)
Writes Int_t value to buffer.
virtual TVirtualStreamerInfo * GetInfo()
Return current streamer info element.
virtual void StreamObject(void *obj, const std::type_info &typeinfo, const TClass *onFileClass=nullptr)
stream object to/from buffer
virtual TClass * ReadClass(const TClass *cl=nullptr, UInt_t *objTag=nullptr)
suppressed function of TBuffer
virtual void ReadChar(Char_t &c)
Reads Char_t value from buffer.
#define ClassDef(name, id)
Definition: Rtypes.h:320
virtual void WriteFastArray(const Bool_t *b, Int_t n)
Write array of Bool_t to buffer.
TString fOutBuffer
! main output buffer for json code
Definition: TBufferJSON.h:280
virtual void ReadUShort(UShort_t &s)
Reads UShort_t value from buffer.
virtual void ClassMember(const char *name, const char *typeName=nullptr, 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...
virtual void ReadDouble(Double_t &d)
Reads Double_t value from buffer.
void JsonReadTObjectMembers(TObject *obj, void *node=nullptr)
static TClass * GetClass(const std::type_info &typeinfo)
Forward to TROOT::GetClass().
Definition: TBuffer.cxx:307
void JsonWriteCollection(TCollection *obj, const TClass *objClass)
store content of ROOT collection
virtual void ReadStdString(std::string *s)=0
static void * ConvertFromJSONChecked(const char *str, const TClass *expectedClass)
Read objects from JSON, one can reuse existing object.
unsigned fJsonrCnt
! counter for all objects, used for referencing
Definition: TBufferJSON.h:283
virtual void ReadCharStar(char *&s)
Reads a char* string.
R__ALWAYS_INLINE void JsonWriteArrayCompress(const T *vname, Int_t arrsize, const char *typname)
virtual void ReadUChar(UChar_t &c)
Reads UChar_t value from buffer.
void SetCompact(int level)
TString fNumericLocale
! stored value of setlocale(LC_NUMERIC), which should be recovered at the end
Definition: TBufferJSON.h:288
virtual void ReadInt(Int_t &i)
Reads Int_t value from buffer.
TString fValue
! buffer for current value
Definition: TBufferJSON.h:282
virtual void SetStreamerElementNumber(TStreamerElement *elem, Int_t comp_type)
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and add/verify next elemen...
virtual void WriteStdString(const std::string *s)
Writes a std::string.
std::deque< TJSONStackObj * > fStack
! hierarchy of currently streamed element
Definition: TBufferJSON.h:284
virtual void IncrementLevel(TVirtualStreamerInfo *)
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and indent new level in js...
virtual void WriteObjectClass(const void *actualObjStart, const TClass *actualClass, Bool_t cacheReuse)
Write object to buffer. Only used from TBuffer.
virtual void ReadULong(ULong_t &l)
Reads ULong_t value from buffer.
virtual void ClassBegin(const TClass *, Version_t=-1)
Should be called in the beginning of custom class streamer.
TString * fOutput
! current output buffer for json code
Definition: TBufferJSON.h:281
Collection abstract base class.
Definition: TCollection.h:63
unsigned int UInt_t
Definition: RtypesCore.h:42
void JsonWriteConstChar(const char *value, Int_t len=-1, const char *=nullptr)
writes string value, processing all kind of special characters
short Short_t
Definition: RtypesCore.h:35
void AppendOutput(const char *line0, const char *line1=nullptr)
Append two string to the output JSON, normally separate by line break.
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
virtual void WriteUShort(UShort_t s)
Writes UShort_t value to buffer.
void WorkWithElement(TStreamerElement *elem, Int_t)
This is call-back from streamer which indicates that class member will be streamed Name of element us...
TJSONStackObj * PushStack(Int_t inclevel=0, void *readnode=nullptr)
add new level to the structures stack
virtual void WriteBool(Bool_t b)
Writes Bool_t value to buffer.
virtual void ReadTString(TString &s)
Reads a TString.
virtual void WriteFloat(Float_t f)
Writes Float_t value to buffer.
#define h(i)
Definition: RSha256.hxx:106
const Bool_t kFALSE
Definition: RtypesCore.h:88
void * JsonReadObject(void *obj, const TClass *objClass=nullptr, TClass **readClass=nullptr)
Read object from current JSON node.
long Long_t
Definition: RtypesCore.h:50
#define d(i)
Definition: RSha256.hxx:102
void JsonPushValue()
If value exists, push in the current stack for post-processing.
virtual void WriteTString(const TString &s)
Writes a TString.
Base class for text-based streamers like TBufferJSON or TBufferXML Special actions list will use meth...
Definition: TBufferText.h:21
virtual void WriteShort(Short_t s)
Writes Short_t value to buffer.
Class for serializing object to and from JavaScript Object Notation (JSON) format.
Definition: TBufferJSON.h:27
double Double_t
Definition: RtypesCore.h:55
virtual void WriteUInt(UInt_t i)
Writes UInt_t value to buffer.
R__ALWAYS_INLINE void JsonWriteFastArray(const T *arr, Int_t arrsize, const char *typname, void(TBufferJSON::*method)(const T *, Int_t, const char *))
Template method to write array of arbitrary dimensions Different methods can be used for store last a...
virtual void WriteULong(ULong_t l)
Writes ULong_t value to buffer.
unsigned long long ULong64_t
Definition: RtypesCore.h:70
unsigned long ULong_t
Definition: RtypesCore.h:51
virtual void * ReadObjectAny(const TClass *clCast)
Read object from buffer. Only used from TBuffer.
static constexpr double s
virtual void WriteCharStar(char *s)
Writes a char*.
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.
virtual void StreamObject(void *obj, const TClass *cl, const TClass *onFileClass=nullptr)
stream object to/from buffer
virtual void ClassEnd(const TClass *)
Should be called at the end of custom streamer See TBufferJSON::ClassBegin for more details...
void JsonStartElement(const TStreamerElement *elem, const TClass *base_class=nullptr)
Start new class member in JSON structures.
Mother of all ROOT objects.
Definition: TObject.h:37
TJSONStackObj * PopStack()
remove one level from stack
char Char_t
Definition: RtypesCore.h:29
R__ALWAYS_INLINE Int_t JsonReadArray(T *value)
Read static array from JSON - not used.
virtual void WriteChar(Char_t c)
Writes Char_t value to buffer.
auto * l
Definition: textangle.C:4
virtual void WriteCharP(const Char_t *c)
Writes array of characters to buffer.
basic_json<> json
default JSON class
Definition: json.hpp:12912
static TString ToJSON(const T *obj, Int_t compact=0, const char *member_name=nullptr)
Definition: TBufferJSON.h:47
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
TJSONStackObj * Stack()
Definition: TBufferJSON.h:222
void PerformPostProcessing(TJSONStackObj *stack, const TClass *obj_cl=nullptr)
Function is converts TObject and TString structures to more compact representation.
void JsonReadCollection(TCollection *obj, const TClass *objClass)
read content of ROOT collection
#define c(i)
Definition: RSha256.hxx:101
static TString ConvertToJSON(const TObject *obj, Int_t compact=0, const char *member_name=nullptr)
Converts object, inherited from TObject class, to JSON string Lower digit of compact parameter define...
unsigned char UChar_t
Definition: RtypesCore.h:34
static void * ConvertFromJSONAny(const char *str, TClass **cl=nullptr)
Read object from JSON, produced by ConvertToJSON() method.
virtual ~TBufferJSON()
destroy buffer
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
Abstract Interface class describing Streamer information for one class.
virtual void WriteStdString(const std::string *s)=0
virtual void ReadBaseClass(void *start, TStreamerBase *elem)
Read data of base class.
const Bool_t kTRUE
Definition: RtypesCore.h:87
const Int_t n
Definition: legend1.C:16
virtual void WriteArray(const Bool_t *b, Int_t n)
Write array of Bool_t to buffer.
char name[80]
Definition: TGX11.cxx:109
virtual void ReadUInt(UInt_t &i)
Reads UInt_t value from buffer.
TBufferJSON(TBuffer::EMode mode=TBuffer::kWrite)
Creates buffer object to serialize data into json.