ROOT » NET » HTTP » TRootSniffer

class TRootSniffer: public TNamed


TRootSnifferScanRec

Structure used to scan hierarchies of ROOT objects
Represents single level of hierarchy


Function Members (Methods)

public:
virtual~TRootSniffer()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
Bool_tCanDrawItem(const char* path)
Bool_tCanExploreItem(const char* path)
Int_tCheckRestriction(const char* item_name)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
Bool_tCreateItem(const char* fullname, const char* title)
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
Bool_tExecuteCmd(const char* path, const char* options, TString& res)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual void*FindInHierarchy(const char* path, TClass** cl = 0, TDataMember** member = 0, Int_t* chld = 0)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
TObject*FindTObjectInHierarchy(const char* path)
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
const char*GetItemField(const char* fullname, const char* name)
ULong_tGetItemHash(const char* itemname)
virtual const char*TNamed::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
ULong_tGetStreamerInfoHash()
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
Bool_tHasRestriction(const char* item_name)
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
static Bool_tIsDrawableClass(TClass* cl)
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
Bool_tIsReadOnly() const
Bool_tIsScanGlobalDir() const
virtual Bool_tTNamed::IsSortable() const
Bool_tIsStreamerInfoItem(const char* itemname)
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TRootSniffer&operator=(const TRootSniffer&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
Bool_tProduce(const char* path, const char* file, const char* options, void*& ptr, Long_t& length, TString& str)
Bool_tProduceBinary(const char* path, const char* options, void*& ptr, Long_t& length)
Bool_tProduceExe(const char* path, const char* options, Int_t reskind, TString* ret_str, void** ret_ptr = 0, Long_t* ret_length = 0)
Bool_tProduceImage(Int_t kind, const char* path, const char* options, void*& ptr, Long_t& length)
Bool_tProduceItem(const char* path, const char* options, TString& res, Bool_t asjson = kTRUE)
Bool_tProduceJson(const char* path, const char* options, TString& res)
Bool_tProduceXml(const char* path, const char* options, TString& res)
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
Bool_tRegisterCommand(const char* cmdname, const char* method, const char* icon)
Bool_tRegisterObject(const char* subfolder, TObject* obj)
voidTObject::ResetBit(UInt_t f)
voidRestrict(const char* path, const char* options)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidScanHierarchy(const char* topname, const char* path, TRootSnifferStore* store, Bool_t only_fields = kFALSE)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidSetCurrentCallArg(THttpCallArg* arg)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
Bool_tSetItemField(const char* fullname, const char* name, const char* value)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
voidSetReadOnly(Bool_t on = kTRUE)
voidSetScanGlobalDir(Bool_t on = kTRUE)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp) const
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
TRootSniffer(const TRootSniffer&)
TRootSniffer(const char* name, const char* objpath = "Objects")
Bool_tUnregisterObject(TObject* obj)
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
Bool_tAccessField(TFolder* parent, TObject* item, const char* name, const char* value, TNamed** only_get = 0)
voidCreateMemFile()
TStringDecodeUrlOptionValue(const char* value, Bool_t remove_quotes = kTRUE)
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
TObject*GetItem(const char* fullname, TFolder*& parent, Bool_t force = kFALSE, Bool_t within_objects = kTRUE)
const char*GetItemField(TFolder* parent, TObject* item, const char* name)
TFolder*GetSubFolder(const char* foldername, Bool_t force = kFALSE)
Bool_tIsItemField(TObject* obj) const
voidTObject::MakeZombie()
voidScanCollection(TRootSnifferScanRec& rec, TCollection* lst, const char* foldername = 0, TCollection* keys_lst = 0)
virtual voidScanObjectChilds(TRootSnifferScanRec& rec, TObject* obj)
voidScanObjectMemebers(TRootSnifferScanRec& rec, TClass* cl, char* ptr, unsigned long cloffset)
virtual voidScanObjectProperties(TRootSnifferScanRec& rec, TObject* obj)
virtual voidScanRoot(TRootSnifferScanRec& rec)
Int_tWithCurrentUserName(const char* option)

Data Members

