137#include <nlohmann/json.hpp> 
  172            ::Error(
"TArrayIndexProducer", 
"Problem with JSON coding of element %s type %d", 
elem->GetName(),
 
  180         for (
int dim = 0; dim < 
elem->GetArrayDim(); dim++)
 
 
  207         for (
int dim = 0; dim < 
member->GetArrayDim(); dim++) {
 
 
 
  362   std::unique_ptr<TArrayIndexProducer> 
fIndx; 
 
  405         if (!
json->is_object()) 
return -1;
 
  408         for (
auto it = 
json->begin(); it != 
json->end(); ++it) {
 
  415      if (
json->is_array())
 
  419      if (
json->is_object() && (
json->count(
"$arr") == 1))
 
  420         return json->at(
"len").get<
int>();
 
 
  427      auto res = std::stoi(
fValues.back());
 
 
  438      auto indx = std::make_unique<TArrayIndexProducer>(
fElem, -1, 
"");
 
  441      if (!
indx->IsArray() || (
indx->NumDimensions() < 2))
 
 
  451      fStlRead = std::make_unique<StlRead>();
 
  454         if (!
fNode->is_object()) {
 
  455            ::Error(
"TJSONStackObj::AssignStl", 
"when reading %s expecting JSON object", cl->
GetName());
 
  461         if (!
fNode->is_array() && !(
fNode->is_object() && (
fNode->count(
"$arr") == 1))) {
 
  462            ::Error(
"TJSONStackObj::AssignStl", 
"when reading %s expecting JSON array", cl->
GetName());
 
 
 
  484   : 
TBufferText(
mode), fOutBuffer(), fOutput(nullptr), fValue(), fStack(), fSemicolon(
" : "), fArraySepar(
", "),
 
  485     fNumericLocale(), fTypeNameTag(
"_typename")
 
 
  532   void *ptr = (
void *)obj;
 
 
  672      if (
member->GetArrayIndex() != 0) {
 
  682         ptr = *((
char **)ptr);
 
 
  719      Error(
"StoreObject", 
"Can not store object into TBuffer for reading");
 
 
  783      char *buffer = (
char *)
malloc(buflen);
 
  822      ofs.write(buffer, 
bufcur - buffer);
 
  831   return json.Length();
 
 
  863      char *buffer = (
char *)
malloc(buflen);
 
  902      ofs.write(buffer, 
bufcur - buffer);
 
  911   return json.Length();
 
 
  933   return (
TObject *)(((
char *)obj) + delta);
 
 
  960   if (
docu.is_null() || (!
docu.is_object() && !
docu.is_array()))
 
 
 1001      ::Error(
"TBufferJSON::ConvertFromJSONChecked", 
"expected class %s is not base for read class %s",
 
 1007   return (
char *)res - 
offset;
 
 
 1020      Info(
"JsonWriteMember", 
"Write member %s type %s ndim %d", 
member->GetName(), 
member->GetTrueTypeName(),
 
 1024   if (
strcmp(
member->GetTrueTypeName(), 
"const char*") == 0)
 
 1042         shift = 
indx.ReduceDimension();
 
 1044      char *
ppp = (
char *)ptr;
 
 1087      } 
while (!
indx.IsDone());
 
 1107      if (
arr && (
arr->GetSize() > 0)) {
 
 1108         arr->Streamer(*
this);
 
 1111            Warning(
"TBufferJSON", 
"When streaming TArray, more than 1 object in the stack, use second item");
 
 1126      return "<not supported>";
 
 
 1139      next->fNode = (nlohmann::json *)
readnode;
 
 1140   } 
else if (
fStack.size() > 0) {
 
 1141      auto prev = 
Stack();
 
 1142      next->fLevel += prev->fLevel;
 
 1143      next->fMemberPtr = prev->fMemberPtr;
 
 1145   fStack.emplace_back(next);
 
 
 1157   return fStack.size() > 0 ? 
fStack.back().get() : 
nullptr;
 
 
 1174            if (
Stack()->fLevel > 0)
 
 
 1190   stack->fMemberPtr = &stack->fMemberCnt;
 
 1209      stack->fMemberCnt = 0; 
 
 
 1229         if ((
strcmp(
elem->GetTypeName(),
"TString") == 0) && (
strcmp(
elem->GetFullName(),
"fLineStyle[30]") == 0)) {
 
 1231            if (
st1->IsStreamerInfo() && 
st1->fInfo && (
strcmp(
st1->fInfo->GetName(),
"TStyle") == 0))
 
 1260         Error(
"JsonStartElement", 
"Missing JSON structure for element %s", 
elem_name);
 
 1267               Error(
"JsonStartElement", 
"Missing array when reading TArray class for element %s", 
elem->GetName());
 
 
 1336      Info(
"JsonWriteObject", 
"Object %p class %s check_map %s", obj, cl ? cl->
GetName() : 
"null",
 
 1366         Error(
"JsonWriteObject", 
"Cannot stream class %s without dictionary", cl->
GetName());
 
 1422      Info(
"JsonWriteObject", 
"Starting object %p write for class: %s", obj, cl->
GetName());
 
 1429      (
const_cast<TClass *
>(cl))->Streamer((
void *)obj, *
this);
 
 1432      Info(
"JsonWriteObject", 
"Done object %p write for class: %s", obj, cl->
GetName());
 
 1435      if (stack->
fValues.size() != 1)
 
 1436         Error(
"JsonWriteObject", 
"Problem when writing array");
 
 1439      if (stack->
fValues.size() > 2)
 
 1440         Error(
"JsonWriteObject", 
"Problem when writing TString or std::string");
 
 1478      } 
else if (stack->
fValues.empty()) {
 
 1481            Error(
"JsonWriteObject", 
"With empty stack fValue!=0");
 
 1503               Error(
"JsonWriteObject", 
"Empty value when it should contain something");
 
 1508            const char *
separ = 
"[";
 
 1517               if (
pairtype.Index(
"unordered_map<") == 0)
 
 1519               else if (
pairtype.Index(
"unordered_multimap<") == 0)
 
 1521               else if (
pairtype.Index(
"multimap<") == 0)
 
 1523               else if (
pairtype.Index(
"map<") == 0)
 
 1569         Info(
"JsonWriteObject", 
"Create blob value for class %s", cl->
GetName());
 
 1574      const char *
separ = 
"[";
 
 1606         Error(
"JsonWriteObject", 
"Non-empty object output for special class %s", cl->
GetName());
 
 
 1627   TMap *map = 
nullptr;
 
 1629      map = 
dynamic_cast<TMap *
>(col);
 
 1640   while ((obj = iter()) != 
nullptr) {
 
 
 1693   TMap *map = 
nullptr;
 
 1698      map = 
dynamic_cast<TMap *
>(col);
 
 1704   std::string 
name = 
json->at(
"name");
 
 1707   nlohmann::json &
arr = 
json->at(
"arr");
 
 1710   for (
int n = 0; 
n < 
size; ++
n) {
 
 1727                  Error(
"JsonReadCollection",
 
 1728                        "Cannot detect class name for TClonesArray - typename tag not configured");
 
 1732               Error(
"JsonReadCollection", 
"TClonesArray size %d smaller than required %d", 
clones->GetSize(), 
size);
 
 1750         Error(
"JsonReadCollection", 
"Try to add object %s not derived from TObject", 
readClass->GetName());
 
 1767            Error(
"JsonReadCollection", 
"Try to add object %s not derived from TObject", 
readClass->GetName());
 
 1773         std::string opt = 
json->at(
"opt").at(
n).get<std::string>();
 
 
 1796   if (
json->is_null())
 
 1802   if (
json->is_object() && (
json->size() == 1) && (
json->find(
"$ref") != 
json->end())) {
 
 1803      unsigned refid = 
json->at(
"$ref").get<
unsigned>();
 
 1811         Error(
"JsonReadObject", 
"Fail to find object for reference %u", 
refid);
 
 1819         Info(
"JsonReadObject", 
"Extract object reference %u %p cl:%s expects:%s", 
refid, 
ref_obj, 
ref_cl->GetName(),
 
 1831         Info(
"JsonReadObject", 
"Read string from %s", 
json->dump().c_str());
 
 1834         *((std::string *)obj) = 
json->get<std::string>();
 
 1836         *((
TString *)obj) = 
json->get<std::string>().c_str();
 
 1847      Error(
"JsonReadObject", 
"No object when reading base class");
 
 1857         Error(
"JsonReadObject", 
"Cannot stream class %s without dictionary", 
objClass->GetName());
 
 1882         Error(
"JsonReadObject", 
"Not array when expecting such %s", 
json->dump().c_str());
 
 1893         Info(
"JsonReadObject", 
"Reading baseclass %s ptr %p", 
objClass->GetName(), obj);
 
 1900            Error(
"JsonReadObject", 
"Cannot find class %s", 
clname.c_str());
 
 1918               Error(
"JsonReadObject", 
"Not possible to read %s and casting to %s pointer as the two classes are unrelated",
 
 1921               Error(
"JsonReadObject", 
"Reading %s and casting to %s pointer is currently not supported",
 
 1933         Info(
"JsonReadObject", 
"Reading object of class %s refid %u ptr %p", 
jsonClass->GetName(), 
fJsonrCnt, obj);
 
 1967         Info(
"JsonReadObject", 
"Calling streamer of class %s", 
jsonClass->GetName());
 
 1970         Error(
"JsonReadObject", 
"Should not be used for reading of base class %s", 
jsonClass->GetName());
 
 1973         jsonClass->Streamer((
void *)obj, *
this);
 
 1985      Info(
"JsonReadObject", 
"Reading object of class %s done", 
jsonClass->GetName());
 
 
 1999   nlohmann::json *
json = node ? (nlohmann::json *)node : 
Stack()->
fNode;
 
 2001   UInt_t uid = 
json->at(
"fUniqueID").get<
unsigned>();
 
 2002   UInt_t bits = 
json->at(
"fBits").get<
unsigned>();
 
 2005   tobj->SetUniqueID(uid);
 
 
 2025      Info(
"IncrementLevel", 
"Class: %s", (
info ? 
info->GetClass()->GetName() : 
"custom"));
 
 
 2036      cl = 
sinfo->GetClass();
 
 2042      Info(
"WorkWithClass", 
"Class: %s", cl->
GetName());
 
 
 2072      Info(
"DecrementLevel", 
"Class: %s", (
info ? 
info->GetClass()->GetName() : 
"custom"));
 
 2080            Info(
"DecrementLevel", 
"    Perform post-processing elem: %s", stack->
fElem->
GetName());
 
 2089      Error(
"DecrementLevel", 
"    Mismatch of streamer info");
 
 2094      Info(
"DecrementLevel", 
"Class: %s done", (
info ? 
info->GetClass()->GetName() : 
"custom"));
 
 
 2113      Info(
"SetStreamerElementNumber", 
"Element name %s", 
elem->GetName());
 
 
 2127      Error(
"WorkWithElement", 
"stack is empty");
 
 2132      Info(
"WorkWithElement", 
"    Start element %s type %d typename %s", 
elem ? 
elem->GetName() : 
"---",
 
 2140            Info(
"WorkWithElement", 
"    Perform post-processing elem: %s", stack->
fElem->
GetName());
 
 2150      Error(
"WorkWithElement", 
"Lost of stack");
 
 2156      Error(
"WorkWithElement", 
"Problem in Inc/Dec level");
 
 2163      Error(
"WorkWithElement", 
"streamer info returns elem = nullptr");
 
 
 2259      Error(
"ClassMember", 
"Invalid member name");
 
 2267   if (
strcmp(typeName, 
"raw:data") == 0)
 
 2272      if (
dt && (
dt->GetType() > 0) && (
dt->GetType() < 20))
 
 2291         Error(
"ClassMember", 
"Invalid class specifier %s", typeName);
 
 2331      Error(
"ClassMember", 
"Invalid combination name = %s type = %s", 
name, typeName);
 
 
 2390         Info(
"PerformPostProcessing", 
"reformat string value = '%s'", 
fValue.
Data());
 
 2398      } 
else if ((stack->
fValues.size() == 1) && (stack->
fValues[0] == 
"1")) {
 
 2401         Error(
"PerformPostProcessing", 
"Wrong values for kOffsetP element %s", (
elem ? 
elem->GetName() : 
"---"));
 
 2416            Error(
"PerformPostProcessing", 
"When storing TObject/TRef, strange number of items %d", cnt);
 
 2448   if (!stack->
fValues.empty()) {
 
 
 2493   if (!cl && 
Stack()->fClVersion) {
 
 2499      Info(
"ReadVersion", 
"Result: %d Class: %s", res, (cl ? cl->
GetName() : 
"---"));
 
 
 2518      Info(
"ReadObjectAny", 
"From current JSON node");
 
 
 2655template <
typename T>
 
 2658   Info(
"ReadArray", 
"Not implemented");
 
 2659   return value ? 1 : 0;
 
 
 2769template <
typename T>
 
 2776      Info(
"ReadFastArray", 
"Reading array sz %d from JSON %s", 
arrsize, 
json->dump().substr(0, 30).c_str());
 
 2783      for (
int cnt = 0; cnt < 
arrsize; ++cnt) {
 
 2785         for (
int k = 1; k < 
lastdim; ++k)
 
 2791      std::string str = 
json->get<std::string>();
 
 2792      for (
int cnt = 0; cnt < 
arrsize; ++cnt)
 
 2793         arr[cnt] = (cnt < (
int)str.length()) ? str[cnt] : 0;
 
 2794   } 
else if (
json->is_object() && (
json->count(
"$arr") == 1)) {
 
 2796         Error(
"ReadFastArray", 
"Mismatch compressed array size %d %d", 
arrsize, 
json->at(
"len").get<
int>());
 
 2798      for (
int cnt = 0; cnt < 
arrsize; ++cnt)
 
 2801      if (
json->count(
"b") == 1) {
 
 2802         auto base64 = 
json->at(
"b").get<std::string>();
 
 2804         int offset = (
json->count(
"o") == 1) ? 
json->at(
"o").get<
int>() : 0;
 
 2809         if (
arrsize * (
long) 
sizeof(T) < (
offset + decode.Length())) {
 
 2810            Error(
"ReadFastArray", 
"Base64 data %ld larger than target array size %ld", (
long) decode.Length() + 
offset, (
long) (
arrsize*
sizeof(T)));
 
 2811         } 
else if ((
sizeof(T) > 1) && (decode.Length() % 
sizeof(T) != 0)) {
 
 2812            Error(
"ReadFastArray", 
"Base64 data size %ld not matches with element size %ld", (
long) decode.Length(), (
long) 
sizeof(T));
 
 2822         pname = std::string(
"p") + 
idname;
 
 2823         if (
json->count(pname) == 1)
 
 2824            p = 
json->at(pname).get<
int>();
 
 2830            for (
unsigned sub = 0; sub < 
v.size(); ++sub)
 
 2835            for (
unsigned sub = 0; sub < 
ncopy; ++sub)
 
 2836               arr[
p++] = 
v.get<T>();
 
 2838         idname = std::to_string(++
id);
 
 2842         Error(
"ReadFastArray", 
"Mismatch array sizes %d %d", 
arrsize, (
int)
json->size());
 
 2843      for (
int cnt = 0; cnt < 
arrsize; ++cnt)
 
 2844         arr[cnt] = 
json->at(cnt).get<T>();
 
 
 2970      Info(
"ReadFastArray", 
"void* n:%d cl:%s", 
n, cl->
GetName());
 
 2980   char *obj = (
char *)start;
 
 2990      Info(
"ReadFastArray", 
"Indexes ndim:%d totallen:%d", 
indexes.NumDimensions(), 
indexes.TotalLength());
 
 
 3010      Info(
"ReadFastArray", 
"void** n:%d cl:%s prealloc:%s", 
n, cl->
GetName(), (
isPreAlloc ? 
"true" : 
"false"));
 
 3037         void *old = start[
j];
 
 3043            start[
j] = (
const_cast<TClass *
>(cl))->New();
 
 
 3051template <
typename T>
 
 3114               } 
else if (
nsame > 5) {
 
 3133            if ((
nsame > 1) || (pp - 
p0 == 1)) {
 
 
 3275template <
typename T>
 
 3288      Fatal(
"JsonWriteFastArray", 
"Not enough space left in the buffer (1GB limit). %lld elements is greater than the max left of %d", 
arrsize, 
maxElements);
 
 3306         if (++cnt == 
indexes.GetSize()) {
 
 
 3453      Info(
"WriteFastArray", 
"void *start cl:%s n:%lld", cl ? cl->
GetName() : 
"---", 
n);
 
 3467      char *obj = (
char *)start;
 
 
 3507      Info(
"WriteFastArray", 
"void **startp cl:%s n:%lld", cl->
GetName(), 
n);
 
 3536            start[
j] = (
const_cast<TClass *
>(cl))->New();
 
 
 3562      Info(
"StreamObject", 
"Class: %s", (cl ? cl->
GetName() : 
"none"));
 
 
 3573template <
typename T>
 
 3592   if (!
Stack()->fValues.empty())
 
 
 3627   if (!
Stack()->fValues.empty())
 
 
 3679   if (
json->is_null())
 
 3680      val = std::numeric_limits<Float_t>::quiet_NaN();
 
 
 3691   if (
json->is_null())
 
 3692      val = std::numeric_limits<Double_t>::quiet_NaN();
 
 
 3702   Error(
"ReadCharP", 
"Not implemented");
 
 
 3736   std::size_t 
nch = str.length();
 
 3738      s = 
new char[
nch + 1];
 
 
 3957   if (std::isinf(
value)) {
 
 3959   } 
else if (std::isnan(
value)) {
 
 
 3973   if (std::isinf(
value)) {
 
 3975   } 
else if (std::isnan(
value)) {
 
 
 4059         case 0: 
n = 
len; 
break;
 
 4071            } 
else if (
c < 0x80) {
 
 4073            } 
else if ((
n < 
len - 1) && ((
c & 0xe0) == 0xc0) && ((
value[
n+1] & 0xc0) == 0x80)) {
 
 4074               unsigned code = ((unsigned)
value[
n+1] & 0x3f) | (((unsigned) 
c & 0x1f) << 6);
 
 4077            } 
else if ((
n < 
len - 2) &&  ((
c & 0xf0) == 0xe0) && ((
value[
n+1] & 0xc0) == 0x80) && ((
value[
n+2] & 0xc0) == 0x80)) {
 
 4078               unsigned code = ((unsigned)
value[
n+2] & 0x3f) | (((unsigned) 
value[
n+1] & 0x3f) << 6) | (((
unsigned) 
c & 0x0f) << 12);
 
 4081            } 
else if ((
n < 
len - 3) && ((
c & 0xf8) == 0xf0) && ((
value[
n+1] & 0xc0) == 0x80) && ((
value[
n+2] & 0xc0) == 0x80) && ((
value[
n+3] & 0xc0) == 0x80)) {
 
 4082               unsigned code = ((unsigned)
value[
n+3] & 0x3f) | (((unsigned) 
value[
n+2] & 0x3f) << 6) | (((
unsigned) 
value[
n+1] & 0x3f) << 12) | (((unsigned) 
c & 0x07) << 18);
 
 
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.
 
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
 
winID h TVirtualViewer3D TVirtualGLPainter p
 
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 Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
 
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 Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
 
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 GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
 
Option_t Option_t TPoint TPoint const char mode
 
const_iterator begin() const
 
Array of integers (32 bits per element).
 
void Set(Int_t n) override
Set size of this array to n ints.
 
JSON array separators for multi-dimensional JSON arrays It fully reproduces array dimensions as in or...
 
TArrayI & GetIndices()
return array with current index
 
nlohmann::json * ExtractNode(nlohmann::json *topnode, bool next=true)
 
Int_t NumDimensions() const
returns number of array dimensions
 
Int_t TotalLength() const
returns total number of elements in array
 
TArrayIndexProducer(TDataMember *member, Int_t extradim, const char *separ)
 
const char * NextSeparator()
increment indexes and returns intermediate or last separator
 
TArrayIndexProducer(TStreamerElement *elem, Int_t arraylen, const char *separ)
 
Abstract array base class.
 
static TString Decode(const char *data)
Decode a base64 string date into a generic TString.
 
static TString Encode(const char *data)
Transform data into a null terminated base64 string.
 
void InitMap() override
Create the fMap container and initialize them with the null object.
 
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.
 
Class for serializing object to and from JavaScript Object Notation (JSON) format.
 
void ReadULong(ULong_t &l) final
Reads ULong_t value from buffer.
 
void JsonWriteBasic(Char_t value)
converts Char_t to string and add to json value buffer
 
void WriteShort(Short_t s) final
Writes Short_t value to buffer.
 
void JsonWriteCollection(TCollection *obj, const TClass *objClass)
store content of ROOT collection
 
TString fSemicolon
! depending from compression level, " : " or ":"
 
Int_t fCompact
! 0 - no any compression, 1 - no spaces in the begin, 2 - no new lines, 3 - no spaces at all
 
void ReadULong64(ULong64_t &l) final
Reads ULong64_t value from buffer.
 
void WriteStdString(const std::string *s) final
Writes a std::string.
 
void JsonWriteFastArray(const T *arr, Long64_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...
 
void * ReadObjectAny(const TClass *clCast) final
Read object from buffer. Only used from TBuffer.
 
static TObject * ConvertFromJSON(const char *str)
Read TObject-based class from JSON, produced by ConvertToJSON() method.
 
void ClassBegin(const TClass *, Version_t=-1) final
Should be called in the beginning of custom class streamer.
 
Int_t JsonReadArray(T *value)
Read static array from JSON - not used.
 
void IncrementLevel(TVirtualStreamerInfo *) final
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and indent new level in js...
 
void WriteLong(Long_t l) final
Writes Long_t value to buffer.
 
TString fValue
! buffer for current value
 
void WriteUInt(UInt_t i) final
Writes UInt_t value to buffer.
 
void ReadFloat(Float_t &f) final
Reads Float_t value from buffer.
 
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...
 
void WriteCharStar(char *s) final
Writes a char*.
 
void PerformPostProcessing(TJSONStackObj *stack, const TClass *obj_cl=nullptr)
Function is converts TObject and TString structures to more compact representation.
 
void ReadShort(Short_t &s) final
Reads Short_t value from buffer.
 
void JsonReadFastArray(T *arr, Int_t arrsize, bool asstring=false)
Template method to read array from the JSON.
 
TString StoreObject(const void *obj, const TClass *cl)
Store provided object as JSON structure Allows to configure different TBufferJSON properties before c...
 
std::deque< std::unique_ptr< TJSONStackObj > > fStack
! hierarchy of currently streamed element
 
void ReadChar(Char_t &c) final
Reads Char_t value from 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...
 
TString fNumericLocale
! stored value of setlocale(LC_NUMERIC), which should be recovered at the end
 
void SetTypeversionTag(const char *tag=nullptr)
Configures _typeversion tag in JSON One can specify name of the JSON tag like "_typeversion" or "$tv"...
 
TString fTypeVersionTag
! JSON member used to store class version, default empty
 
void ReadCharStar(char *&s) final
Reads a char* string.
 
UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE) final
Ignored in TBufferJSON.
 
void ReadUShort(UShort_t &s) final
Reads UShort_t value from buffer.
 
TJSONStackObj * PushStack(Int_t inclevel=0, void *readnode=nullptr)
add new level to the structures stack
 
TBufferJSON(TBuffer::EMode mode=TBuffer::kWrite)
Creates buffer object to serialize data into json.
 
void JsonDisablePostprocessing()
disable post-processing of the code
 
void WorkWithElement(TStreamerElement *elem, Int_t)
This is call-back from streamer which indicates that class member will be streamed Name of element us...
 
void ReadCharP(Char_t *c) final
Reads array of characters from buffer.
 
void ReadUChar(UChar_t &c) final
Reads UChar_t value from buffer.
 
void WriteUShort(UShort_t s) final
Writes UShort_t value to buffer.
 
unsigned fJsonrCnt
! counter for all objects, used for referencing
 
Int_t fArrayCompact
! 0 - no array compression, 1 - exclude leading/trailing zeros, 2 - check value repetition
 
void ReadFastArray(Bool_t *b, Int_t n) final
read array of Bool_t from buffer
 
void JsonReadBasic(T &value)
Template function to read basic value from JSON.
 
void JsonReadCollection(TCollection *obj, const TClass *objClass)
read content of ROOT collection
 
void JsonPushValue()
If value exists, push in the current stack for post-processing.
 
void WriteULong(ULong_t l) final
Writes ULong_t value to buffer.
 
void SetTypenameTag(const char *tag="_typename")
Configures _typename tag in JSON structures By default "_typename" field in JSON structures used to s...
 
TVirtualStreamerInfo * GetInfo() final
Return current streamer info element.
 
~TBufferJSON() override
destroy buffer
 
void JsonStartElement(const TStreamerElement *elem, const TClass *base_class)
Start new class member in JSON structures.
 
void DecrementLevel(TVirtualStreamerInfo *) final
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and decrease level in json...
 
void WriteFloat(Float_t f) final
Writes Float_t value to buffer.
 
Bool_t IsSkipClassInfo(const TClass *cl) const
Returns true if class info will be skipped from JSON.
 
void ReadLong(Long_t &l) final
Reads Long_t value from buffer.
 
void WriteClass(const TClass *cl) final
suppressed function of TBuffer
 
TClass * ReadClass(const TClass *cl=nullptr, UInt_t *objTag=nullptr) final
suppressed function of TBuffer
 
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 member, which should be now streamed in custom streamer F...
 
TString * fOutput
! current output buffer for json code
 
TString fTypeNameTag
! JSON member used for storing class name, when empty - no class name will be stored
 
static void * ConvertFromJSONAny(const char *str, TClass **cl=nullptr)
Read object from JSON In class pointer (if specified) read class is returned One must specify expecte...
 
void ReadUInt(UInt_t &i) final
Reads UInt_t value from buffer.
 
void ReadLong64(Long64_t &l) final
Reads Long64_t value from buffer.
 
Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr) final
read version value from buffer
 
static void * ConvertFromJSONChecked(const char *str, const TClass *expectedClass)
Read objects from JSON, one can reuse existing object.
 
Int_t ReadStaticArray(Bool_t *b) final
Read array of Bool_t from buffer.
 
void WriteBool(Bool_t b) final
Writes Bool_t value to buffer.
 
void SetStreamerElementNumber(TStreamerElement *elem, Int_t comp_type) final
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and add/verify next elemen...
 
void WriteDouble(Double_t d) final
Writes Double_t value to buffer.
 
TString JsonWriteMember(const void *ptr, TDataMember *member, TClass *memberClass, Int_t arraylen)
Convert single data member to JSON structures Returns string with converted member.
 
void ReadInt(Int_t &i) final
Reads Int_t value from buffer.
 
std::vector< const TClass * > fSkipClasses
! list of classes, which class info is not stored
 
@ kBase64
all binary arrays will be compressed with base64 coding, supported by JSROOT
 
@ kSkipTypeInfo
do not store typenames in JSON
 
@ kNoSpaces
no new lines plus remove all spaces around "," and ":" symbols
 
@ kMapAsObject
store std::map, std::unordered_map as JSON object
 
@ kSameSuppression
zero suppression plus compress many similar values together
 
void WriteCharP(const Char_t *c) final
Writes array of characters to buffer.
 
TString fArraySepar
! depending from compression level, ", " or ","
 
void SetSkipClassInfo(const TClass *cl)
Specify class which typename will not be stored in JSON Several classes can be configured To exclude ...
 
Int_t ReadArray(Bool_t *&b) final
Read array of Bool_t from buffer.
 
void WriteFastArray(const Bool_t *b, Long64_t n) final
Write array of Bool_t to buffer.
 
void AppendOutput(const char *line0, const char *line1=nullptr)
Append two string to the output JSON, normally separate by line break.
 
TString fOutBuffer
! main output buffer for json code
 
TJSONStackObj * PopStack()
remove one level from stack
 
void JsonWriteArrayCompress(const T *vname, Int_t arrsize, const char *typname)
 
void WriteInt(Int_t i) final
Writes Int_t value to buffer.
 
void WriteArray(const Bool_t *b, Int_t n) final
Write array of Bool_t to buffer.
 
void ReadBaseClass(void *start, TStreamerBase *elem) final
Read data of base class.
 
void ReadFastArrayString(Char_t *c, Int_t n) final
read array of Char_t from buffer
 
TJSONStackObj * JsonStartObjectWrite(const TClass *obj_class, TStreamerInfo *info=nullptr)
Start object element with typeinfo.
 
void ReadStdString(std::string *s) final
Reads a std::string.
 
void ReadDouble(Double_t &d) final
Reads Double_t value from buffer.
 
void ClassEnd(const TClass *) final
Should be called at the end of custom streamer See TBufferJSON::ClassBegin for more details.
 
Int_t JsonSpecialClass(const TClass *cl) const
return non-zero value when class has special handling in JSON it is TCollection (-130),...
 
void SkipObjectAny() final
Skip any kind of object from buffer.
 
void SetCompact(int level)
Set level of space/newline/array compression Lower digit of compact parameter define formatting rules...
 
Bool_t fMapAsObject
! when true, std::map will be converted into JSON object
 
void WriteUChar(UChar_t c) final
Writes UChar_t value to buffer.
 
void WriteTString(const TString &s) final
Writes a TString.
 
void JsonWriteConstChar(const char *value, Int_t len=-1, const char *=nullptr)
writes string value, processing all kind of special characters
 
void * RestoreObject(const char *str, TClass **cl)
Read object from JSON In class pointer (if specified) read class is returned One must specify expecte...
 
void WriteObjectClass(const void *actualObjStart, const TClass *actualClass, Bool_t cacheReuse) final
Write object to buffer. Only used from TBuffer.
 
void StreamObject(void *obj, const TClass *cl, const TClass *onFileClass=nullptr) final
stream object to/from buffer
 
void WriteLong64(Long64_t l) final
Writes Long64_t value to buffer.
 
void WriteFastArrayString(const Char_t *c, Long64_t n) final
Write array of Char_t to buffer.
 
void JsonReadTObjectMembers(TObject *obj, void *node=nullptr)
Read TObject data members from JSON.
 
void WriteULong64(ULong64_t l) final
Writes ULong64_t value to buffer.
 
void ReadBool(Bool_t &b) final
Reads Bool_t value from buffer.
 
void WriteChar(Char_t c) final
Writes Char_t value to buffer.
 
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...
 
void * JsonReadObject(void *obj, const TClass *objClass=nullptr, TClass **readClass=nullptr)
Read object from current JSON node.
 
void WorkWithClass(TStreamerInfo *info, const TClass *cl=nullptr)
Prepares buffer to stream data of specified class.
 
void ReadTString(TString &s) final
Reads a TString.
 
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
 
virtual void ReadBaseClass(void *start, TStreamerBase *elem)
Read data of base class.
 
TClass instances represent classes, structs and namespaces in the ROOT type system.
 
ROOT::ESTLType GetCollectionType() const
Return the 'type' of the STL the TClass is representing.
 
Bool_t HasDictionary() const
Check whether a class has a dictionary or not.
 
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
 
Int_t Size() const
Return size of object of this class.
 
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
 
Int_t GetBaseClassOffset(const TClass *toBase, void *address=nullptr, bool isDerivedObject=true)
 
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
 
Version_t GetClassVersion() const
 
TClass * GetActualClass(const void *object) const
Return a pointer to the real class of the object.
 
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.
 
An array of clone (identical) objects.
 
Collection abstract base class.
 
void SetName(const char *name)
 
const char * GetName() const override
Return name of this collection.
 
virtual void Add(TObject *obj)=0
 
All ROOT classes may have RTTI (run time type identification) support added.
 
Basic data type descriptor (datatype information is obtained from CINT).
 
Option_t * GetOption() const
 
TJSONStackObj()=default
keep actual class version, workaround for ReadVersion in custom streamer
 
nlohmann::json * GetStlNode()
 
Bool_t AssignStl(TClass *cl, Int_t map_convert, const char *typename_tag)
 
Bool_t IsStreamerInfo() const
 
Bool_t fIsStreamerInfo
element in streamer info
 
void PushValue(TString &v)
 
~TJSONStackObj() override
 
Bool_t IsStreamerElement() const
 
std::unique_ptr< TArrayIndexProducer > MakeReadIndexes()
 
nlohmann::json * fNode
producer of ndim indexes
 
int * fMemberPtr
count number of object members, normally _typename is first member
 
std::vector< std::string > fValues
enable base64 coding when writing array
 
Bool_t fAccObjects
indicate that object writing started, should be closed in postprocess
 
std::unique_ptr< StlRead > fStlRead
JSON node, used for reading.
 
Version_t fClVersion
custom structure for stl container reading
 
void PushIntValue(Int_t v)
 
Int_t fLevel
pointer on members counter, can be inherit from parent stack objects
 
std::unique_ptr< TArrayIndexProducer > fIndx
indent level
 
Int_t IsJsonArray(nlohmann::json *json=nullptr, const char *map_convert_type=nullptr)
checks if specified JSON node is array (compressed or not compressed) returns length of array (or -1 ...
 
Bool_t fIsObjStarted
indicate that value is written
 
Bool_t fBase64
if true, accumulate whole objects in values
 
const char * NextMemberSeparator()
returns separator for data members
 
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).
 
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
 
const char * GetName() const override
Returns name of object.
 
const char * GetTitle() const override
Returns title of object.
 
Mother of all ROOT objects.
 
@ kIsOnHeap
object is on heap
 
@ kNotDeleted
object has not been deleted
 
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
 
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
 
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.
 
The TRealData class manages the effective list of all data members for a given class.
 
Int_t GetArrayDim() const
 
virtual Bool_t IsBase() const
Return kTRUE if the element represent a base class.
 
Describes a persistent version of a class.
 
Int_t Atoi() const
Return integer value of string.
 
void Clear()
Clear string without changing its capacity.
 
const char * Data() const
 
TString & Append(const char *cs)
 
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
 
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
 
Abstract Interface class describing Streamer information for one class.
 
static Bool_t CanDelete()
static function returning true if ReadBuffer can delete object
 
bool IsStdClass(const char *type)
return true if the class belongs to the std namespace
 
const char * fTypeTag
iterator for std::map stored as JSON object
 
nlohmann::json fValue
type tag used for std::map stored as JSON object
 
Bool_t fFirst
special iterator over STL map::key members
 
nlohmann::json * GetStlNode(nlohmann::json *prnt)
temporary value reading std::map as JSON
 
nlohmann::json::iterator fIter
is first or second element is used in the pair
 
Int_t fMap
index of object in STL container