142class TArrayIndexProducer {
146 const char *fSepar{
nullptr};
158 Bool_t usearraylen = (arraylen > (isloop ? 0 : 1));
160 if (usearrayindx && (arraylen > 0)) {
165 ::Error(
"TArrayIndexProducer",
"Problem with JSON coding of element %s type %d", elem->
GetName(),
173 for (
int dim = 0; dim < elem->
GetArrayDim(); dim++)
175 fIsArray = fTotalLen > 1;
176 }
else if (usearraylen) {
177 fTotalLen = arraylen;
179 fMaxIndex[0] = arraylen;
189 TArrayIndexProducer(
TDataMember *member,
Int_t extradim,
const char *separ) : fSepar(separ)
200 for (
int dim = 0; dim < member->
GetArrayDim(); dim++) {
206 fMaxIndex[ndim - 1] = extradim;
207 fTotalLen *= extradim;
210 fIsArray = fTotalLen > 1;
214 Int_t NumDimensions()
const {
return fIndicies.
GetSize(); }
217 TArrayI &GetIndices() {
return fIndicies; };
220 Int_t TotalLength()
const {
return fTotalLen; }
222 Int_t ReduceDimension()
229 Int_t len = fMaxIndex[ndim];
232 fTotalLen = fTotalLen / len;
233 fIsArray = fTotalLen > 1;
237 Bool_t IsArray()
const {
return fIsArray; }
242 return !IsArray() || (fCnt >= fTotalLen);
245 const char *GetBegin()
265 const char *NextSeparator()
267 if (++fCnt >= fTotalLen)
276 if (fIndicies[
cnt] >= fMaxIndex[
cnt]) {
278 fIndicies[
cnt--] = 0;
283 fRes.
Append(fIndicies[
cnt] == 0 ?
"[" : fSepar);
289 nlohmann::json *ExtractNode(nlohmann::json *topnode,
bool next =
true)
293 nlohmann::json *subnode = &((*((nlohmann::json *)topnode))[fIndicies[0]]);
294 for (
int k = 1; k < fIndicies.GetSize(); ++k)
295 subnode = &((*subnode)[fIndicies[k]]);
306class TJSONStackObj :
public TObject {
311 nlohmann::json::iterator fIter;
312 const char *fTypeTag{
nullptr};
314 nlohmann::json *GetStlNode(nlohmann::json *prnt)
317 return &(prnt->at(fIndx++));
320 nlohmann::json *json = &(prnt->at(fIndx));
322 json = &(json->at(
fFirst ?
"first" :
"second"));
329 if (fTypeTag && (fIter.key().compare(fTypeTag) == 0))
350 std::vector<std::string> fValues;
352 int *fMemberPtr{
nullptr};
354 std::unique_ptr<TArrayIndexProducer> fIndx;
355 nlohmann::json *fNode{
nullptr};
356 std::unique_ptr<StlRead> fStlRead;
359 TJSONStackObj() =
default;
361 virtual ~TJSONStackObj()
367 Bool_t IsStreamerInfo()
const {
return fIsStreamerInfo; }
369 Bool_t IsStreamerElement()
const {
return !fIsStreamerInfo && fElem; }
373 fValues.emplace_back(
v.Data());
377 void PushIntValue(
Int_t v) { fValues.emplace_back(std::to_string(
v)); }
381 const char *NextMemberSeparator()
383 return (!fMemberPtr || ((*fMemberPtr)++ > 0)) ?
"," :
"";
386 Bool_t IsJsonString() {
return fNode && fNode->is_string(); }
391 Int_t IsJsonArray(nlohmann::json *json =
nullptr,
const char *map_convert_type =
nullptr)
396 if (map_convert_type) {
397 if (!json->is_object())
return -1;
400 for (
auto it = json->begin(); it != json->end(); ++it) {
401 if ((strlen(map_convert_type)==0) || (it.key().compare(map_convert_type) != 0)) sz++;
407 if (json->is_array())
411 if (json->is_object() && (json->count(
"$arr") == 1))
412 return json->at(
"len").get<
int>();
419 auto res = std::stoi(fValues.back());
424 std::unique_ptr<TArrayIndexProducer> MakeReadIndexes()
430 auto indx = std::make_unique<TArrayIndexProducer>(fElem, -1,
"");
433 if (!indx->IsArray() || (indx->NumDimensions() < 2))
439 Bool_t IsStl()
const {
return fStlRead.get() !=
nullptr; }
443 fStlRead = std::make_unique<StlRead>();
444 fStlRead->fMap = map_convert;
445 if (map_convert == 2) {
446 if (!fNode->is_object()) {
447 ::Error(
"TJSONStackObj::AssignStl",
"when reading %s expecting JSON object", cl->
GetName());
450 fStlRead->fIter = fNode->begin();
451 fStlRead->fTypeTag = typename_tag && (strlen(typename_tag) > 0) ? typename_tag :
nullptr;
453 if (!fNode->is_array() && !(fNode->is_object() && (fNode->count(
"$arr") == 1))) {
454 ::Error(
"TJSONStackObj::AssignStl",
"when reading %s expecting JSON array", cl->
GetName());
461 nlohmann::json *GetStlNode()
463 return fStlRead ? fStlRead->GetStlNode(fNode) : fNode;
468 fStlRead.reset(
nullptr);
476 :
TBufferText(mode), fOutBuffer(), fOutput(nullptr),
fValue(), fStack(), fSemicolon(
" : "), fArraySepar(
", "),
477 fNumericLocale(), fTypeNameTag(
"_typename")
486 char *loc = setlocale(LC_NUMERIC, 0);
487 if (loc && (strcmp(loc,
"C") != 0)) {
489 setlocale(LC_NUMERIC,
"C");
526 TClass *clActual =
nullptr;
527 void *ptr = (
void *)obj;
646 const void *actualStart = obj;
647 if (clActual && (clActual != cl)) {
652 clActual =
const_cast<TClass *
>(cl);
655 if (member_name && actualStart) {
660 while ((rdata =
dynamic_cast<TRealData *
>(iter())) !=
nullptr) {
662 if (member && strcmp(member->
GetName(), member_name) == 0)
674 arraylen = *((
int *)((
char *)actualStart + idata->
GetThisOffset()));
680 ptr = *((
char **)ptr);
735 if (!obj || !filename || (*filename == 0))
738 Int_t compact = strstr(filename,
".json.gz") ? 3 : 0;
739 if (option && (*option >=
'0') && (*option <=
'3'))
744 std::ofstream ofs(filename);
746 if (strstr(filename,
".json.gz")) {
747 const char *objbuf = json.
Data();
750 unsigned long objcrc = R__crc32(0, NULL, 0);
751 objcrc = R__crc32(objcrc, (
const unsigned char *)objbuf, objlen);
754 Int_t buflen = 10 + objlen + 8;
758 char *buffer = (
char *)
malloc(buflen);
762 char *bufcur = buffer;
778 memcpy(
dummy, bufcur - 6, 6);
781 unsigned long ziplen = R__memcompress(bufcur - 6, objlen + 6, (
char *)objbuf, objlen);
783 memcpy(bufcur - 6,
dummy, 6);
785 bufcur += (ziplen - 6);
787 *bufcur++ = objcrc & 0xff;
788 *bufcur++ = (objcrc >> 8) & 0xff;
789 *bufcur++ = (objcrc >> 16) & 0xff;
790 *bufcur++ = (objcrc >> 24) & 0xff;
792 *bufcur++ = objlen & 0xff;
793 *bufcur++ = (objlen >> 8) & 0xff;
794 *bufcur++ = (objlen >> 16) & 0xff;
795 *bufcur++ = (objlen >> 24) & 0xff;
797 ofs.write(buffer, bufcur - buffer);
815 if (!obj || !cl || !filename || (*filename == 0))
818 Int_t compact = strstr(filename,
".json.gz") ? 3 : 0;
819 if (option && (*option >=
'0') && (*option <=
'3'))
824 std::ofstream ofs(filename);
826 if (strstr(filename,
".json.gz")) {
827 const char *objbuf = json.
Data();
830 unsigned long objcrc = R__crc32(0, NULL, 0);
831 objcrc = R__crc32(objcrc, (
const unsigned char *)objbuf, objlen);
834 Int_t buflen = 10 + objlen + 8;
838 char *buffer = (
char *)
malloc(buflen);
842 char *bufcur = buffer;
858 memcpy(
dummy, bufcur - 6, 6);
861 unsigned long ziplen = R__memcompress(bufcur - 6, objlen + 6, (
char *)objbuf, objlen);
863 memcpy(bufcur - 6,
dummy, 6);
865 bufcur += (ziplen - 6);
867 *bufcur++ = objcrc & 0xff;
868 *bufcur++ = (objcrc >> 8) & 0xff;
869 *bufcur++ = (objcrc >> 16) & 0xff;
870 *bufcur++ = (objcrc >> 24) & 0xff;
872 *bufcur++ = objlen & 0xff;
873 *bufcur++ = (objlen >> 8) & 0xff;
874 *bufcur++ = (objlen >> 16) & 0xff;
875 *bufcur++ = (objlen >> 24) & 0xff;
877 ofs.write(buffer, bufcur - buffer);
908 return (
TObject *)(((
char *)obj) + delta);
918 TClass *objClass =
nullptr;
925 nlohmann::json docu = nlohmann::json::parse(str);
927 if (docu.is_null() || (!docu.is_object() && !docu.is_array()))
955 if (!res || !resClass)
958 if (resClass == expectedClass)
963 ::Error(
"TBufferJSON::ConvertFromJSONChecked",
"expected class %s is not base for read class %s",
969 return (
char *)res - offset;
992 return (tid ==
kCharStar) ?
"\"\"" :
"null";
1003 if (indx.IsArray() && (tid ==
kChar_t))
1004 shift = indx.ReduceDimension();
1006 char *ppp = (
char *)ptr;
1049 }
while (!indx.IsDone());
1060 memberClass->
Streamer((
void *)ptr, *
this);
1069 if (arr && (arr->
GetSize() > 0)) {
1070 arr->Streamer(*
this);
1072 if (
Stack()->fValues.size() > 1) {
1073 Warning(
"TBufferJSON",
"When streaming TArray, more than 1 object in the stack, use second item");
1078 }
else if (memberClass && !strcmp(memberClass->
GetName(),
"string")) {
1080 memberClass->
Streamer((
void *)ptr, *
this);
1087 if (!memberClass || (member->
GetArrayDim() > 0) || (arraylen > 0))
1088 return "<not supported>";
1098 auto next =
new TJSONStackObj();
1099 next->fLevel = inclevel;
1101 next->fNode = (nlohmann::json *)readnode;
1102 }
else if (
fStack.size() > 0) {
1103 auto prev =
Stack();
1104 next->fLevel += prev->fLevel;
1105 next->fMemberPtr = prev->fMemberPtr;
1136 if (strlen(line1) > 0) {
1138 if (
Stack()->fLevel > 0)
1154 stack->fMemberPtr = &stack->fMemberCnt;
1173 stack->fMemberCnt = 0;
1185 const char *elem_name =
nullptr;
1188 switch (special_kind) {
1215 nlohmann::json *json =
Stack()->fNode;
1217 if (json->count(elem_name) != 1) {
1218 Error(
"JsonStartElement",
"Missing JSON structure for element %s", elem_name);
1220 Stack()->fNode = &((*json)[elem_name]);
1223 Stack()->PushIntValue(len > 0 ? len : 0);
1225 Error(
"JsonStartElement",
"Missing array when reading TArray class for element %s", elem->
GetName());
1227 if ((
gDebug > 1) && base_class)
1228 Info(
"JsonStartElement",
"Reading baseclass %s from element %s", base_class->
GetName(), elem_name);
1277 if (isstd && !strcmp(cl->
GetName(),
"string"))
1294 Info(
"JsonWriteObject",
"Object %p class %s check_map %s", obj, cl ? cl->
GetName() :
"null",
1295 check_map ?
"true" :
"false");
1299 TString fObjectOutput, *fPrevOutput{
nullptr};
1301 TJSONStackObj *stack =
Stack();
1303 if (stack && stack->fAccObjects && ((
fValue.
Length() > 0) || (stack->fValues.size() > 0))) {
1307 stack->PushValue(
fValue);
1312 }
else if ((special_kind <= 0) || (special_kind >
json_TArray)) {
1318 if ((
fMapAsObject && (
fStack.size()==1)) || (stack && stack->fElem && strstr(stack->fElem->GetTitle(),
"JSON_object")))
1329 if (special_kind <= 0) {
1347 }
else if (map_convert == 2) {
1353 fValue.
Form(
"{\"$ref\":%u}", (
unsigned)(refid - 1));
1369 Info(
"JsonWriteObject",
"Starting object %p write for class: %s", obj, cl->
GetName());
1376 (
const_cast<TClass *
>(cl))->Streamer((
void *)obj, *
this);
1379 Info(
"JsonWriteObject",
"Done object %p write for class: %s", obj, cl->
GetName());
1382 if (stack->fValues.size() != 1)
1383 Error(
"JsonWriteObject",
"Problem when writing array");
1384 stack->fValues.clear();
1386 if (stack->fValues.size() > 2)
1387 Error(
"JsonWriteObject",
"Problem when writing TString or std::string");
1388 stack->fValues.clear();
1391 }
else if ((special_kind > 0) && (special_kind <
ROOT::kSTLend)) {
1394 if (stack->fValues.empty()) {
1397 Error(
"JsonWriteObject",
"With empty stack fValue!=0");
1401 auto size = std::stoi(stack->fValues[0]);
1403 bool trivial_format =
false;
1405 if ((stack->fValues.size() == 1) && ((size > 1) || ((
fValue.
Length() > 1) && (
fValue[0]==
'[')))) {
1408 TClass *value_class = proxy ? proxy->GetValueClass() :
nullptr;
1410 trivial_format =
false;
1412 trivial_format =
true;
1415 if (trivial_format) {
1417 stack->fValues.clear();
1419 Error(
"JsonWriteObject",
"Empty value when it should contain something");
1423 }
else if (map_convert == 2) {
1426 stack->PushValue(
fValue);
1428 const char *separ = (
fCompact < 2) ?
", " :
",";
1429 const char *semi = (
fCompact < 2) ?
": " :
":";
1443 for (
Int_t k = 1; k < (int) stack->fValues.size() - 1; k += 2) {
1452 stack->fValues.clear();
1454 const char *separ =
"[";
1457 stack->PushValue(
fValue);
1459 if ((size * 2 == (
int) stack->fValues.size() - 1) && (map_convert > 0)) {
1463 if (pairtype.
Index(
"unordered_map<") == 0)
1464 pairtype.
Replace(0, 14,
"pair<");
1465 else if (pairtype.
Index(
"unordered_multimap<") == 0)
1466 pairtype.
Replace(0, 19,
"pair<");
1467 else if (pairtype.
Index(
"multimap<") == 0)
1468 pairtype.
Replace(0, 9,
"pair<");
1469 else if (pairtype.
Index(
"map<") == 0)
1470 pairtype.
Replace(0, 4,
"pair<");
1477 for (
Int_t k = 1; k < (int) stack->fValues.size() - 1; k += 2) {
1497 for (
Int_t k = 1; k < (int) stack->fValues.size(); k++) {
1505 stack->fValues.clear();
1513 if ((special_kind == 0) && (!stack->fValues.empty() || (
fValue.
Length() > 0))) {
1515 Info(
"JsonWriteObject",
"Create blob value for class %s", cl->
GetName());
1520 const char *separ =
"[";
1522 for (
auto &elem: stack->fValues) {
1536 stack->fValues.clear();
1541 if ((special_kind <= 0))
1549 if ((special_kind <= 0) || (special_kind >
json_TArray))
1551 else if (fObjectOutput.
Length() != 0)
1552 Error(
"JsonWriteObject",
"Non-empty object output for special class %s", cl->
GetName());
1573 TMap *map =
nullptr;
1575 map =
dynamic_cast<TMap *
>(col);
1586 while ((obj = iter()) !=
nullptr) {
1638 TList *lst =
nullptr;
1639 TMap *map =
nullptr;
1642 lst =
dynamic_cast<TList *
>(col);
1644 map =
dynamic_cast<TMap *
>(col);
1648 nlohmann::json *json =
Stack()->fNode;
1650 std::string
name = json->at(
"name");
1653 nlohmann::json &arr = json->at(
"arr");
1654 int size = arr.size();
1656 for (
int n = 0;
n < size; ++
n) {
1657 nlohmann::json *subelem = &arr.at(
n);
1660 subelem = &subelem->at(
"first");
1664 TClass *readClass =
nullptr, *objClass =
nullptr;
1665 void *subobj =
nullptr;
1673 Error(
"JsonReadCollection",
1674 "Cannot detect class name for TClonesArray - typename tag not configured");
1677 }
else if (size > clones->
GetSize()) {
1678 Error(
"JsonReadCollection",
"TClonesArray size %d smaller than required %d", clones->
GetSize(), size);
1693 if (!subobj || !readClass) {
1696 Error(
"JsonReadCollection",
"Try to add object %s not derived from TObject", readClass->
GetName());
1705 readClass =
nullptr;
1710 if (!subobj2 || !readClass) {
1713 Error(
"JsonReadCollection",
"Try to add object %s not derived from TObject", readClass->
GetName());
1717 map->
Add(tobj,
static_cast<TObject *
>(subobj2));
1719 std::string opt = json->at(
"opt").at(
n).get<std::string>();
1720 lst->
Add(tobj, opt.c_str());
1734 *readClass =
nullptr;
1736 TJSONStackObj *stack =
Stack();
1738 Bool_t process_stl = stack->IsStl();
1739 nlohmann::json *json = stack->GetStlNode();
1742 if (json->is_null())
1748 if (json->is_object() && (json->size() == 1) && (json->find(
"$ref") != json->end())) {
1749 unsigned refid = json->at(
"$ref").get<
unsigned>();
1751 void *ref_obj =
nullptr;
1752 TClass *ref_cl =
nullptr;
1756 if (!ref_obj || !ref_cl) {
1757 Error(
"JsonReadObject",
"Fail to find object for reference %u", refid);
1762 *readClass = ref_cl;
1765 Info(
"JsonReadObject",
"Extract object reference %u %p cl:%s expects:%s", refid, ref_obj, ref_cl->
GetName(),
1766 (objClass ? objClass->
GetName() :
"---"));
1774 obj = objClass->
New();
1777 Info(
"JsonReadObject",
"Read string from %s", json->dump().c_str());
1780 *((std::string *)obj) = json->get<std::string>();
1782 *((
TString *)obj) = json->get<std::string>().c_str();
1785 *readClass =
const_cast<TClass *
>(objClass);
1790 Bool_t isBase = (stack->fElem && objClass) ? stack->fElem->IsBase() :
kFALSE;
1792 if (isBase && (!obj || !objClass)) {
1793 Error(
"JsonReadObject",
"No object when reading base class");
1797 Int_t map_convert = 0;
1800 map_convert = json->is_object() ? 2 : 1;
1808 TClass *jsonClass =
nullptr;
1809 Int_t jsonClassVersion = 0;
1813 jsonClass =
const_cast<TClass *
>(objClass);
1816 obj = jsonClass->
New();
1820 stack->PushIntValue(len > 0 ? len : 0);
1823 Error(
"JsonReadObject",
"Not array when expecting such %s", json->dump().c_str());
1826 Info(
"JsonReadObject",
"Reading special kind %d %s ptr %p", special_kind, objClass->
GetName(), obj);
1828 }
else if (isBase) {
1831 jsonClass =
const_cast<TClass *
>(objClass);
1834 Info(
"JsonReadObject",
"Reading baseclass %s ptr %p", objClass->
GetName(), obj);
1841 Error(
"JsonReadObject",
"Cannot find class %s", clname.c_str());
1844 jsonClass =
const_cast<TClass *
>(objClass);
1856 if (objClass && (jsonClass != objClass)) {
1857 Error(
"JsonReadObject",
"Class mismatch between provided %s and in JSON %s", objClass->
GetName(),
1862 obj = jsonClass->
New();
1865 Info(
"JsonReadObject",
"Reading object of class %s refid %u ptr %p", jsonClass->
GetName(),
fJsonrCnt, obj);
1896 stack->fClVersion = jsonClassVersion ? jsonClassVersion : jsonClass->
GetClassVersion();
1899 Info(
"JsonReadObject",
"Calling streamer of class %s", jsonClass->
GetName());
1901 if (isBase && (special_kind == 0))
1902 Error(
"JsonReadObject",
"Should not be used for reading of base class %s", jsonClass->
GetName());
1905 jsonClass->
Streamer((
void *)obj, *
this);
1907 stack->fClVersion = 0;
1917 Info(
"JsonReadObject",
"Reading object of class %s done", jsonClass->
GetName());
1920 *readClass = jsonClass;
1927 nlohmann::json *json = node ? (nlohmann::json *)node :
Stack()->fNode;
1929 UInt_t uid = json->at(
"fUniqueID").get<
unsigned>();
1930 UInt_t bits = json->at(
"fBits").get<
unsigned>();
1935 for (
unsigned n = 0;
n < 32;
n++)
1939 Info(
"JsonReadTObjectMembers",
"Reading TObject part bits %u kMustCleanup %d", bits, tobj->
TestBit(
kMustCleanup));
1968 Info(
"WorkWithClass",
"Class: %s", cl->
GetName());
1970 TJSONStackObj *stack =
Stack();
1974 }
else if (stack && stack->IsStreamerElement() && !stack->fIsObjStarted &&
1978 stack->fIsObjStarted =
kTRUE;
1987 stack->fInfo = sinfo;
1988 stack->fIsStreamerInfo =
kTRUE;
2000 TJSONStackObj *stack =
Stack();
2002 if (stack->IsStreamerElement()) {
2006 Info(
"DecrementLevel",
" Perform post-processing elem: %s", stack->fElem->GetName());
2015 Error(
"DecrementLevel",
" Mismatch of streamer info");
2020 Info(
"DecrementLevel",
"Class: %s done", (info ? info->
GetClass()->
GetName() :
"custom"));
2028 return Stack()->fInfo;
2039 Info(
"SetStreamerElementNumber",
"Element name %s", elem->
GetName());
2051 TJSONStackObj *stack =
Stack();
2053 Error(
"WorkWithElement",
"stack is empty");
2058 Info(
"WorkWithElement",
" Start element %s type %d typename %s", elem ? elem->
GetName() :
"---",
2061 if (stack->IsStreamerElement()) {
2066 Info(
"WorkWithElement",
" Perform post-processing elem: %s", stack->fElem->GetName());
2076 Error(
"WorkWithElement",
"Lost of stack");
2081 if (!stack->IsStreamerInfo()) {
2082 Error(
"WorkWithElement",
"Problem in Inc/Dec level");
2089 Error(
"WorkWithElement",
"streamer info returns elem = 0");
2097 stack->fIsElemOwner = (number < 0);
2106 stack->fIndx = std::make_unique<TArrayIndexProducer>(elem, -1,
fArraySepar.
Data());
2114 stack->PushIntValue(stack->IsJsonString() || (stack->IsJsonArray() > 0) ? 1 : 0);
2184 if (!
name || (strlen(
name) == 0)) {
2185 Error(
"ClassMember",
"Invalid member name");
2193 if (strcmp(typeName,
"raw:data") == 0)
2203 if (strcmp(
name, typeName) == 0) {
2211 if (tname[tname.
Length() - 1] ==
'*') {
2217 Error(
"ClassMember",
"Invalid class specifier %s", typeName);
2241 }
else if ((typ_id > 0) && (typ_id < 20)) {
2257 Error(
"ClassMember",
"Invalid combination name = %s type = %s",
name, typeName);
2277 if (stack->fIsPostProcessed)
2282 if (!elem && !obj_cl)
2285 stack->fIsPostProcessed =
kTRUE;
2288 if (stack->fIsObjStarted) {
2309 isTArray = (strncmp(
"TArray", typname, 6) == 0);
2312 if (isTString || isSTLstring) {
2316 Info(
"PerformPostProcessing",
"reformat string value = '%s'",
fValue.
Data());
2318 stack->fValues.clear();
2319 }
else if (isOffsetPArray) {
2322 if (stack->fValues.empty() && (
fValue ==
"0")) {
2324 }
else if ((stack->fValues.size() == 1) && (stack->fValues[0] ==
"1")) {
2325 stack->fValues.clear();
2327 Error(
"PerformPostProcessing",
"Wrong values for kOffsetP element %s", (elem ? elem->
GetName() :
"---"));
2328 stack->fValues.clear();
2331 }
else if (isTObject || isTRef) {
2340 if (cnt < 2 || cnt > 3) {
2342 Error(
"PerformPostProcessing",
"When storing TObject/TRef, strange number of items %d",
cnt);
2343 AppendOutput(stack->NextMemberSeparator(),
"\"dummy\"");
2346 AppendOutput(stack->NextMemberSeparator(),
"\"fUniqueID\"");
2349 AppendOutput(stack->NextMemberSeparator(),
"\"fBits\"");
2353 AppendOutput(stack->NextMemberSeparator(),
"\"fPID\"");
2358 stack->fValues.clear();
2363 }
else if (isTArray) {
2365 stack->fValues.clear();
2373 if (!stack->fValues.empty()) {
2376 for (
auto &blob: stack->fValues) {
2389 if (!stack->fValues.empty())
2418 if (!cl &&
Stack()->fClVersion) {
2419 res =
Stack()->fClVersion;
2420 Stack()->fClVersion = 0;
2424 Info(
"ReadVersion",
"Result: %d Class: %s", res, (cl ? cl->
GetName() :
"---"));
2443 Info(
"ReadObjectAny",
"From current JSON node");
2459 Info(
"WriteObjectClass",
"Class %s", (actualClass ? actualClass->
GetName() :
" null"));
2580template <
typename T>
2583 Info(
"ReadArray",
"Not implemented");
2584 return value ? 1 : 0;
2694template <
typename T>
2697 if (!arr || (arrsize <= 0))
2699 nlohmann::json *json =
Stack()->fNode;
2701 Info(
"ReadFastArray",
"Reading array sz %d from JSON %s", arrsize, json->dump().substr(0, 30).c_str());
2702 auto indexes =
Stack()->MakeReadIndexes();
2704 TArrayI &indx = indexes->GetIndices();
2706 if (indexes->TotalLength() != arrsize)
2707 Error(
"ReadFastArray",
"Mismatch %d-dim array sizes %d %d", lastdim + 1, arrsize, (
int)indexes->TotalLength());
2708 for (
int cnt = 0;
cnt < arrsize; ++
cnt) {
2709 nlohmann::json *elem = &(json->at(indx[0]));
2710 for (
int k = 1; k < lastdim; ++k)
2711 elem = &((*elem)[indx[k]]);
2712 arr[
cnt] = asstring ? elem->get<std::string>()[indx[lastdim]] : (*elem)[indx[lastdim]].get<
T>();
2713 indexes->NextSeparator();
2715 }
else if (asstring) {
2716 std::string str = json->get<std::string>();
2718 arr[
cnt] = (
cnt < (
int)str.length()) ? str[
cnt] : 0;
2719 }
else if (json->is_object() && (json->count(
"$arr") == 1)) {
2720 if (json->at(
"len").get<
int>() != arrsize)
2721 Error(
"ReadFastArray",
"Mismatch compressed array size %d %d", arrsize, json->at(
"len").get<
int>());
2725 std::string
idname =
"", pname, vname, nname;
2726 while (p < arrsize) {
2727 pname = std::string(
"p") +
idname;
2728 if (json->count(pname) == 1)
2729 p = json->at(pname).get<
int>();
2730 vname = std::string(
"v") +
idname;
2731 if (json->count(vname) != 1)
2733 nlohmann::json &
v = json->at(vname);
2735 for (
unsigned sub = 0; sub <
v.size(); ++sub)
2736 arr[p++] =
v[sub].get<T>();
2738 nname = std::string(
"n") +
idname;
2739 unsigned ncopy = (json->count(nname) == 1) ? json->at(nname).get<
unsigned>() : 1;
2740 for (
unsigned sub = 0; sub < ncopy; ++sub)
2741 arr[p++] =
v.get<
T>();
2743 idname = std::to_string(++
id);
2746 if ((
int)json->size() != arrsize)
2747 Error(
"ReadFastArray",
"Mismatch array sizes %d %d", arrsize, (
int)json->size());
2749 arr[
cnt] = json->at(
cnt).get<
T>();
2875 Info(
"ReadFastArray",
"void* n:%d cl:%s",
n, cl->
GetName());
2884 int objectSize = cl->
Size();
2885 char *obj = (
char *)start;
2887 TJSONStackObj *stack =
Stack();
2888 nlohmann::json *topnode = stack->fNode, *subnode = topnode;
2890 subnode = stack->fIndx->ExtractNode(topnode);
2892 TArrayIndexProducer indexes(stack->fElem,
n,
"");
2895 Info(
"ReadFastArray",
"Indexes ndim:%d totallen:%d", indexes.NumDimensions(), indexes.TotalLength());
2897 for (
Int_t j = 0; j <
n; j++, obj += objectSize) {
2899 stack->fNode = indexes.ExtractNode(subnode);
2905 stack->fNode = topnode;
2915 Info(
"ReadFastArray",
"void** n:%d cl:%s prealloc:%s",
n, cl->
GetName(), (isPreAlloc ?
"true" :
"false"));
2930 TJSONStackObj *stack =
Stack();
2931 nlohmann::json *topnode = stack->fNode, *subnode = topnode;
2933 subnode = stack->fIndx->ExtractNode(topnode);
2935 TArrayIndexProducer indexes(stack->fElem,
n,
"");
2937 for (
Int_t j = 0; j <
n; j++) {
2939 stack->fNode = indexes.ExtractNode(subnode);
2942 void *old = start[j];
2948 start[j] = (
const_cast<TClass *
>(cl))->New();
2953 stack->fNode = topnode;
2956template <
typename T>
2961 for (
Int_t indx = 0; indx < arrsize; indx++) {
2970 Int_t aindx(0), bindx(arrsize);
2971 while ((aindx < arrsize) && (vname[aindx] == 0))
2973 while ((aindx < bindx) && (vname[bindx - 1] == 0))
2975 if (aindx < bindx) {
2977 Int_t p(aindx), suffixcnt(-1), lastp(0);
2979 if (vname[p] == 0) {
2983 Int_t p0(p++), pp(0), nsame(1);
2989 for (; p <= bindx; ++p) {
2990 if ((p < bindx) && (vname[p] == vname[p - 1])) {
2994 if (vname[p - 1] == 0) {
2999 }
else if (nsame > 5) {
3012 if (++suffixcnt > 0)
3013 suffix.
Form(
"%d", suffixcnt);
3018 if ((nsame > 1) || (pp - p0 == 1)) {
3024 for (
Int_t indx = p0; indx < pp; indx++) {
3159template <
typename T>
3184 (*this.*method)((arr + shift), len, typname);
3190 (*this.*method)(arr, arrsize, typname);
3312 Info(
"WriteFastArray",
"void *start cl:%s n:%d", cl ? cl->
GetName() :
"---",
n);
3326 char *obj = (
char *)start;
3329 int size = cl->
Size();
3333 if (indexes.IsArray()) {
3338 for (
Int_t j = 0; j <
n; j++, obj += size) {
3351 if (indexes.IsArray())
3366 Info(
"WriteFastArray",
"void **startp cl:%s n:%d", cl->
GetName(),
n);
3381 if (indexes.IsArray()) {
3386 for (
Int_t j = 0; j <
n; j++) {
3395 start[j] = (
const_cast<TClass *
>(cl))->New();
3406 if (indexes.IsArray())
3421 Info(
"StreamObject",
"Class: %s", (cl ? cl->
GetName() :
"none"));
3432template <
typename T>
3435 value =
Stack()->GetStlNode()->get<
T>();
3451 if (!
Stack()->fValues.empty())
3486 if (!
Stack()->fValues.empty())
3487 val =
Stack()->PopIntValue();
3537 nlohmann::json *json =
Stack()->GetStlNode();
3538 if (json->is_null())
3539 val = std::numeric_limits<Float_t>::quiet_NaN();
3549 nlohmann::json *json =
Stack()->GetStlNode();
3550 if (json->is_null())
3551 val = std::numeric_limits<Double_t>::quiet_NaN();
3561 Error(
"ReadCharP",
"Not implemented");
3595 std::size_t nch = str.length();
3597 s =
new char[nch + 1];
3598 memcpy(
s, str.c_str(), nch);
3769 snprintf(buf,
sizeof(buf),
"%d", value);
3779 snprintf(buf,
sizeof(buf),
"%hd", value);
3789 snprintf(buf,
sizeof(buf),
"%d", value);
3799 snprintf(buf,
sizeof(buf),
"%ld", value);
3816 if (std::isinf(value)) {
3832 if (std::isinf(value)) {
3857 snprintf(buf,
sizeof(buf),
"%u", value);
3867 snprintf(buf,
sizeof(buf),
"%hu", value);
3877 snprintf(buf,
sizeof(buf),
"%u", value);
3887 snprintf(buf,
sizeof(buf),
"%lu", value);
3913 len = strlen(value);
3929 if ((
c > 31) && (
c < 127))
static RooMathCoreReg dummy
unsigned long long ULong64_t
void Error(const char *location, const char *msgfmt,...)
char * Form(const char *fmt,...)
Array of integers (32 bits per element).
void Set(Int_t n)
Set size of this array to n ints.
Abstract array base class.
virtual void GetMappedObject(UInt_t tag, void *&ptr, TClass *&ClassPtr) const
Retrieve the object stored in the buffer's object map at 'tag' Set ptr and ClassPtr respectively to t...
virtual void MapObject(const TObject *obj, UInt_t offset=1)
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...
virtual Int_t WriteObjectAny(const void *obj, const TClass *ptrClass, Bool_t cacheReuse=kTRUE)
Write object to I/O buffer.
virtual void InitMap()
Create the fMap container and initialize them with the null object.
Class for serializing object to and from JavaScript Object Notation (JSON) format.
virtual void WriteLong64(Long64_t l)
Writes Long64_t value to buffer.
R__ALWAYS_INLINE void JsonWriteArrayCompress(const T *vname, Int_t arrsize, const char *typname)
virtual TClass * ReadClass(const TClass *cl=nullptr, UInt_t *objTag=nullptr)
suppressed function of TBuffer
void JsonWriteBasic(Char_t value)
converts Char_t to string and add to json value buffer
void JsonWriteCollection(TCollection *obj, const TClass *objClass)
store content of ROOT collection
virtual void WriteStdString(const std::string *s)
Writes a std::string.
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
virtual void WriteUShort(UShort_t s)
Writes UShort_t value to buffer.
virtual void WriteUInt(UInt_t i)
Writes UInt_t value to buffer.
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)
read version value from buffer
static TObject * ConvertFromJSON(const char *str)
Read TObject-based class from JSON, produced by ConvertToJSON() method.
virtual void ReadLong(Long_t &l)
Reads Long_t value from buffer.
TString fValue
! buffer for current value
std::deque< TJSONStackObj * > fStack
! hierarchy of currently streamed element
virtual void WriteChar(Char_t c)
Writes Char_t value to buffer.
virtual void ClassBegin(const TClass *, Version_t=-1)
Should be called in the beginning of custom class streamer.
virtual void WriteDouble(Double_t d)
Writes Double_t value to 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...
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)
Ignored in TBufferJSON.
void PerformPostProcessing(TJSONStackObj *stack, const TClass *obj_cl=nullptr)
Function is converts TObject and TString structures to more compact representation.
virtual void ReadUInt(UInt_t &i)
Reads UInt_t value from buffer.
virtual void WriteInt(Int_t i)
Writes Int_t value to buffer.
virtual void ReadFastArrayString(Char_t *c, Int_t n)
read array of Char_t from buffer
virtual void ReadShort(Short_t &s)
Reads Short_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...
R__ALWAYS_INLINE Int_t JsonReadArray(T *value)
Read static array from JSON - not used.
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
virtual Int_t ReadArray(Bool_t *&b)
Read array of Bool_t 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...
virtual void ReadDouble(Double_t &d)
Reads Double_t value from buffer.
virtual void ReadLong64(Long64_t &l)
Reads Long64_t value from 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 JsonReadCollection(TCollection *obj, const TClass *objClass)
read content of ROOT collection
virtual void ReadStdString(std::string *s)
Reads a std::string.
virtual ~TBufferJSON()
destroy buffer
virtual void ReadUChar(UChar_t &c)
Reads UChar_t value from buffer.
void JsonPushValue()
If value exists, push in the current stack for post-processing.
virtual void ReadCharP(Char_t *c)
Reads array of characters from buffer.
virtual void ReadFastArray(Bool_t *b, Int_t n)
read array of Bool_t from buffer
virtual void ReadULong64(ULong64_t &l)
Reads ULong64_t value from buffer.
void SetTypenameTag(const char *tag="_typename")
Configures _typename tag in JSON structures By default "_typename" field in JSON structures used to s...
virtual void ReadInt(Int_t &i)
Reads Int_t value from buffer.
void JsonStartElement(const TStreamerElement *elem, const TClass *base_class)
Start new class member in JSON structures.
virtual void WriteULong64(ULong64_t l)
Writes ULong64_t value to buffer.
virtual void WriteTString(const TString &s)
Writes a TString.
Bool_t IsSkipClassInfo(const TClass *cl) const
Returns true if class info will be skipped from JSON.
virtual void WriteUChar(UChar_t c)
Writes UChar_t value to buffer.
virtual void WriteClass(const TClass *cl)
suppressed function of TBuffer
virtual void ReadBool(Bool_t &b)
Reads Bool_t value from buffer.
TString * fOutput
! current output buffer for json code
virtual void StreamObject(void *obj, const TClass *cl, const TClass *onFileClass=nullptr)
stream object to/from buffer
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, produced by ConvertToJSON() method.
@ kNoSpaces
no new lines plus remove all spaces around "," and ":" symbols
@ kMapAsObject
store std::map, std::unodered_map as JSON object
@ kSameSuppression
zero suppression plus compress many similar values together
virtual void ReadUShort(UShort_t &s)
Reads UShort_t value from 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...
TObjArray * fSkipClasses
! list of classes, which class info is not stored
virtual void ClassEnd(const TClass *)
Should be called at the end of custom streamer See TBufferJSON::ClassBegin for more details.
virtual void ReadBaseClass(void *start, TStreamerBase *elem)
Read data of base class.
virtual void ReadTString(TString &s)
Reads a TString.
static void * ConvertFromJSONChecked(const char *str, const TClass *expectedClass)
Read objects from JSON, one can reuse existing object.
virtual void WriteCharStar(char *s)
Writes a char*.
virtual void WriteULong(ULong_t l)
Writes ULong_t value to buffer.
virtual void WriteBool(Bool_t b)
Writes Bool_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.
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 ReadChar(Char_t &c)
Reads Char_t value from buffer.
TString fArraySepar
! depending from compression level, ", " or ","
R__ALWAYS_INLINE void JsonReadFastArray(T *arr, Int_t arrsize, bool asstring=false)
Template method to read array from the JSON.
void SetSkipClassInfo(const TClass *cl)
Specify class which typename will not be stored in JSON Several classes can be configured To exclude ...
virtual void DecrementLevel(TVirtualStreamerInfo *)
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and decrease level in json...
virtual void WriteCharP(const Char_t *c)
Writes array of characters to buffer.
virtual void WriteFastArray(const Bool_t *b, Int_t n)
Write array of Bool_t to buffer.
virtual void WriteFastArrayString(const Char_t *c, Int_t n)
Write array of Char_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
virtual void WriteArray(const Bool_t *b, Int_t n)
Write array of Bool_t to buffer.
virtual void ReadFloat(Float_t &f)
Reads Float_t value from buffer.
virtual void ReadCharStar(char *&s)
Reads a char* string.
TJSONStackObj * JsonStartObjectWrite(const TClass *obj_class, TStreamerInfo *info=nullptr)
Start object element with typeinfo.
virtual void ReadULong(ULong_t &l)
Reads ULong_t value from buffer.
Int_t JsonSpecialClass(const TClass *cl) const
return non-zero value when class has special handling in JSON it is TCollection (-130),...
virtual Int_t ReadStaticArray(Bool_t *b)
Read array of Bool_t from buffer.
virtual void WriteObjectClass(const void *actualObjStart, const TClass *actualClass, Bool_t cacheReuse)
Write object to buffer. Only used from TBuffer.
void SetCompact(int level)
Set level of space/newline/array compression Lower digit of compact parameter define formatting rules...
virtual void WriteShort(Short_t s)
Writes Short_t value to buffer.
Bool_t fMapAsObject
! when true, std::map will be converted into JSON object
virtual void * ReadObjectAny(const TClass *clCast)
Read object from buffer. Only used from TBuffer.
void JsonWriteConstChar(const char *value, Int_t len=-1, const char *=nullptr)
writes string value, processing all kind of special characters
virtual void IncrementLevel(TVirtualStreamerInfo *)
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and indent new level in js...
void JsonReadTObjectMembers(TObject *obj, void *node=nullptr)
virtual TVirtualStreamerInfo * GetInfo()
Return current streamer info element.
virtual void SetStreamerElementNumber(TStreamerElement *elem, Int_t comp_type)
Function is called from TStreamerInfo WriteBuffer and ReadBuffer functions and add/verify next elemen...
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 SkipObjectAny()
Skip any kind of object from buffer.
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.
virtual void WriteFloat(Float_t f)
Writes Float_t value to buffer.
R__ALWAYS_INLINE void JsonReadBasic(T &value)
Template function to read basic value from JSON.
virtual void WriteLong(Long_t l)
Writes Long_t value to buffer.
Base class for text-based streamers like TBufferJSON or TBufferXML Special actions list will use meth...
static const char * ConvertFloat(Float_t v, char *buf, unsigned len, Bool_t not_optimize=kFALSE)
convert float to string with configured format
static const char * ConvertDouble(Double_t v, char *buf, unsigned len, Bool_t not_optimize=kFALSE)
convert float to string with configured format
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.
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
TList * GetListOfRealData() const
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=0, bool isDerivedObject=true)
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
void Streamer(void *obj, TBuffer &b, const TClass *onfile_class=0) const
Version_t GetClassVersion() const
TClass * GetActualClass(const void *object) const
Return a pointer the the real class of the object.
TRealData * GetRealData(const char *name) const
Return pointer to TRealData element with name "name".
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.
TClass * GetClass() const
void SetClass(const char *classname, Int_t size=1000)
see TClonesArray::SetClass(const TClass*)
TObject * ConstructedAt(Int_t idx)
Get an object at index 'idx' that is guaranteed to have been constructed.
Collection abstract base class.
virtual const char * GetName() const
Return name of this collection.
void SetName(const char *name)
virtual void Add(TObject *obj)=0
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
All ROOT classes may have RTTI (run time type identification) support added.
Int_t GetMaxIndex(Int_t dim) const
Return maximum index for array dimension "dim".
const char * GetTrueTypeName() const
Get full type description of data member, e,g.: "class TDirectory*".
Int_t GetArrayDim() const
Return number of array dimensions.
Int_t GetUnitSize() const
Get the sizeof the underlying type of the data member (i.e.
Bool_t IsBasic() const
Return true if data member is a basic type, e.g. char, int, long...
Int_t IsSTLContainer()
The return type is defined in TDictionary (kVector, kList, etc.)
Bool_t IsaPointer() const
Return true if data member is a pointer.
TDataType * GetDataType() const
const char * GetTypeName() const
Get type of data member, e,g.: "class TDirectory*" -> "TDirectory".
const char * GetArrayIndex() const
If the data member is pointer and has a valid array size in its comments GetArrayIndex returns a stri...
Basic data type descriptor (datatype information is obtained from CINT).
Option_t * GetOption() const
virtual void Add(TObject *obj)
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
void Add(TObject *obj)
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.
virtual const char * GetName() const
Returns name of object.
Int_t IndexOf(const TObject *obj) const
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Mother of all ROOT objects.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
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 SetUniqueID(UInt_t uid)
Set the unique object id.
@ kMustCleanup
if object destructor must call RecursiveRemove()
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.
TDataMember * GetDataMember() const
Long_t GetThisOffset() const
virtual TClass * GetClassPointer() const
Returns a pointer to the TClass of this element.
virtual TClass * GetClassPointer() const
Returns a pointer to the TClass of this element.
virtual void SetArrayDim(Int_t dim)
Set number of array dimensions.
Int_t GetArrayDim() const
Int_t GetArrayLength() const
Int_t GetMaxIndex(Int_t i) const
const char * GetTypeName() const
virtual Bool_t IsBase() const
Return kTRUE if the element represent a base class.
virtual void SetMaxIndex(Int_t dim, Int_t max)
set maximum index for array with dimension dim
Describe Streamer information for one class version.
TObjArray * GetElements() const
TClass * GetClass() const
Int_t GetClassVersion() const
Int_t Atoi() const
Return integer value of string.
void Clear()
Clear string without changing its capacity.
TString & Replace(Ssiz_t pos, Ssiz_t n, const char *s)
const char * Data() const
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
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.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Abstract Interface class describing Streamer information for one class.
static Bool_t CanDelete()
static function returning true if ReadBuffer can delete object
virtual TClass * GetClass() const =0
bool IsStdClass(const char *type)
return true if the class belongs to the std namespace
static constexpr double s