public:
static TObject::(anonymous)TObject::kBitMask
static TObject::EStatusBitsTObject::kCanDelete
static TObject::EStatusBitsTObject::kCannotPick
static TObject::EStatusBitsTObject::kHasUUID
static TObject::EStatusBitsTObject::kInvalidObject
static TObject::(anonymous)TObject::kIsOnHeap
static TObject::EStatusBitsTObject::kIsReferenced
static TObject::EStatusBitsTObject::kMustCleanup
static TObject::EStatusBitsTObject::kNoContextMenu
static TObject::(anonymous)TObject::kNotDeleted
static TObject::EStatusBitsTObject::kObjInCanvas
static TObject::(anonymous)TObject::kOverwrite
static TObject::(anonymous)TObject::kSingleKey
static TObject::(anonymous)TObject::kWriteDelete
static TObject::(anonymous)TObject::kZombie
protected:
TStringfCurrentAllowedMethods! list of allowed methods, extracted when analyzed object restrictions
THttpCallArg*fCurrentArg! current http arguments (if any)
Int_tfCurrentRestrict! current restriction for last-found object
TMemFile*fMemFile! file used to manage streamer infos
TStringTNamed::fNameobject identifier
TStringfObjectsPath! default path for registered objects
Bool_tfReadOnly! indicate if sniffer allowed to change ROOT structures - for instance, read objects from files
TListfRestrictions! list of restrictions for different locations
Bool_tfScanGlobalDir! when enabled (default), scan gROOT for histograms, canvases, open files
TList*fSinfo! last produced streamer info
TStringTNamed::fTitleobject title
private:
static TRootSniffer::(anonymous)kItemField

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TRootSniffer(const char* name, const char* objpath = "Objects")
 constructor
~TRootSniffer()
 destructor
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
void Restrict(const char* path, const char* options)
 Restrict access to the specified location

 Hides or provides read-only access to different parts of the hierarchy
 Restriction done base on user-name specified with http requests
 Options can be specified in URL style (separated with &)
 Following parameters can be specified:
    visible = [all|user(s)] - make item visible for all users or only specified user
    hidden = [all|user(s)] - make item hidden from all users or only specified user
    readonly = [all|user(s)] - make item read-only for all users or only specified user
    allow = [all|user(s)] - make full access for all users or only specified user
    allow_method = method(s)  - allow method(s) execution even when readonly flag specified for the object
 Like make command seen by all but can be executed only by admin
    sniff->Restrict("/CmdReset","allow=admin");
 Or fully hide command from guest account
    sniff->Restrict("/CmdRebin","hidden=guest");
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
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 not match user name
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

 Returns -1 - object invisible, cannot be accessed or listed
          0 -  no explicit restrictions, use default
          1 - read-only access
          2 - full access
void ScanObjectMemebers(TRootSnifferScanRec& rec, TClass* cl, char* ptr, unsigned long cloffset)
 scan object data members
 some members like enum or static members will be excluded
void ScanObjectProperties(TRootSnifferScanRec& rec, TObject* obj)
 scans object properties
 here such fields as _autoload or _icon properties depending on class or object name could be assigned
void ScanObjectChilds(TRootSnifferScanRec& rec, TObject* obj)
 scans object childs (if any)
 here one scans collection, branches, trees and so on
void ScanCollection(TRootSnifferScanRec& rec, TCollection* lst, const char* foldername = 0, TCollection* keys_lst = 0)
 scan collection content
void ScanRoot(TRootSnifferScanRec& rec)
 scan complete ROOT objects hierarchy
 For the moment it includes objects in gROOT directory
 and list of canvases and files
 Also all registered objects are included.
 One could reimplement this method to provide alternative
 scan methods or to extend some collection kinds
Bool_t IsDrawableClass(TClass* cl)
 return true if object can be drawn
void ScanHierarchy(const char* topname, const char* path, TRootSnifferStore* store, Bool_t only_fields = kFALSE)
 scan ROOT hierarchy with provided store object
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 class, member description
 and number of childs. When chld!=0, not only element is searched,
 but also number of childs are counted. When member!=0, any object
 will be scanned for its data members (disregard of extra options)
TObject * FindTObjectInHierarchy(const char* path)
 Search element in hierarchy, derived from TObject
ULong_t GetStreamerInfoHash()
 Returns hash value for streamer infos
 At the moment - just number of items in streamer infos list.
ULong_t GetItemHash(const char* itemname)
 Get hash function for specified item
 used to detect any changes in the specified object
Bool_t CanDrawItem(const char* path)
 Method verifies if object can be drawn
Bool_t CanExploreItem(const char* path)
 Method returns true when object has childs or
 one could try to expand item
void CreateMemFile()
 Creates TMemFile instance, which used for objects streaming
 One could not use TBufferFile directly,
 while one also require streamer infos list
Bool_t ProduceJson(const char* path, const char* options, TString& res)
 produce JSON data for specified item
 For object conversion TBufferJSON is used
Bool_t ExecuteCmd(const char* path, const char* options, TString& res)
 execute command marked as _kind=='Command'
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 stored
Bool_t ProduceXml(const char* path, const char* options, TString& res)
 produce XML data for specified item
 For object conversion TBufferXML is used
TString DecodeUrlOptionValue(const char* value, Bool_t remove_quotes = kTRUE)
 method replaces all kind of special symbols, which could appear in URL options
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 should be not-readonly to allow execution of the commands
 reskind defines kind of result 0 - debug, 1 - json, 2 - binary
