78 : fParent(0), fMask(0), fSearchPath(0), fLevel(0), fItemName(), fItemsNames(), fRestriction(0), fStore(0),
79 fHasMore(
kFALSE), fNodeStarted(
kFALSE), fNumFields(0), fNumChilds(0)
118 std::string nnn = objname;
123 while ((pos = nnn.find_first_of(
"- []<>#:&?/\'\"\\")) != std::string::npos) nnn.replace(pos, 1,
"_");
125 itemname = nnn.c_str();
129 itemname.
Form(
"%s_%d", nnn.c_str(), cnt++);
232 "When member specified, pointer on object (not member) should be provided; use SetFoundResult");
304 if ((obj != 0) && (obj_name == 0)) obj_name = obj->
GetName();
307 if ((obj_name == 0) || (*obj_name == 0))
return kFALSE;
309 const char *full_name = 0;
313 const char *
slash = strrchr(obj_name,
'/');
315 full_name = obj_name;
316 obj_name = slash + 1;
317 if (*obj_name == 0) obj_name =
"file";
352 while (*separ ==
'/') {
365 if (!isslash)
return kFALSE;
374 if (full_name != 0)
SetField(
"_fullname", full_name);
403 :
TNamed(name,
"sniffer of root objects"), fObjectsPath(objpath), fMemFile(0), fSinfo(0), fReadOnly(
kTRUE),
404 fScanGlobalDir(
kTRUE), fCurrentArg(0), fCurrentRestrict(0), fCurrentAllowedMethods(0), fRestrictions(), fAutoLoad()
457 const char *rslash = strrchr(path,
'/');
458 if (rslash) rslash++;
459 if ((rslash == 0) || (*rslash == 0)) rslash = path;
502 if ((username == 0) || (option == 0) || (*option == 0))
return 0;
504 if (strcmp(option,
"all") == 0)
return 1;
506 if (strcmp(username, option) == 0)
return 2;
508 if (strstr(option, username) == 0)
return -1;
516 return find ? 2 : -1;
530 if ((full_item_name == 0) || (*full_item_name == 0))
return 0;
532 const char *item_name = strrchr(full_item_name,
'/');
533 if (item_name) item_name++;
534 if ((item_name == 0) || (*item_name == 0)) item_name = full_item_name;
539 const char *options = 0;
543 while ((obj = iter()) != 0) {
544 const char *title = obj->
GetTitle();
546 if (strstr(title, pattern1.
Data()) == title) {
547 options = title + pattern1.
Length();
550 if (strstr(title, pattern2.
Data()) == title) {
551 options = title + pattern2.
Length();
556 if (options == 0)
return 0;
568 if (can_access > 0)
return 2;
569 if (can_see < 0)
return -1;
574 if (can_access < 0)
return 1;
585 if ((cl == 0) || (ptr == 0) || rec.
Done())
return;
593 while ((obj = iter()) != 0) {
595 if ((rdata == 0) || strchr(rdata->
GetName(),
'.'))
continue;
602 if (member->
IsaPointer()) member_ptr = *((
char **)member_ptr);
606 if (chld.
GoInside(rec, member, 0,
this)) {
611 if (coll_offset >= 0) {
618 const char *title = member->
GetTitle();
635 if ((imember != 0) && (strcmp(imember->
GetTrueTypeName(),
"int") == 0)) {
644 if (coll_offset >= 0) {
666 TClass *cl = obj ? obj->IsA() : 0;
674 const char *pos = strstr(cl ? cl->
GetTitle() :
"",
"*SNIFF*");
675 if (pos == 0)
return;
684 const char *pos0 = pos;
685 while ((*pos != 0) && (*pos !=
'=')) pos++;
686 if (*pos == 0)
return;
689 Bool_t quotes = (*pos ==
'\"');
693 while ((*pos != 0) && (*pos != (quotes ?
'\"' :
' '))) pos++;
694 TString value(pos0, pos - pos0);
714 rec.
SetField(
"_player",
"JSROOT.drawTreePlayer");
731 if (((lst == 0) || (lst->
GetSize() == 0)) && ((keys_lst == 0) || (keys_lst->
GetSize() == 0)))
return;
735 if (!folderrec.
GoInside(rec, 0, foldername,
this))
return;
758 if (!chld.
GoInside(master, obj, 0,
this)) {
763 if (chld.
SetResult(obj, obj->IsA()))
return;
769 while ((next = iter()) != 0) {
784 if (chld.
SetResult(obj, obj->IsA()))
return;
789 TIter iter(keys_lst);
792 while ((kobj = iter()) != 0) {
793 TKey *key =
dynamic_cast<TKey *
>(kobj);
794 if (key == 0)
continue;
813 if (chld.
GoInside(master, obj, fullname.
Data(),
this)) {
818 if (chld.
SetResult(keyobj, keyobj->IsA()))
return;
821 if (chld.
SetResult(obj, obj->IsA()))
return;
823 TClass *obj_class = obj->IsA();
832 if (strcmp(key->
GetClassName(),
"TDirectoryFile") == 0) {
837 obj_class = dir->IsA();
849 if (obj) obj_class = obj->IsA();
851 rec.
SetField(
"_player",
"JSROOT.drawTreePlayerKey");
864 if (chld.
SetResult(obj, obj_class))
return;
892 if (chld.
GoInside(rec, 0,
"StreamerInfo",
this)) {
896 chld.
SetField(
"_after_request",
"JSROOT.MarkAsStreamerInfo");
914 if (cl == 0)
return kFALSE;
982 if ((res_member != 0) && (res_cl != 0) && (member == 0)) {
987 if (res_member->
IsaPointer()) res = *((
char **)res);
993 if (cl) *cl = res_cl;
994 if (member) *member = res_member;
1034 return obj == 0 ? 0 :
TString::Hash(obj, obj->IsA()->Size());
1056 return (res != 0) && (obj_chld > 0);
1076 TH1F *d =
new TH1F(
"d",
"d", 10, 0, 10);
1091 l->
Add(
gROOT->GetListOfStreamerInfo()->FindObject(
"TGraph"));
1092 l->
Add(
gROOT->GetListOfStreamerInfo()->FindObject(
"TH1F"));
1093 l->
Add(
gROOT->GetListOfStreamerInfo()->FindObject(
"TH1"));
1094 l->
Add(
gROOT->GetListOfStreamerInfo()->FindObject(
"TNamed"));
1095 l->
Add(
gROOT->GetListOfStreamerInfo()->FindObject(
"TObject"));
1114 if ((path == 0) || (*path == 0))
return kFALSE;
1116 if (*path ==
'/') path++;
1127 if ((obj_ptr == 0) || ((obj_cl == 0) && (member == 0)))
return kFALSE;
1143 if ((kind == 0) || (strcmp(kind,
"Command") != 0)) {
1144 if (
gDebug > 0)
Info(
"ExecuteCmd",
"Entry %s is not a command", path);
1149 const char *cmethod =
GetItemField(parent, obj,
"method");
1150 if ((cmethod == 0) || (strlen(cmethod) == 0)) {
1151 if (
gDebug > 0)
Info(
"ExecuteCmd",
"Entry %s do not defines method for execution", path);
1160 if (
gDebug > 0)
Info(
"ExecuteCmd",
"Entry %s not allowed for specified user", path);
1168 const char *cnumargs =
GetItemField(parent, obj,
"_numargs");
1175 for (
Int_t n = 0;
n < numargs;
n++) {
1178 if (argvalue == 0) {
1180 Info(
"ExecuteCmd",
"For command %s argument %s not specified in options %s", path, argname.
Data(),
1192 if (
gDebug > 0)
Info(
"ExecuteCmd",
"Executing command %s method:%s", path, method.
Data());
1197 if (method.
Index(
"this->") == 0) {
1201 }
else if (separ !=
kNPOS) {
1205 if (item_obj != 0) {
1207 TString::Format(
"((%s*)%lu)->%s", item_obj->ClassName(), (
long unsigned)item_obj, method.
Data() + separ + 3);
1208 if (
gDebug > 2)
Info(
"ExecuteCmd",
"Executing %s", method.
Data());
1240 if ((path == 0) || (*path == 0))
return kFALSE;
1242 if (*path ==
'/') path++;
1246 if ((obj_ptr == 0) || (obj_cl == 0))
return kFALSE;
1258 if ((value == 0) || (strlen(value) == 0))
return TString();
1271 if (remove_quotes && (res.
Length() > 1) && ((res[0] ==
'\'') || (res[0] ==
'\"')) &&
1272 (res[0] == res[res.
Length() - 1])) {
1289 TString *debug = (reskind == 0) ? res_str : 0;
1291 if ((path == 0) || (*path == 0)) {
1292 if (debug) debug->
Append(
"Item name not specified\n");
1296 if (*path ==
'/') path++;
1301 if ((obj_ptr == 0) || (obj_cl == 0))
return debug != 0;
1311 if (method_name != 0) {
1312 if (prototype.
Length() == 0) {
1318 TString::Format(
"Search for method \'%s\' with prototype \'%s\'\n", method_name, prototype.
Data()));
1326 if (funcname.Length() > 0) {
1327 if (prototype.
Length() == 0) {
1328 if (debug) debug->
Append(
TString::Format(
"Search for any function with name \'%s\'\n", funcname.Data()));
1329 func =
gROOT->GetGlobalFunction(funcname);
1332 debug->
Append(
TString::Format(
"Search for function \'%s\' with prototype \'%s\'\n", funcname.Data(),
1334 func =
gROOT->GetGlobalFunctionWithPrototype(funcname, prototype);
1343 if ((method == 0) && (func == 0)) {
1344 if (debug) debug->
Append(
"Method not found\n");
1350 if (debug) debug->
Append(
"Server runs in read-only mode, method cannot be executed\n");
1353 if (debug) debug->
Append(
"Server runs in read-only mode, function cannot be executed\n");
1356 if (debug) debug->
Append(
"For that special method server allows access even read-only mode is specified\n");
1371 if ((strcmp(arg->
GetName(),
"rest_url_opt") == 0) && (strcmp(arg->
GetFullTypeName(),
"const char*") == 0) &&
1375 const char *pos = strstr(options,
"method=");
1376 if ((pos == 0) || (strlen(pos) < strlen(method_name) + 8))
return debug != 0;
1377 call_args.
Form(
"\"%s\"", pos + strlen(method_name) + 8);
1388 if ((val != 0) && (strcmp(val,
"_this_") == 0)) {
1390 sval.
Form(
"(%s*)0x%lx", obj_cl->
GetName(), (
long unsigned)obj_ptr);
1394 if (strcmp(val,
"_post_object_xml_") == 0) {
1397 if (post_obj == 0) {
1400 sval.
Form(
"(%s*)0x%lx", post_obj->
ClassName(), (
long unsigned)post_obj);
1401 if (url.
HasOption(
"_destroy_post_")) garbage.
Add(post_obj);
1404 }
else if ((strcmp(val,
"_post_object_") == 0) && url.
HasOption(
"_post_class_")) {
1409 if (post_obj == 0) {
1416 post_obj->Streamer(buf);
1417 if (url.
HasOption(
"_destroy_post_")) garbage.
Add(post_obj);
1420 sval.
Form(
"(%s*)0x%lx", clname.
Data(), (
long unsigned)post_obj);
1422 }
else if (strcmp(val,
"_post_data_") == 0) {
1423 sval.
Form(
"(void*)0x%lx", (
long unsigned)*res_ptr);
1425 }
else if (strcmp(val,
"_post_length_") == 0) {
1426 sval.
Form(
"%ld", (
long)*res_length);
1435 val ? val :
"<missed>"));
1436 if (val == 0)
return debug != 0;
1438 if (call_args.
Length() > 0) call_args +=
", ";
1441 int len = strlen(val);
1442 if ((strlen(val) < 2) || (*val !=
'\"') || (val[len - 1] !=
'\"'))
1465 if (debug) debug->
Append(
"Fail: invalid TMethodCall\n");
1478 garbage.
Add(resbuf);
1516 res.
Form(
"\"%s\"", txt);
1522 if ((ret_kind.length() > 0) && (ret_kind[ret_kind.length() - 1] ==
'*')) {
1523 ret_kind.resize(ret_kind.length() - 1);
1533 if (l != 0) ret_obj = (
void *)l;
1553 if (_ret_object_ != 0) {
1556 if (debug) debug->
Append(
TString::Format(
"Return object %s found %s\n", _ret_object_, obj ?
"true" :
"false"));
1562 ret_cl = obj->IsA();
1566 if ((ret_obj != 0) && (ret_cl != 0)) {
1570 obj->Streamer(*resbuf);
1577 if ((resbuf != 0) && (resbuf->
Length() > 0) && (res_ptr != 0) && (res_length != 0)) {
1580 *res_length = resbuf->
Length();
1585 if ((reskind == 1) && res_str) *res_str = res;
1587 if (url.
HasOption(
"_destroy_result_") && (ret_obj != 0) && (ret_cl != 0)) {
1589 if (debug) debug->
Append(
"Destroy result object at the end\n");
1628 std::vector<void *> mem;
1629 std::vector<Long_t> memlen;
1631 if (asjson) str =
"[";
1633 for (
Int_t n = 0;
n < number;
n++) {
1634 const char *next = args;
1635 while ((next < ends) && (*next !=
'\n')) next++;
1637 Error(
"ProduceMulti",
"Not enough arguments in POST block");
1641 TString file1(args, next - args);
1649 opt1 = file1(pos + 1, file1.
Length() - pos);
1654 pos = file1.
Last(
'/');
1656 path1 = file1(0, pos);
1657 file1.
Remove(0, pos + 1);
1660 if ((path != 0) && (*path != 0)) path1 =
TString(path) +
"/" + path1;
1667 Produce(path1, file1, opt1, ptr1, len1, str1);
1672 str.
Append(
"\"<non-supported binary>\"");
1674 }
else if (str1.
Length() > 0)
1679 if ((str1.
Length() > 0) && (ptr1 == 0)) {
1682 memcpy(ptr1, str1.
Data(), len1);
1684 mem.push_back(ptr1);
1685 memlen.push_back(len1);
1693 for (
unsigned n = 0;
n < mem.size();
n++) {
1694 length += 4 + memlen[
n];
1697 char *curr = (
char *)ptr;
1698 for (
unsigned n = 0;
n < mem.size();
n++) {
1700 *curr++ = (char)(l & 0xff);
1702 *curr++ = (char)(l & 0xff);
1704 *curr++ = (char)(l & 0xff);
1706 *curr++ = (char)(l & 0xff);
1707 if ((mem[
n] != 0) && (memlen[
n] > 0)) memcpy(curr, mem[
n], memlen[n]);
1712 for (
unsigned n = 0;
n < mem.size();
n++)
free(mem[
n]);
1722 if ((itemname == 0) || (*itemname == 0))
return kFALSE;
1724 return (strcmp(itemname,
"StreamerInfo") == 0) || (strcmp(itemname,
"StreamerInfo/") == 0);
1733 if ((path == 0) || (*path == 0))
return kFALSE;
1735 if (*path ==
'/') path++;
1739 if ((obj_ptr == 0) || (obj_cl == 0))
return kFALSE;
1742 Info(
"ProduceBinary",
"Non-TObject class not supported");
1759 obj->Streamer(*sbuf);
1803 if ((path == 0) || (*path == 0))
return kFALSE;
1804 if (*path ==
'/') path++;
1808 if ((obj_ptr == 0) || (obj_cl == 0))
return kFALSE;
1811 Error(
"TRootSniffer",
"Only derived from TObject classes can be drawn");
1818 if (img == 0)
return kFALSE;
1822 if (
gDebug > 1)
Info(
"TRootSniffer",
"Crate IMAGE directly from pad");
1826 if (
gDebug > 1)
Info(
"TRootSniffer",
"Crate IMAGE from object %s", obj->
GetName());
1828 Int_t width(300), height(200);
1831 if ((options != 0) && (*options != 0)) {
1836 if (w > 10) width = w;
1838 if (h > 10) height =
h;
1840 if (opt != 0) drawopt = opt;
1848 TCanvas *
c1 =
new TCanvas(
"__online_draw_canvas__",
"title", width, height);
1864 char *png_buffer(0);
1869 if ((png_buffer != 0) && (size > 0)) {
1872 memcpy(ptr, png_buffer, length);
1875 delete[] png_buffer;
1901 if ((file == 0) || (*file == 0))
return kFALSE;
1903 if (strcmp(file,
"root.bin") == 0)
return ProduceBinary(path, options, ptr, length);
1911 if (strcmp(file,
"exe.bin") == 0)
return ProduceExe(path, options, 2, 0, &ptr, &length);
1913 if (strcmp(file,
"root.xml") == 0)
return ProduceXml(path, options, str);
1915 if (strcmp(file,
"root.json") == 0)
return ProduceJson(path, options, str);
1918 if (strcmp(file,
"exe.txt") == 0)
return ProduceExe(path, options, 0, &str);
1920 if (strcmp(file,
"exe.json") == 0)
return ProduceExe(path, options, 1, &str);
1922 if (strcmp(file,
"cmd.json") == 0)
return ExecuteCmd(path, options, str);
1924 if (strcmp(file,
"item.json") == 0)
return ProduceItem(path, options, str,
kTRUE);
1926 if (strcmp(file,
"item.xml") == 0)
return ProduceItem(path, options, str,
kFALSE);
1928 if (strcmp(file,
"multi.bin") == 0)
return ProduceMulti(path, options, ptr, length, str,
kFALSE);
1930 if (strcmp(file,
"multi.json") == 0)
return ProduceMulti(path, options, ptr, length, str,
kTRUE);
1943 Error(
"RegisterObject",
"Not found top ROOT folder!!!");
1948 if (httpfold == 0) {
1949 if (!force)
return 0;
1950 httpfold = topf->
AddFolder(
"http",
"ROOT http server");
1954 gROOT->GetListOfCleanups()->Add(httpfold);
1960 if (fullname == 0)
return httpfold;
1964 if (within_objects && ((path.
Length() == 0) || (path[0] !=
'/'))) path =
fObjectsPath +
"/" + path;
1969 while (path.Tokenize(tok, from,
"/")) {
1970 if (tok.
Length() == 0)
continue;
1973 if (fold == 0)
return 0;
1976 while ((obj = iter()) != 0) {
1982 if (!force)
return 0;
1983 obj = fold->
AddFolder(tok,
"sub-folder");
2000 return dynamic_cast<TFolder *
>(
GetItem(subfolder, parent, force));
2027 if (f == 0)
return kFALSE;
2043 if (obj == 0)
return kTRUE;
2048 Error(
"UnregisterObject",
"Not found //root/http folder!!!");
2064 if (f == 0)
return kFALSE;
2086 if (parent == 0)
return kFALSE;
2089 Info(
"SetField",
"Should be special case for top folder, support later");
2098 if (parent == chld) {
2099 last_find = find =
kTRUE;
2102 while ((obj = iter()) != 0) {
2104 if (last_find && (obj->GetName() != 0) && !strcmp(name, obj->GetName())) curr = (
TNamed *)obj;
2106 last_find = (obj == chld);
2107 if (last_find) find =
kTRUE;
2108 if (find && !last_find)
break;
2113 if (!find)
return kFALSE;
2115 if (only_get != 0) {
2130 curr =
new TNamed(name, value);
2142 Error(
"SetField",
"Fail cast to TList");
2159 if ((fullname == 0) || (name == 0))
return kFALSE;
2164 if ((parent == 0) || (obj == 0))
return kFALSE;
2182 if ((parent == 0) || (obj == 0) || (name == 0))
return 0;
2186 if (!
AccessField(parent, obj, name, 0, &field))
return 0;
2188 return field ? field->
GetTitle() : 0;
2196 if (fullname == 0)
return 0;
2237 if (strncmp(icon,
"button;", 7) == 0) {
2247 if (strstr(method, nextname.
Data()) == 0)
break;
2249 }
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
! name of current item
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.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
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.
if set, only fields for specified item will be set (but all fields)
UInt_t fMask
! defines operation kind
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.
TMemFile * fMemFile
! file used to manage streamer infos
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)
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
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
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
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)
R__EXTERN TVirtualMutex * gROOTMutex
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
! restriction 0 - default, 1 - read-only, 2 - full access
void * GetPostData() const
return pointer on posted with request data
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.
TString fCurrentAllowedMethods
! list of allowed methods, extracted when analyzed object restrictions
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
Delete a TObjLink object.
if object in a list can be deleted
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
THttpCallArg * fCurrentArg
! current http arguments (if any)
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 fReadOnly
! indicate if sniffer allowed to change ROOT structures - for instance, read objects from files ...
Bool_t ScanOnlyFields() const
return true when only fields are scanned by the sniffer
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
TString & Append(const char *cs)
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
! current path searched
static const EReturnType kDouble
const char * GetUserName() const
return authenticated user name (0 - when no authentication)
virtual void RecursiveRemove(TObject *obj)
Recursively remove object from a folder.
Ssiz_t First(char c) const
Find first occurrence of a character c.
check if there childs, very similar to search
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 childs
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual ~TRootSniffer()
destructor
TCollection * GetListOfFolders() const
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
void SetExtraHeader(const char *name, const char *value)
add extra http header value to the reply
virtual void WriteStreamerInfo()
Write the list of TStreamerInfo as a single object in this file The class Streamer description for al...
Int_t WriteObject(const T *obj, const char *name, Option_t *option="", Int_t bufsize=0)
TRootSniffer(const char *name, const char *objpath="Objects")
constructor
Int_t fLevel
! current level of hierarchy
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.
TString fObjectsPath
! default path for registered objects
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
! number of fields
The TRealData class manages the effective list of all data members for a given class.
mask for actions, only actions copied to child rec
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)
Method is used to scan ROOT objects.
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 ...
virtual TList * GetStreamerInfoList()
Read the list of TStreamerInfo objects written to this file.
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.
if object destructor must call RecursiveRemove()
TString fAutoLoad
! scripts names, which are add as _autoload parameter to h.json request
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)
scan object data members some members like enum or static members will be excluded ...
TRootSnifferScanRec()
constructor
const char * GetTrueTypeName() const
Get full type description of data member, e,g.: "class TDirectory*".
TString & Remove(Ssiz_t pos)
TList fItemsNames
! list of created items names, need to avoid duplication
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
! object to store results
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)
virtual void WriteDouble(Double_t d)
TList * fSinfo
! last produced streamer info
static TString ConvertToJSON(const TObject *obj, Int_t compact=0, const char *member_name=0)
Converts object, inherited from TObject class, to JSON string Lower digit of compact parameter define...
TRootSnifferScanRec * fParent
! pointer on parent record
#define R__LOCKGUARD(mutex)
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
! indicates that potentially there are more items can be found
const char * item_prop_more
virtual Int_t GetLast() const
Returns index of last object in collection.
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
! indicate if node was started
A TTree object has a header with a name and a title.
const char * item_prop_autoload
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.
Long_t GetPostDataLength() const
return length of posted with request data
expand of specified item - allowed to scan object members
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.
Int_t fCurrentRestrict
! current restriction for last-found object
Bool_t IsScanGlobalDir() const
Returns true when sniffer allowed to scan global directories.
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".
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.
TList fRestrictions
! list of restrictions for different locations
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