122 std::string nnn = objname;
127 while ((pos = nnn.find_first_of(
"- []<>#:&?/\'\"\\")) != std::string::npos)
128 nnn.replace(pos, 1,
"_");
130 itemname = nnn.c_str();
134 itemname.
Form(
"%s_%d", nnn.c_str(), cnt++);
242 fStore->
Error(
"SetResult",
"When member specified, pointer on object (not member) should be provided; use SetFoundResult");
315 if ((obj != 0) && (obj_name == 0)) obj_name = obj->
GetName();
318 if ((obj_name == 0) || (*obj_name == 0))
return kFALSE;
320 const char *full_name = 0;
324 const char *
slash = strrchr(obj_name,
'/');
326 full_name = obj_name;
327 obj_name = slash + 1;
328 if (*obj_name == 0) obj_name =
"file";
364 while (*separ ==
'/') {
377 if (!isslash)
return kFALSE;
384 if ((obj_name != 0) && (
fItemName != obj_name))
421 fObjectsPath(objpath),
425 fScanGlobalDir(
kTRUE),
428 fCurrentAllowedMethods(0),
432 fRestrictions.SetOwner(
kTRUE);
460 fCurrentRestrict = 0;
461 fCurrentAllowedMethods =
"";
483 const char* rslash = strrchr(path,
'/');
484 if (rslash) rslash++;
485 if ((rslash==0) || (*rslash==0)) rslash = path;
497 fAutoLoad = scripts!=0 ? scripts :
"";
505 return fAutoLoad.Length() > 0 ? fAutoLoad.Data() : 0;
514 if ((item_name==0) || (*item_name==0) || (fCurrentArg==0))
return kFALSE;
516 return fRestrictions.FindObject(item_name)!=0;
526 const char* username = fCurrentArg ? fCurrentArg->GetUserName() : 0;
528 if ((username==0) || (option == 0) || (*option==0))
return 0;
530 if (strcmp(option,
"all") == 0)
return 1;
532 if (strcmp(username, option) == 0)
return 2;
534 if (strstr(option, username) == 0)
return -1;
542 return find ? 2 : -1;
556 if ((full_item_name==0) || (*full_item_name==0))
return 0;
558 const char* item_name = strrchr(full_item_name,
'/');
559 if (item_name) item_name++;
560 if ((item_name==0) || (*item_name==0)) item_name = full_item_name;
565 const char* options = 0;
566 TIter iter(&fRestrictions);
569 while ((obj = iter()) != 0) {
570 const char* title = obj->
GetTitle();
572 if (strstr(title,pattern1.
Data())==title) { options = title + pattern1.
Length();
break; }
573 if (strstr(title,pattern2.
Data())==title) { options = title + pattern2.
Length();
break; }
576 if (options==0)
return 0;
588 if (can_access > 0)
return 2;
589 if (can_see < 0)
return -1;
592 if (methods!=0) fCurrentAllowedMethods = methods;
594 if (can_access < 0)
return 1;
605 if ((cl == 0) || (ptr == 0) || rec.
Done())
return;
613 while ((obj = iter()) != 0) {
615 if ((rdata == 0) || strchr(rdata->
GetName(),
'.'))
continue;
622 if (member->
IsaPointer()) member_ptr = *((
char **) member_ptr);
626 if (chld.
GoInside(rec, member, 0,
this)) {
632 if (coll_offset >= 0) {
639 const char *title = member->
GetTitle();
640 if ((title != 0) && (strlen(title) != 0))
668 if (coll_offset >= 0) {
670 ScanCollection(chld, (
TCollection *)(member_ptr + coll_offset));
690 TClass* cl = obj ? obj->IsA() : 0;
698 const char* pos = strstr(cl ? cl->
GetTitle() :
"",
"*SNIFF*");
703 if (*pos ==
' ') { pos++;
continue; }
705 const char* pos0 = pos;
706 while ((*pos != 0) && (*pos !=
'=')) pos++;
707 if (*pos == 0)
return;
710 Bool_t quotes = (*pos ==
'\"');
714 while ((*pos != 0) && (*pos != (quotes ?
'\"' :
' '))) pos++;
729 ScanCollection(rec, ((
TFolder *) obj)->GetListOfFolders());
735 rec.
SetField(
"_player",
"JSROOT.drawTreePlayer");
738 ScanCollection(rec, ((
TTree *) obj)->GetListOfLeaves());
740 ScanCollection(rec, ((
TBranch *) obj)->GetListOfLeaves());
742 ScanObjectMembers(rec, obj->IsA(), (
char *) obj);
752 if (((lst == 0) || (lst->
GetSize() == 0)) && ((keys_lst == 0) || (keys_lst->
GetSize() == 0)))
return;
756 if (!folderrec.
GoInside(rec, 0, foldername,
this))
return;
767 if (IsItemField(next)) {
779 if (!chld.
GoInside(master, obj, 0,
this)) { next = iter();
continue; }
781 if (chld.
SetResult(obj, obj->IsA()))
return;
785 ScanObjectProperties(chld, obj);
787 while ((next = iter()) != 0) {
788 if (!IsItemField(next))
break;
800 ScanObjectChilds(chld, obj);
802 if (chld.
SetResult(obj, obj->IsA()))
return;
807 TIter iter(keys_lst);
810 while ((kobj = iter()) != 0) {
811 TKey *key =
dynamic_cast<TKey *
>(kobj);
812 if (key == 0)
continue;
823 if (obj == 0) { obj = key; iskey =
kTRUE; }
828 if (chld.
GoInside(master, obj, fullname.
Data(),
this)) {
833 if (chld.
SetResult(keyobj, keyobj->IsA()))
return;
836 if (chld.
SetResult(obj, obj->IsA()))
return;
838 TClass *obj_class = obj->IsA();
840 ScanObjectProperties(chld, obj);
847 if (strcmp(key->
GetClassName(),
"TDirectoryFile") == 0) {
852 obj_class = dir->IsA();
864 if (obj) obj_class = obj->IsA();
866 rec.
SetField(
"_player",
"JSROOT.drawTreePlayerKey");
876 ScanObjectChilds(chld, obj);
879 if (chld.
SetResult(obj, obj_class))
return;
896 if (fCurrentArg && fCurrentArg->GetUserName())
908 if (chld.
GoInside(rec, 0,
"StreamerInfo",
this)) {
912 chld.
SetField(
"_after_request",
"JSROOT.MarkAsStreamerInfo");
916 if (IsScanGlobalDir()) {
917 ScanCollection(rec,
gROOT->GetList());
919 ScanCollection(rec,
gROOT->GetListOfCanvases(),
"Canvases");
921 ScanCollection(rec,
gROOT->GetListOfFiles(),
"Files");
930 if (cl == 0)
return kFALSE;
962 if ((rec.
fSearchPath == 0) && (GetAutoLoad() != 0))
981 if (IsStreamerInfoItem(path)) {
984 if (cl && fSinfo) *cl = fSinfo->IsA();
1002 if ((res_member!=0) && (res_cl!=0) && (member==0)) {
1008 if (res_member->
IsaPointer()) res = *((
char **) res);
1014 if (cl) *cl = res_cl;
1015 if (member) *member = res_member;
1031 void *obj = FindInHierarchy(path, &cl);
1042 return fSinfo ? fSinfo->GetSize() : 0;
1051 if (IsStreamerInfoItem(itemname))
return GetStreamerInfoHash();
1053 TObject *obj = FindTObjectInHierarchy(itemname);
1055 return obj == 0 ? 0 :
TString::Hash(obj, obj->IsA()->Size());
1064 void *res = FindInHierarchy(path, &obj_cl);
1065 return (res != 0) && IsDrawableClass(obj_cl);
1076 void *res = FindInHierarchy(path, &obj_cl, 0, &obj_chld);
1077 return (res != 0) && (obj_chld > 0);
1087 if (fMemFile != 0)
return;
1094 fMemFile =
new TMemFile(
"dummy.file",
"RECREATE");
1095 gROOT->GetListOfFiles()->Remove(fMemFile);
1097 TH1F *d =
new TH1F(
"d",
"d", 10, 0, 10);
1098 fMemFile->WriteObject(d,
"h1");
1104 fMemFile->WriteObject(gr,
"gr1");
1107 fMemFile->WriteStreamerInfo();
1112 l->
Add(
gROOT->GetListOfStreamerInfo()->FindObject(
"TGraph"));
1113 l->
Add(
gROOT->GetListOfStreamerInfo()->FindObject(
"TH1F"));
1114 l->
Add(
gROOT->GetListOfStreamerInfo()->FindObject(
"TH1"));
1115 l->
Add(
gROOT->GetListOfStreamerInfo()->FindObject(
"TNamed"));
1116 l->
Add(
gROOT->GetListOfStreamerInfo()->FindObject(
"TObject"));
1118 fMemFile->WriteObject(l,
"ll");
1121 fMemFile->WriteStreamerInfo();
1123 fSinfo = fMemFile->GetStreamerInfoList();
1136 if ((path == 0) || (*path == 0))
return kFALSE;
1138 if (*path ==
'/') path++;
1149 void *obj_ptr = FindInHierarchy(path, &obj_cl, &member);
1150 if ((obj_ptr == 0) || ((obj_cl == 0) && (member == 0)))
return kFALSE;
1167 if ((kind == 0) || (strcmp(kind,
"Command") != 0)) {
1168 if (
gDebug > 0)
Info(
"ExecuteCmd",
"Entry %s is not a command", path);
1173 const char *cmethod = GetItemField(parent, obj,
"method");
1174 if ((cmethod==0) || (strlen(cmethod)==0)) {
1175 if (
gDebug > 0)
Info(
"ExecuteCmd",
"Entry %s do not defines method for execution", path);
1181 if (fRestrictions.GetLast()>=0) {
1182 FindInHierarchy(path);
1183 if (fCurrentRestrict==1) {
1184 if (
gDebug > 0)
Info(
"ExecuteCmd",
"Entry %s not allowed for specified user", path);
1192 const char *cnumargs = GetItemField(parent, obj,
"_numargs");
1203 if (
gDebug > 0)
Info(
"ExecuteCmd",
"For command %s argument %s not specified in options %s", path, argname.
Data(), options);
1208 TString svalue = DecodeUrlOptionValue(argvalue,
kTRUE);
1214 if (
gDebug > 0)
Info(
"ExecuteCmd",
"Executing command %s method:%s", path, method.
Data());
1219 if (method.
Index(
"this->") == 0) {
1224 if (separ !=
kNPOS) {
1225 item_obj = FindTObjectInHierarchy(
TString(method.
Data(), separ).
Data());
1228 if (item_obj != 0) {
1229 method =
TString::Format(
"((%s*)%lu)->%s", item_obj->ClassName(), (
long unsigned) item_obj, method.
Data() + separ + 3);
1230 if (
gDebug > 2)
Info(
"ExecuteCmd",
"Executing %s", method.
Data());
1248 ScanHierarchy(
"top", path, &store,
kTRUE);
1251 ScanHierarchy(
"top", path, &store,
kTRUE);
1264 if ((path == 0) || (*path == 0))
return kFALSE;
1266 if (*path ==
'/') path++;
1269 void *obj_ptr = FindInHierarchy(path, &obj_cl);
1270 if ((obj_ptr == 0) || (obj_cl == 0))
return kFALSE;
1282 if ((value == 0) || (strlen(value) == 0))
return TString();
1295 if (remove_quotes && (res.
Length() > 1) &&
1296 ((res[0] ==
'\'') || (res[0] ==
'\"')) && (res[0] == res[res.
Length() - 1])) {
1314 if ((path == 0) || (*path == 0)) {
1315 if (debug) debug->
Append(
"Item name not specified\n");
1319 if (*path ==
'/') path++;
1322 void *obj_ptr = FindInHierarchy(path, &obj_cl);
1324 if ((obj_ptr == 0) || (obj_cl == 0))
return debug != 0;
1334 if (method_name != 0) {
1335 if (prototype.
Length() == 0) {
1339 if (debug) debug->
Append(
TString::Format(
"Search for method \'%s\' with prototype \'%s\'\n", method_name, prototype.
Data()));
1347 if (funcname.Length() > 0) {
1348 if (prototype.
Length() == 0) {
1349 if (debug) debug->
Append(
TString::Format(
"Search for any function with name \'%s\'\n", funcname.Data()));
1350 func =
gROOT->GetGlobalFunction(funcname);
1352 if (debug) debug->
Append(
TString::Format(
"Search for function \'%s\' with prototype \'%s\'\n", funcname.Data(), prototype.
Data()));
1353 func =
gROOT->GetGlobalFunctionWithPrototype(funcname, prototype);
1362 if ((method == 0) && (func==0)) {
1363 if (debug) debug->
Append(
"Method not found\n");
1367 if ((fReadOnly && (fCurrentRestrict == 0)) || (fCurrentRestrict == 1)) {
1368 if ((method!=0) && (fCurrentAllowedMethods.Index(method_name) ==
kNPOS)) {
1369 if (debug) debug->
Append(
"Server runs in read-only mode, method cannot be executed\n");
1372 if ((func!=0) && (fCurrentAllowedMethods.Index(funcname) ==
kNPOS)) {
1373 if (debug) debug->
Append(
"Server runs in read-only mode, function cannot be executed\n");
1376 if (debug) debug->
Append(
"For that special method server allows access even read-only mode is specified\n");
1391 if ((strcmp(arg->
GetName(),
"rest_url_opt") == 0) &&
1395 const char *pos = strstr(options,
"method=");
1396 if ((pos == 0) || (strlen(pos) < strlen(method_name) + 8))
return debug != 0;
1397 call_args.
Form(
"\"%s\"", pos + strlen(method_name) + 8);
1404 sval = DecodeUrlOptionValue(val,
kFALSE);
1408 if ((val!=0) && (strcmp(val,
"_this_")==0)) {
1410 sval.
Form(
"(%s*)0x%lx", obj_cl->
GetName(), (
long unsigned) obj_ptr);
1413 if ((val!=0) && (fCurrentArg!=0) && (fCurrentArg->GetPostData()!=0)) {
1415 if (strcmp(val,
"_post_object_xml_")==0) {
1418 if (post_obj == 0) {
1421 sval.
Form(
"(%s*)0x%lx", post_obj->
ClassName(), (
long unsigned) post_obj);
1422 if (url.
HasOption(
"_destroy_post_")) garbage.
Add(post_obj);
1426 if ((strcmp(val,
"_post_object_")==0) && url.
HasOption(
"_post_class_")) {
1437 post_obj->Streamer(buf);
1438 if (url.
HasOption(
"_destroy_post_")) garbage.
Add(post_obj);
1441 sval.
Form(
"(%s*)0x%lx", clname.
Data(), (
long unsigned) post_obj);
1444 if (strcmp(val,
"_post_data_")==0) {
1445 sval.
Form(
"(void*)0x%lx", (
long unsigned) *res_ptr);
1448 if (strcmp(val,
"_post_length_")==0) {
1449 sval.
Form(
"%ld", (
long) *res_length);
1457 if (val == 0)
return debug != 0;
1459 if (call_args.
Length() > 0) call_args +=
", ";
1462 int len = strlen(val);
1463 if ((strlen(val) < 2) || (*val !=
'\"') || (val[len - 1] !=
'\"'))
1486 if (debug) debug->
Append(
"Fail: invalid TMethodCall\n");
1500 garbage.
Add(resbuf);
1511 else res.
Form(
"%ld", l);
1532 else res.
Form(
"\"%s\"", txt);
1538 if ((ret_kind.length() > 0) && (ret_kind[ret_kind.length() - 1] ==
'*')) {
1539 ret_kind.resize(ret_kind.length() - 1);
1549 if (l != 0) ret_obj = (
void *) l;
1569 if (_ret_object_ != 0) {
1572 if (debug) debug->
Append(
TString::Format(
"Return object %s found %s\n", _ret_object_, obj ?
"true" :
"false"));
1578 ret_cl = obj->IsA();
1582 if ((ret_obj != 0) && (ret_cl != 0)) {
1586 obj->Streamer(*resbuf);
1587 if (fCurrentArg) fCurrentArg->SetExtraHeader(
"RootClassName", ret_cl->
GetName());
1593 if ((resbuf != 0) && (resbuf->
Length() > 0) && (res_ptr != 0) && (res_length != 0)) {
1596 *res_length = resbuf->
Length();
1601 if ((reskind == 1) && res_str) *res_str = res;
1603 if (url.
HasOption(
"_destroy_result_") && (ret_obj != 0) && (ret_cl != 0)) {
1605 if (debug) debug->
Append(
"Destroy result object at the end\n");
1630 if ((fCurrentArg==0) || (fCurrentArg->GetPostDataLength()<=0) || (fCurrentArg->GetPostData()==0))
return kFALSE;
1632 const char* args = (
const char*) fCurrentArg->GetPostData();
1633 const char* ends = args + fCurrentArg->GetPostDataLength();
1643 std::vector<void*> mem;
1644 std::vector<Long_t> memlen;
1646 if (asjson) str =
"[";
1649 const char* next = args;
1650 while ((next < ends) && (*next !=
'\n')) next++;
1652 Error(
"ProduceMulti",
"Not enough arguments in POST block");
1656 TString file1(args, next - args);
1664 opt1 = file1(pos+1, file1.
Length() - pos);
1669 pos = file1.
Last(
'/');
1671 path1 = file1(0, pos);
1675 if ((path!=0) && (*path!=0)) path1 =
TString(path) +
"/" + path1;
1682 Produce(path1, file1, opt1, ptr1, len1, str1);
1686 if (ptr1!=0) { str.
Append(
"\"<non-supported binary>\"");
free(ptr1); }
else 1689 if ((str1.
Length()>0) && (ptr1==0)) {
1692 memcpy(ptr1, str1.
Data(), len1);
1694 mem.push_back(ptr1);
1695 memlen.push_back(len1);
1703 for (
unsigned n=0;
n<mem.size();
n++) {
1704 length += 4 + memlen[
n];
1707 char* curr = (
char*) ptr;
1708 for (
unsigned n=0;
n<mem.size();
n++) {
1710 *curr++ = (char) (l & 0xff); l = l >> 8;
1711 *curr++ = (char) (l & 0xff); l = l >> 8;
1712 *curr++ = (char) (l & 0xff); l = l >> 8;
1713 *curr++ = (char) (l & 0xff);
1714 if ((mem[
n]!=0) && (memlen[
n]>0)) memcpy(curr, mem[
n], memlen[n]);
1719 for (
unsigned n=0;
n<mem.size();
n++)
free(mem[
n]);
1730 if ((itemname == 0) || (*itemname == 0))
return kFALSE;
1732 return (strcmp(itemname,
"StreamerInfo") == 0) || (strcmp(itemname,
"StreamerInfo/") == 0);
1742 if ((path == 0) || (*path == 0))
return kFALSE;
1744 if (*path ==
'/') path++;
1747 void *obj_ptr = FindInHierarchy(path, &obj_cl);
1748 if ((obj_ptr == 0) || (obj_cl == 0))
return kFALSE;
1751 Info(
"ProduceBinary",
"Non-TObject class not supported");
1768 obj->Streamer(*sbuf);
1769 if (fCurrentArg) fCurrentArg->SetExtraHeader(
"RootClassName", obj_cl->
GetName());
1773 fMemFile->WriteStreamerInfo();
1774 fSinfo = fMemFile->GetStreamerInfoList();
1808 const char *options,
void *&ptr,
1814 if ((path == 0) || (*path == 0))
return kFALSE;
1815 if (*path ==
'/') path++;
1818 void *obj_ptr = FindInHierarchy(path, &obj_cl);
1819 if ((obj_ptr == 0) || (obj_cl == 0))
return kFALSE;
1822 Error(
"TRootSniffer",
"Only derived from TObject classes can be drawn");
1829 if (img == 0)
return kFALSE;
1834 Info(
"TRootSniffer",
"Crate IMAGE directly from pad");
1836 }
else if (IsDrawableClass(obj->IsA())) {
1839 Info(
"TRootSniffer",
"Crate IMAGE from object %s", obj->
GetName());
1841 Int_t width(300), height(200);
1844 if ((options != 0) && (*options != 0)) {
1849 if (w > 10) width = w;
1851 if (h > 10) height =
h;
1853 if (opt != 0) drawopt = opt;
1861 TCanvas *
c1 =
new TCanvas(
"__online_draw_canvas__",
"title", width, height);
1877 char *png_buffer(0);
1882 if ((png_buffer != 0) && (size > 0)) {
1885 memcpy(ptr, png_buffer, length);
1888 delete [] png_buffer;
1912 const char *options,
void *&ptr,
Long_t &length,
TString &str)
1914 if ((file == 0) || (*file == 0))
return kFALSE;
1916 if (strcmp(file,
"root.bin") == 0)
1917 return ProduceBinary(path, options, ptr, length);
1919 if (strcmp(file,
"root.png") == 0)
1920 return ProduceImage(
TImage::kPng, path, options, ptr, length);
1922 if (strcmp(file,
"root.jpeg") == 0)
1923 return ProduceImage(
TImage::kJpeg, path, options, ptr, length);
1925 if (strcmp(file,
"root.gif") == 0)
1926 return ProduceImage(
TImage::kGif, path, options, ptr, length);
1928 if (strcmp(file,
"exe.bin") == 0)
1929 return ProduceExe(path, options, 2, 0, &ptr, &length);
1931 if (strcmp(file,
"root.xml") == 0)
1932 return ProduceXml(path, options, str);
1934 if (strcmp(file,
"root.json") == 0)
1935 return ProduceJson(path, options, str);
1938 if (strcmp(file,
"exe.txt") == 0)
1939 return ProduceExe(path, options, 0, &str);
1941 if (strcmp(file,
"exe.json") == 0)
1942 return ProduceExe(path, options, 1, &str);
1944 if (strcmp(file,
"cmd.json") == 0)
1945 return ExecuteCmd(path, options, str);
1947 if (strcmp(file,
"item.json") == 0)
1948 return ProduceItem(path, options, str,
kTRUE);
1950 if (strcmp(file,
"item.xml") == 0)
1951 return ProduceItem(path, options, str,
kFALSE);
1953 if (strcmp(file,
"multi.bin") == 0)
1954 return ProduceMulti(path, options, ptr, length, str,
kFALSE);
1956 if (strcmp(file,
"multi.json") == 0)
1957 return ProduceMulti(path, options, ptr, length, str,
kTRUE);
1970 Error(
"RegisterObject",
"Not found top ROOT folder!!!");
1975 if (httpfold == 0) {
1976 if (!force)
return 0;
1977 httpfold = topf->
AddFolder(
"http",
"ROOT http server");
1980 gROOT->GetListOfCleanups()->Add(httpfold);
1986 if (fullname==0)
return httpfold;
1990 if (within_objects && ((path.
Length()==0) || (path[0]!=
'/')))
1991 path = fObjectsPath +
"/" + path;
1996 while (path.Tokenize(tok,from,
"/")) {
1997 if (tok.
Length()==0)
continue;
2000 if (fold == 0)
return 0;
2003 while ((obj = iter()) != 0) {
2004 if (IsItemField(obj))
continue;
2009 if (!force)
return 0;
2010 obj = fold->
AddFolder(tok,
"sub-folder");
2027 return dynamic_cast<TFolder *
> (GetItem(subfolder, parent, force));
2054 if (f == 0)
return kFALSE;
2070 if (obj == 0)
return kTRUE;
2075 Error(
"UnregisterObject",
"Not found //root/http folder!!!");
2091 if (f == 0)
return kFALSE;
2112 const char *
name,
const char *value,
TNamed **only_get)
2114 if (parent==0)
return kFALSE;
2117 Info(
"SetField",
"Should be special case for top folder, support later");
2126 if (parent == chld) { last_find = find =
kTRUE; }
2128 while ((obj = iter()) != 0) {
2129 if (IsItemField(obj)) {
2130 if (last_find && (obj->GetName()!=0) && !strcmp(name, obj->GetName())) curr = (
TNamed*) obj;
2132 last_find = (obj == chld);
2133 if (last_find) find =
kTRUE;
2134 if (find && !last_find)
break;
2139 if (!find)
return kFALSE;
2147 if (value!=0) { curr->
SetTitle(value); }
2148 else { parent->
Remove(curr);
delete curr; }
2152 curr =
new TNamed(name, value);
2153 curr->
SetBit(kItemField);
2164 Error(
"SetField",
"Fail cast to TList");
2181 if ((fullname==0) || (name==0))
return kFALSE;
2184 TObject *obj = GetItem(fullname, parent);
2186 if ((parent==0) || (obj==0))
return kFALSE;
2193 return AccessField(parent, obj, name, value);
2201 if ((parent==0) || (obj==0) || (name==0))
return 0;
2205 if (!AccessField(parent, obj, name, 0, &field))
return 0;
2207 return field ? field->
GetTitle() : 0;
2216 if (fullname==0)
return 0;
2219 TObject *obj = GetItem(fullname, parent);
2221 return GetItemField(parent, obj, name);
2255 CreateItem(cmdname,
Form(
"command %s", method));
2256 SetItemField(cmdname,
"_kind",
"Command");
2258 if (strncmp(icon,
"button;", 7) == 0) {
2259 SetItemField(cmdname,
"_fastcmd",
"true");
2262 if (*icon != 0) SetItemField(cmdname,
"_icon", icon);
2264 SetItemField(cmdname,
"method", method);
2268 if (strstr(method,nextname.
Data())==0)
break;
2270 }
while (numargs<100);
Bool_t ProduceImage(Int_t kind, const char *path, const char *options, void *&ptr, Long_t &length)
Method to produce image from specified object.
virtual void Append(const TImage *, const char *="+", const char *="#00000000")
TString fItemName
current level of hierarchy
Bool_t RegisterObject(const char *subfolder, TObject *obj)
Register object in subfolder structure subfolder parameter can have many levels like: ...
virtual const char * GetName() const
Returns name of object.
const char * item_prop_user
Bool_t SetResult(void *obj, TClass *cl, TDataMember *member=0)
Obsolete, use SetFoundResult instead.
A TFolder object is a collection of objects and folders.
virtual void WriteString(const char *s)
Write string to I/O buffer.
Bool_t CanExploreItem(const char *path)
Method returns true when object has childs or one could try to expand item.
virtual TList * GetListOfKeys() const
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
ULong_t GetItemHash(const char *itemname)
Get hash function for specified item used to detect any changes in the specified object.
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket...
Bool_t IsItemField(TObject *obj) const
return true when object is TNamed with kItemField bit set such objects used to keep field values for ...
Bool_t Produce(const char *path, const char *file, const char *options, void *&ptr, Long_t &length, TString &str)
Method produce different kind of data out of object Parameter 'path' specifies object or object membe...
Bool_t IsStreamerInfoItem(const char *itemname)
Return true if it is streamer info item name.
UInt_t fMask
pointer on parent record
Bool_t ProduceBinary(const char *path, const char *options, void *&ptr, Long_t &length)
produce binary data for specified item if "zipped" option specified in query, buffer will be compress...
void BeforeNextChild()
indicates that new child for current element will be started
TClass * GetResClass() const
Collectable string class.
Bool_t IsReadyForResult() const
Checks if result will be accepted.
static const EReturnType kOther
Int_t CheckRestriction(const char *item_name)
Checked if restriction is applied to the item full_item_name should have full path to the item...
All ROOT classes may have RTTI (run time type identification) support added.
Storage of hierarchy scan in TRootSniffer in JSON format.
This class represents a WWW compatible URL.
TString & ReplaceAll(const TString &s1, const TString &s2)
Bool_t TestBit(UInt_t f) const
virtual const char * GetClassName() const
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
THist< 1, float, THistStatContent, THistStatUncertainty > TH1F
const char * GetAutoLoad() const
return name of configured autoload scripts (or 0)
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual void * FindInHierarchy(const char *path, TClass **cl=0, TDataMember **member=0, Int_t *chld=0)
Search element with specified path Returns pointer on element Optionally one could obtain element cla...
Bool_t GoInside(TRootSnifferScanRec &super, TObject *obj, const char *obj_name=0, TRootSniffer *sniffer=0)
Method verifies if new level of hierarchy should be started with provided object. ...
const char * GetTypeName() const
Get type of data member, e,g.: "class TDirectory*" -> "TDirectory".
virtual void Remove(TObject *obj)
Remove object from this folder. obj must be a TObject or a TFolder.
virtual void AddFirst(TObject *obj)
Add object at the beginning of the list.
TString DecodeUrlOptionValue(const char *value, Bool_t remove_quotes=kTRUE)
method replaces all kind of special symbols, which could appear in URL options
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
if set, only fields for specified item will be set (but all fields)
Bool_t HasRestriction(const char *item_name)
Made fast check if item with specified name is in restriction list If returns true, requires precise check with CheckRestriction() method.
static const EReturnType kLong
tomato 1-D histogram with a float per channel (see TH1 documentation)}
Bool_t SetFoundResult(void *obj, TClass *cl, TDataMember *member=0)
Set found element with class and datamember (optional)
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
search for specified item (only objects and collections)
void SetParent(TObject *parent)
Set parent owning this buffer.
void CreateMemFile()
Creates TMemFile instance, which used for objects streaming One could not use TBufferFile directly...
virtual void BeforeNextChild(Int_t, Int_t, Int_t)
void Restrict(const char *path, const char *options)
Restrict access to the specified location.
Each ROOT method (see TMethod) has a linked list of its arguments.
An abstract interface to image processing library.
void MapObject(const TObject *obj, UInt_t offset=1)
Add object to the fMap container.
Bool_t UnregisterObject(TObject *obj)
unregister (remove) object from folders structures folder itself will remain even when it will be emp...
#define ROOT_VERSION_CODE
Int_t fRestriction
list of created items names, need to avoid duplication
const char * GetFullTypeName() const
Get full type description of method argument, e.g.: "class TDirectory*".
Bool_t ProduceItem(const char *path, const char *options, TString &res, Bool_t asjson=kTRUE)
produce JSON/XML for specified item contrary to h.json request, only fields for specified item are st...
Abstract interface for storage of hierarchy scan in TRootSniffer.
TMethod * GetMethodAllAny(const char *method)
Return pointer to method without looking at parameters.
Bool_t CreateItem(const char *fullname, const char *title)
create item element
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
void CloseNode()
close started node
Bool_t ProduceXml(const char *path, const char *options, TString &res)
produce XML data for specified item For object conversion TBufferXML is used
A TMemFile is like a normal TFile except that it reads and writes only from memory.
Bool_t CanExpandItem()
Returns true when item can be expanded.
static const EReturnType kString
const char * item_prop_rootversion
Int_t GetBaseClassOffset(const TClass *toBase, void *address=0, bool isDerivedObject=true)
Bool_t IsBasic() const
Return true if data member is a basic type, e.g. char, int, long...
Bool_t IsReadOnly(Bool_t dflt=kTRUE)
Returns read-only flag for current item.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
virtual void ScanObjectChilds(TRootSnifferScanRec &rec, TObject *obj)
scans object childs (if any) here one scans collection, branches, trees and so on ...
Bool_t SetItemField(const char *fullname, const char *name, const char *value)
set field for specified item
The TNamed class is the base class for all named ROOT classes.
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Bool_t ExecuteCmd(const char *path, const char *options, TString &res)
execute command marked as _kind=='Command'
Bool_t ScanOnlyFields() const
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
const char * item_prop_kind
std::string GetReturnTypeNormalizedName() const
Get the normalized name of the return type.
Bool_t CanDrawItem(const char *path)
Method verifies if object can be drawn.
const char * item_prop_typename
TFolder * GetSubFolder(const char *foldername, Bool_t force=kFALSE)
creates subfolder where objects can be registered
void Info(const char *location, const char *msgfmt,...)
TString & Append(const char *cs)
std::vector< std::vector< double > > Data
virtual void Add(TObject *obj)
Add object to this folder. obj must be a TObject or a TFolder.
Long_t GetThisOffset() const
const char * fSearchPath
defines operation kind
static const EReturnType kDouble
virtual void RecursiveRemove(TObject *obj)
Recursively remove object from a folder.
Ssiz_t First(char c) const
Find first occurrence of a character c.
virtual TList * GetList() const
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Method or function calling interface.
void SetRootClass(TClass *cl)
Mark item with ROOT class and correspondent streamer info.
const char * GetValueFromOptions(const char *key) const
Return a value for a given key from the URL options.
TFolder * AddFolder(const char *name, const char *title, TCollection *collection=0)
Create a new folder and add it to the list of folders of this folder, return a pointer to the created...
Int_t fNumChilds
number of fields
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual ~TRootSniffer()
destructor
TCollection * GetListOfFolders() const
void Error(const char *location, const char *msgfmt,...)
Storage of hierarchy scan in TRootSniffer in XML format.
Int_t GetMaxIndex(Int_t dim) const
Return maximum index for array dimension "dim".
Int_t WithCurrentUserName(const char *option)
return 2 when option match to current user name return 1 when option==all return 0 when option does n...
Int_t GetResNumChilds() const
void BuildRealData(void *pointer=0, Bool_t isTransient=kFALSE)
Build a full list of persistent data members.
Int_t GetResRestrict() const
const char * item_prop_arraydim
const char * item_prop_hidden
void SetResult(void *_res, TClass *_rescl, TDataMember *_resmemb, Int_t _res_chld, Int_t restr=0)
set pointer on found element, class and number of childs
Int_t fLevel
current path searched
const char * item_prop_realname
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
TDataMember * GetDataMember() const
Collection abstract base class.
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
const char * item_prop_title
The most important graphics class in the ROOT system.
Bool_t RegisterCommand(const char *cmdname, const char *method, const char *icon)
Register command which can be executed from web interface.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
char * Form(const char *fmt,...)
Int_t fNumFields
indicate if node was started
The TRealData class manages the effective list of all data members for a given class.
Int_t GetArrayDim() const
Return number of array dimensions.
The ROOT global object gROOT contains a list of all defined classes.
virtual void ScanRoot(TRootSnifferScanRec &rec)
scan complete ROOT objects hierarchy For the moment it includes objects in gROOT directory and list o...
static TString ConvertToXML(const TObject *obj, Bool_t GenericLayout=kFALSE, Bool_t UseNamespaces=kFALSE)
Converts object, inherited from TObject class, to XML string GenericLayout defines layout choice for ...
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
virtual ~TRootSnifferScanRec()
destructor
Long_t Property() const
Set TObject::fBits and fStreamerType to cache information about the class.
Bool_t AccessField(TFolder *parent, TObject *item, const char *name, const char *value, TNamed **only_get=0)
set or get field for the child each field coded as TNamed object, placed after chld in the parent hie...
void ScanHierarchy(const char *topname, const char *path, TRootSnifferStore *store, Bool_t only_fields=kFALSE)
Method scans normal objects, registered in ROOT.
Bool_t IsValid() const
Return true if the method call has been properly initialized and is usable.
void ScanObjectMembers(TRootSnifferScanRec &rec, TClass *cl, char *ptr)
scripts names, which are add as _autoload parameter to h.json request
TRootSnifferScanRec()
number of childs
const char * GetTrueTypeName() const
Get full type description of data member, e,g.: "class TDirectory*".
TString & Remove(Ssiz_t pos)
TList fItemsNames
name of current item
mask for actions, only actions copied to child rec
static TObject * ConvertFromXML(const char *str, Bool_t GenericLayout=kFALSE, Bool_t UseNamespaces=kFALSE)
Read object from XML, produced by ConvertToXML() method.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
static const char * GetFloatFormat()
return current printf format for float members, default "%e"
Bool_t ProduceExe(const char *path, const char *options, Int_t reskind, TString *ret_str, void **ret_ptr=0, Long_t *ret_length=0)
execute command for specified object options include method and extra list of parameters sniffer shou...
virtual void WriteLong(Long_t l)
TList * GetListOfMethodArgs()
Return list containing the TMethodArgs of a TFunction.
TDataMember * GetResMember() const
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Bool_t ProduceMulti(const char *path, const char *options, void *&ptr, Long_t &length, TString &str, Bool_t asjson=kTRUE)
Process several requests, packing all results into binary or JSON buffer Input parameters should be c...
TRootSnifferStore * fStore
restriction 0 - default, 1 - read-only, 2 - full access
Describe directory structure in memory.
virtual void FromPad(TVirtualPad *, Int_t=0, Int_t=0, UInt_t=0, UInt_t=0)
TList * GetListOfRealData() const
virtual void GetImageBuffer(char **, int *, EImageFileTypes=TImage::kPng)
double func(double *x, double *p)
virtual void WriteDouble(Double_t d)
static TString ConvertToJSON(const TObject *obj, Int_t compact=0, const char *member_name=0)
converts object, inherited from TObject class, to JSON string
TRootSnifferScanRec * fParent
virtual const char * GetPrototype() const
Returns the prototype of a function as defined by CINT, or 0 in case of error.
virtual void CreateNode(Int_t, const char *)
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
void ParseOptions() const
Parse URL options into a key/value map.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
virtual TObject * FindObject(const char *name) const
Search object identified by name in the tree of folders inside this folder.
Bool_t Done() const
Method indicates that scanning can be interrupted while result is set.
virtual void AddAfter(const TObject *after, TObject *obj)
Insert object after object after in the list.
Bool_t ProduceJson(const char *path, const char *options, TString &res)
produce JSON data for specified item For object conversion TBufferJSON is used
Mother of all ROOT objects.
Int_t Depth() const
Returns depth of hierarchy.
Global functions class (global functions are obtained from CINT).
virtual void SetField(Int_t, const char *, const char *, Bool_t)
Int_t IsSTLContainer()
The return type is defined in TDictionary (kVector, kList, etc.)
void SetField(const char *name, const char *value, Bool_t with_quotes=kTRUE)
Set item field only when creating is specified.
void SetAutoLoad(const char *scripts="")
When specified, _autoload attribute will be always add to top element of h.json/h.hml requests Used to instruct browser automatically load special code.
virtual const char * GetTitle() const
Returns title of object.
virtual TObject * ReadObj()
To read a TObject* from the file.
const char * GetDefault() const
Get default value of method argument.
virtual void Add(TObject *obj)
void ScanCollection(TRootSnifferScanRec &rec, TCollection *lst, const char *foldername=0, TCollection *keys_lst=0)
scan collection content
void Execute(const char *, const char *, int *=0)
Execute method on this object with the given parameter string, e.g.
const char * GetArrayIndex() const
If the data member is pointer and has a valid array size in its comments GetArrayIndex returns a stri...
Bool_t CanSetFields() const
return true when fields could be set to the hierarchy item
Each ROOT class (see TClass) has a linked list of methods.
virtual void CloseNode(Int_t, Int_t)
A Graph is a graphics object made of two arrays X and Y with npoints each.
void SetOptions(const char *opt)
Bool_t fHasMore
object to store results
const char * item_prop_more
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Int_t Atoi() const
Return integer value of string.
Bool_t fNodeStarted
indicates that potentially there are more items can be found
A TTree object has a header with a name and a title.
const char * item_prop_autoload
expand of specified item - allowed to scan object members
Int_t GetIntValueFromOptions(const char *key) const
Return a value for a given key from the URL options as an Int_t, a missing key returns -1...
static TImage * Create()
Create an image.
Short_t GetCycle() const
Return cycle number associated to this key.
static const EReturnType kNone
virtual void ScanObjectProperties(TRootSnifferScanRec &rec, TObject *obj)
scans object properties here such fields as _autoload or _icon properties depending on class or objec...
virtual const char * GetName() const
Returns name of object.
virtual Int_t GetSize() const
A TTree is a list of TBranches.
void MakeItemName(const char *objname, TString &itemname)
Construct item name, using object name as basis.
virtual const char * GetName() const
Returns name of object.
void SetCurrentCallArg(THttpCallArg *arg)
set current http arguments, which then used in different process methods For instance, if user authorized with some user name, depending from restrictions some objects will be invisible or user get full access to the element
TMethod * GetMethodWithPrototype(const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
Find the method with a given prototype.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Bool_t IsaPointer() const
Return true if data member is a pointer.
Bool_t HasOption(const char *key) const
Returns true if the given key appears in the URL options list.
void BuildFullName(TString &buf, TRootSnifferScanRec *prnt=0)
Produces full name for the current item.
const char * GetItemField(TFolder *parent, TObject *item, const char *name)
return field for specified item
TRealData * GetRealData(const char *name) const
Return pointer to TRealData element with name "name".
check if there childs, very similar to search
EReturnType ReturnType()
Returns the return type of the method.
void CreateNode(const char *_node_name)
Starts new node, must be closed at the end.
TObject * GetItem(const char *fullname, TFolder *&parent, Bool_t force=kFALSE, Bool_t within_objects=kTRUE)
return item from the subfolders structure
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
virtual const char * GetTitle() const
Returns title of object.
ULong_t GetStreamerInfoHash()
Returns hash value for streamer infos At the moment - just number of items in streamer infos list...
TObject * FindTObjectInHierarchy(const char *path)
Search element in hierarchy, derived from TObject.
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
const char * Data() const
static Bool_t IsDrawableClass(TClass *cl)
return true if object can be drawn