Bool_t IsStreamerInfoItem(const char* itemname)
 Return true if it is streamer info item name
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 compressed
Bool_t ProduceImage(Int_t kind, const char* path, const char* options, void*& ptr, Long_t& length)
 Method to produce image from specified object

 Parameters:
    kind - image kind TImage::kPng, TImage::kJpeg, TImage::kGif
    path - path to object
    options - extra options

 By default, image 300x200 is produced
 In options string one could provide following parameters:
    w - image width
    h - image height
    opt - draw options
  For instance:
     http://localhost:8080/Files/hsimple.root/hpx/get.png?w=500&h=500&opt=lego1

  Return is memory with produced image
  Memory must be released by user with free(ptr) call
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 member
 Supported 'file' (case sensitive):
   "root.bin"  - binary data
   "root.png"  - png image
   "root.jpeg" - jpeg image
   "root.gif"  - gif image
   "root.xml"  - xml representation
   "root.json" - json representation
   "exe.json"  - method execution with json reply
   "exe.bin"   - method execution with binary reply
   "exe.txt"   - method execution with debug output
   "cmd.json"  - execution of registered commands
 Result returned either as string or binary buffer,
 which should be released with free() call
TObject * GetItem(const char* fullname, TFolder*& parent, Bool_t force = kFALSE, Bool_t within_objects = kTRUE)
 return item from the subfolders structure
TFolder * GetSubFolder(const char* foldername, Bool_t force = kFALSE)
 creates subfolder where objects can be registered
Bool_t RegisterObject(const char* subfolder, TObject* obj)
 Register object in subfolder structure
 subfolder parameter can have many levels like:

 TRootSniffer* sniff = new TRootSniffer("sniff");
 sniff->RegisterObject("my/sub/subfolder", h1);

 Such objects can be later found in "Objects" folder of sniffer like

 h1 = sniff->FindTObjectInHierarchy("/Objects/my/sub/subfolder/h1");

 If subfolder name starts with '/', object will be registered starting from top folder.

 One could provide additional fields for registered objects
 For instance, setting "_more" field to true let browser
 explore objects members. For instance:

 TEvent* ev = new TEvent("ev");
 sniff->RegisterObject("Events", ev);
 sniff->SetItemField("Events/ev", "_more", "true");
Bool_t UnregisterObject(TObject* obj)
 unregister (remove) object from folders structures
 folder itself will remain even when it will be empty
Bool_t CreateItem(const char* fullname, const char* title)
 create item element
Bool_t IsItemField(TObject* obj) const
 return true when object is TNamed with kItemField bit set
 such objects used to keep field values for item
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 hierarchy
Bool_t SetItemField(const char* fullname, const char* name, const char* value)
 set field for specified item
const char * GetItemField(TFolder* parent, TObject* item, const char* name)
 return field for specified item
const char * GetItemField(const char* fullname, const char* name)
 return field for specified item
Bool_t RegisterCommand(const char* cmdname, const char* method, const char* icon)
 Register command which can be executed from web interface

 As method one typically specifies string, which is executed with
 gROOT->ProcessLine() method. For instance
    serv->RegisterCommand("Invoke","InvokeFunction()");

 Or one could specify any method of the object which is already registered
 to the server. For instance:
     serv->Register("/", hpx);
     serv->RegisterCommand("/ResetHPX", "/hpx/->Reset()");
 Here symbols '/->' separates item name from method to be executed

 One could specify additional arguments in the command with
 syntax like %arg1%, %arg2% and so on. For example:
     serv->RegisterCommand("/ResetHPX", "/hpx/->SetTitle(\"%arg1%\")");
     serv->RegisterCommand("/RebinHPXPY", "/hpxpy/->Rebin2D(%arg1%,%arg2%)");
 Such parameter(s) will be requested when command clicked in the browser.

 Once command is registered, one could specify icon which will appear in the browser:
     serv->SetIcon("/ResetHPX", "rootsys/icons/ed_execute.png");

 One also can set extra property '_fastcmd', that command appear as
 tool button on the top of the browser tree:
     serv->SetItemField("/ResetHPX", "_fastcmd", "true");
 Or it is equivalent to specifying extra argument when register command:
     serv->RegisterCommand("/ResetHPX", "/hpx/->Reset()", "button;rootsys/icons/ed_delete.png");
Bool_t IsReadOnly(Bool_t dflt = kTRUE)
 Returns read-only flag for current item 
TRootSniffer(const char* name, const char* objpath = "Objects")
void SetReadOnly(Bool_t on = kTRUE)
 When readonly on (default), sniffer is not allowed to change ROOT structures
 For instance, it is not allowed to read new objects from files
void SetScanGlobalDir(Bool_t on = kTRUE)
 When enabled (default), sniffer scans gROOT for files, canvases, histograms
Bool_t IsScanGlobalDir() const
{ return fScanGlobalDir; }