ROOT  6.06/09
Reference Guide
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | List of all members
TRootSniffer Class Reference

Definition at line 116 of file TRootSniffer.h.

Public Member Functions

 TRootSniffer (const char *name, const char *objpath="Objects")
 
virtual ~TRootSniffer ()
 destructor More...
 
void SetReadOnly (Bool_t on=kTRUE)
 
Bool_t IsReadOnly () const
 
void Restrict (const char *path, const char *options)
 Restrict access to the specified location. More...
 
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. More...
 
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. More...
 
void SetScanGlobalDir (Bool_t on=kTRUE)
 
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. More...
 
const char * GetAutoLoad () const
 return name of configured autoload scripts (or 0) More...
 
Bool_t IsScanGlobalDir () const
 
Bool_t RegisterObject (const char *subfolder, TObject *obj)
 Register object in subfolder structure subfolder parameter can have many levels like: More...
 
Bool_t UnregisterObject (TObject *obj)
 unregister (remove) object from folders structures folder itself will remain even when it will be empty More...
 
Bool_t RegisterCommand (const char *cmdname, const char *method, const char *icon)
 Register command which can be executed from web interface. More...
 
Bool_t CreateItem (const char *fullname, const char *title)
 create item element More...
 
Bool_t SetItemField (const char *fullname, const char *name, const char *value)
 set field for specified item More...
 
const char * GetItemField (const char *fullname, const char *name)
 return field for specified item More...
 
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 More...
 
void ScanHierarchy (const char *topname, const char *path, TRootSnifferStore *store, Bool_t only_fields=kFALSE)
 Method scans normal objects, registered in ROOT. More...
 
TObjectFindTObjectInHierarchy (const char *path)
 Search element in hierarchy, derived from TObject. More...
 
virtual voidFindInHierarchy (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. More...
 
Bool_t CanDrawItem (const char *path)
 Method verifies if object can be drawn. More...
 
Bool_t CanExploreItem (const char *path)
 Method returns true when object has childs or one could try to expand item. More...
 
Bool_t IsStreamerInfoItem (const char *itemname)
 Return true if it is streamer info item name. More...
 
ULong_t GetStreamerInfoHash ()
 Returns hash value for streamer infos At the moment - just number of items in streamer infos list. More...
 
ULong_t GetItemHash (const char *itemname)
 Get hash function for specified item used to detect any changes in the specified object. More...
 
Bool_t ProduceJson (const char *path, const char *options, TString &res)
 produce JSON data for specified item For object conversion TBufferJSON is used More...
 
Bool_t ProduceXml (const char *path, const char *options, TString &res)
 produce XML data for specified item For object conversion TBufferXML is used More...
 
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 More...
 
Bool_t ProduceImage (Int_t kind, const char *path, const char *options, void *&ptr, Long_t &length)
 Method to produce image from specified object. More...
 
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 More...
 
Bool_t ExecuteCmd (const char *path, const char *options, TString &res)
 execute command marked as _kind=='Command' More...
 
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 More...
 
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 coded in the POST block and has individual request relative to current path, separated with '
' symbol like item1/root.bin
item2/exe.bin?method=GetList
item3/exe.bin?method=GetTitle
Request requires 'number' URL option which contains number of requested items. More...
 
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. More...
 
- Public Member Functions inherited from TNamed
 TNamed ()
 
 TNamed (const char *name, const char *title)
 
 TNamed (const TString &name, const TString &title)
 
 TNamed (const TNamed &named)
 
TNamedoperator= (const TNamed &rhs)
 TNamed assignment operator. More...
 
virtual ~TNamed ()
 
virtual void Clear (Option_t *option="")
 Set name and title to empty strings (""). More...
 
virtual TObjectClone (const char *newname="") const
 Make a clone of an object using the Streamer facility. More...
 
virtual Int_t Compare (const TObject *obj) const
 Compare two TNamed objects. More...
 
virtual void Copy (TObject &named) const
 Copy this to obj. More...
 
virtual void FillBuffer (char *&buffer)
 Encode TNamed into output buffer. More...
 
virtual const char * GetName () const
 Returns name of object. More...
 
virtual const char * GetTitle () const
 Returns title of object. More...
 
virtual ULong_t Hash () const
 Return hash value for this object. More...
 
virtual Bool_t IsSortable () const
 
virtual void SetName (const char *name)
 Change (i.e. More...
 
virtual void SetNameTitle (const char *name, const char *title)
 Change (i.e. set) all the TNamed parameters (name and title). More...
 
virtual void SetTitle (const char *title="")
 Change (i.e. set) the title of the TNamed. More...
 
virtual void ls (Option_t *option="") const
 List TNamed name and title. More...
 
virtual void Print (Option_t *option="") const
 Print TNamed name and title. More...
 
virtual Int_t Sizeof () const
 Return size of the TNamed part of the TObject. More...
 
- Public Member Functions inherited from TObject
 TObject ()
 
 TObject (const TObject &object)
 TObject copy ctor. More...
 
TObjectoperator= (const TObject &rhs)
 TObject assignment operator. More...
 
virtual ~TObject ()
 TObject destructor. More...
 
virtual void AppendPad (Option_t *option="")
 Append graphics object to current pad. More...
 
virtual void Browse (TBrowser *b)
 Browse object. May be overridden for another default action. More...
 
virtual const char * ClassName () const
 Returns name of class to which the object belongs. More...
 
virtual void Delete (Option_t *option="")
 Delete this object. More...
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 Computes distance from point (px,py) to the object. More...
 
virtual void Draw (Option_t *option="")
 Default Draw method for all objects. More...
 
virtual void DrawClass () const
 Draw class inheritance tree of the class to which this object belongs. More...
 
virtual TObjectDrawClone (Option_t *option="") const
 Draw a clone of this object in the current pad. More...
 
virtual void Dump () const
 Dump contents of object on stdout. More...
 
virtual void Execute (const char *method, const char *params, Int_t *error=0)
 Execute method on this object with the given parameter string, e.g. More...
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=0)
 Execute method on this object with parameters stored in the TObjArray. More...
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 Execute action corresponding to an event at (px,py). More...
 
virtual TObjectFindObject (const char *name) const
 Must be redefined in derived classes. More...
 
virtual TObjectFindObject (const TObject *obj) const
 Must be redefined in derived classes. More...
 
virtual Option_tGetDrawOption () const
 Get option used by the graphics system to draw this object. More...
 
virtual UInt_t GetUniqueID () const
 Return the unique object id. More...
 
virtual const char * GetIconName () const
 Returns mime type name of object. More...
 
virtual Option_tGetOption () const
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 Returns string containing info about the object at position (px,py). More...
 
virtual Bool_t HandleTimer (TTimer *timer)
 Execute action in response of a timer timing out. More...
 
virtual Bool_t InheritsFrom (const char *classname) const
 Returns kTRUE if object inherits from class "classname". More...
 
virtual Bool_t InheritsFrom (const TClass *cl) const
 Returns kTRUE if object inherits from TClass cl. More...
 
virtual void Inspect () const
 Dump contents of this object in a graphics canvas. More...
 
virtual Bool_t IsFolder () const
 Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More...
 
virtual Bool_t IsEqual (const TObject *obj) const
 Default equal comparison (objects are equal if they have the same address in memory). More...
 
Bool_t IsOnHeap () const
 
Bool_t IsZombie () const
 
virtual Bool_t Notify ()
 This method must be overridden to handle object notification. More...
 
virtual void Paint (Option_t *option="")
 This method must be overridden if a class wants to paint itself. More...
 
virtual void Pop ()
 Pop on object drawn in a pad to the top of the display list. More...
 
virtual Int_t Read (const char *name)
 Read contents of object with specified name from the current directory. More...
 
virtual void RecursiveRemove (TObject *obj)
 Recursively remove this object from a list. More...
 
virtual void SaveAs (const char *filename="", Option_t *option="") const
 Save this object in the file specified by filename. More...
 
virtual void SavePrimitive (std::ostream &out, Option_t *option="")
 Save a primitive as a C++ statement(s) on output stream "out". More...
 
virtual void SetDrawOption (Option_t *option="")
 Set drawing option for object. More...
 
virtual void SetUniqueID (UInt_t uid)
 Set the unique object id. More...
 
virtual void UseCurrentStyle ()
 Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. More...
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0)
 Write this object to the current directory. More...
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const
 Write this object to the current directory. More...
 
voidoperator new (size_t sz)
 
voidoperator new[] (size_t sz)
 
voidoperator new (size_t sz, void *vp)
 
voidoperator new[] (size_t sz, void *vp)
 
void operator delete (void *ptr)
 Operator delete. More...
 
void operator delete[] (void *ptr)
 Operator delete []. More...
 
void SetBit (UInt_t f, Bool_t set)
 Set or unset the user status bits as specified in f. More...
 
void SetBit (UInt_t f)
 
void ResetBit (UInt_t f)
 
Bool_t TestBit (UInt_t f) const
 
Int_t TestBits (UInt_t f) const
 
void InvertBit (UInt_t f)
 
virtual void Info (const char *method, const char *msgfmt,...) const
 Issue info message. More...
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 Issue warning message. More...
 
virtual void Error (const char *method, const char *msgfmt,...) const
 Issue error message. More...
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 Issue system error message. More...
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 Issue fatal error message. More...
 
void AbstractMethod (const char *method) const
 Use this method to implement an "abstract" method that you don't want to leave purely abstract. More...
 
void MayNotUse (const char *method) const
 Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). More...
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 Use this method to declare a method obsolete. More...
 

Static Public Member Functions

static Bool_t IsDrawableClass (TClass *cl)
 return true if object can be drawn More...
 
- Static Public Member Functions inherited from TObject
static Long_t GetDtorOnly ()
 Return destructor only flag. More...
 
static void SetDtorOnly (void *obj)
 Set destructor only flag. More...
 
static Bool_t GetObjectStat ()
 Get status of object stat flag. More...
 
static void SetObjectStat (Bool_t stat)
 Turn on/off tracking of objects in the TObjectTable. More...
 

Protected Member Functions

void ScanObjectMembers (TRootSnifferScanRec &rec, TClass *cl, char *ptr)
 scripts names, which are add as _autoload parameter to h.json request More...
 
virtual 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 By default properties, coded in the Class title are scanned. More...
 
virtual void ScanObjectChilds (TRootSnifferScanRec &rec, TObject *obj)
 scans object childs (if any) here one scans collection, branches, trees and so on More...
 
void ScanCollection (TRootSnifferScanRec &rec, TCollection *lst, const char *foldername=0, TCollection *keys_lst=0)
 scan collection content More...
 
virtual 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. More...
 
void CreateMemFile ()
 Creates TMemFile instance, which used for objects streaming One could not use TBufferFile directly, while one also require streamer infos list. More...
 
TString DecodeUrlOptionValue (const char *value, Bool_t remove_quotes=kTRUE)
 method replaces all kind of special symbols, which could appear in URL options More...
 
TObjectGetItem (const char *fullname, TFolder *&parent, Bool_t force=kFALSE, Bool_t within_objects=kTRUE)
 return item from the subfolders structure More...
 
TFolderGetSubFolder (const char *foldername, Bool_t force=kFALSE)
 creates subfolder where objects can be registered More...
 
const char * GetItemField (TFolder *parent, TObject *item, const char *name)
 return field for specified item More...
 
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 More...
 
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 More...
 
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 More...
 
- Protected Member Functions inherited from TObject
void MakeZombie ()
 
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
 Interface to ErrorHandler (protected). More...
 

Protected Attributes

TString fObjectsPath
 
TMemFilefMemFile
 default path for registered objects More...
 
TListfSinfo
 file used to manage streamer infos More...
 
Bool_t fReadOnly
 last produced streamer info More...
 
Bool_t fScanGlobalDir
 indicate if sniffer allowed to change ROOT structures - for instance, read objects from files More...
 
THttpCallArgfCurrentArg
 when enabled (default), scan gROOT for histograms, canvases, open files More...
 
Int_t fCurrentRestrict
 current http arguments (if any) More...
 
TString fCurrentAllowedMethods
 current restriction for last-found object More...
 
TList fRestrictions
 list of allowed methods, extracted when analyzed object restrictions More...
 
TString fAutoLoad
 list of restrictions for different locations More...
 
- Protected Attributes inherited from TNamed
TString fName
 
TString fTitle
 

Private Types

enum  { kItemField = BIT(21) }
 

Additional Inherited Members

- Public Types inherited from TObject
enum  EStatusBits {
  kCanDelete = BIT(0), kMustCleanup = BIT(3), kObjInCanvas = BIT(3), kIsReferenced = BIT(4),
  kHasUUID = BIT(5), kCannotPick = BIT(6), kNoContextMenu = BIT(8), kInvalidObject = BIT(13)
}
 
enum  { kIsOnHeap = 0x01000000, kNotDeleted = 0x02000000, kZombie = 0x04000000, kBitMask = 0x00ffffff }
 
enum  { kSingleKey = BIT(0), kOverwrite = BIT(1), kWriteDelete = BIT(2) }
 

#include <TRootSniffer.h>

+ Inheritance diagram for TRootSniffer:
+ Collaboration diagram for TRootSniffer:

Member Enumeration Documentation

anonymous enum
private
Enumerator
kItemField 

Definition at line 117 of file TRootSniffer.h.

Constructor & Destructor Documentation

TRootSniffer::TRootSniffer ( const char *  name,
const char *  objpath = "Objects" 
)
TRootSniffer::~TRootSniffer ( )
virtual

destructor

Definition at line 438 of file TRootSniffer.cxx.

Member Function Documentation

Bool_t TRootSniffer::AccessField ( TFolder parent,
TObject item,
const char *  name,
const char *  value,
TNamed **  only_get = 0 
)
protected

set or get field for the child each field coded as TNamed object, placed after chld in the parent hierarchy

Definition at line 2104 of file TRootSniffer.cxx.

Referenced by GetItemField(), and SetItemField().

Bool_t TRootSniffer::CanDrawItem ( const char *  path)

Method verifies if object can be drawn.

Definition at line 1055 of file TRootSniffer.cxx.

Bool_t TRootSniffer::CanExploreItem ( const char *  path)

Method returns true when object has childs or one could try to expand item.

Definition at line 1066 of file TRootSniffer.cxx.

Int_t TRootSniffer::CheckRestriction ( const char *  full_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

Definition at line 554 of file TRootSniffer.cxx.

Referenced by TRootSnifferScanRec::GoInside().

Bool_t TRootSniffer::CreateItem ( const char *  fullname,
const char *  title 
)

create item element

Definition at line 2081 of file TRootSniffer.cxx.

Referenced by THttpServer::CreateItem(), and RegisterCommand().

void TRootSniffer::CreateMemFile ( )
protected

Creates TMemFile instance, which used for objects streaming One could not use TBufferFile directly, while one also require streamer infos list.

Definition at line 1079 of file TRootSniffer.cxx.

Referenced by FindInHierarchy(), and ProduceBinary().

TString TRootSniffer::DecodeUrlOptionValue ( const char *  value,
Bool_t  remove_quotes = kTRUE 
)
protected

method replaces all kind of special symbols, which could appear in URL options

Definition at line 1274 of file TRootSniffer.cxx.

Referenced by ExecuteCmd(), and ProduceExe().

Bool_t TRootSniffer::ExecuteCmd ( const char *  path,
const char *  options,
TString res 
)

execute command marked as _kind=='Command'

Definition at line 1154 of file TRootSniffer.cxx.

Referenced by Produce().

void * TRootSniffer::FindInHierarchy ( const char *  path,
TClass **  cl = 0,
TDataMember **  member = 0,
Int_t chld = 0 
)
virtual

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)

Definition at line 972 of file TRootSniffer.cxx.

Referenced by CanDrawItem(), CanExploreItem(), ExecuteCmd(), FindTObjectInHierarchy(), ProduceBinary(), ProduceExe(), ProduceImage(), ProduceJson(), and ProduceXml().

TObject * TRootSniffer::FindTObjectInHierarchy ( const char *  path)

Search element in hierarchy, derived from TObject.

Definition at line 1021 of file TRootSniffer.cxx.

Referenced by ExecuteCmd(), and GetItemHash().

const char * TRootSniffer::GetAutoLoad ( ) const

return name of configured autoload scripts (or 0)

Definition at line 503 of file TRootSniffer.cxx.

Referenced by TRootSnifferScanRec::GoInside(), and ScanHierarchy().

TObject * TRootSniffer::GetItem ( const char *  fullname,
TFolder *&  parent,
Bool_t  force = kFALSE,
Bool_t  within_objects = kTRUE 
)
protected

return item from the subfolders structure

Definition at line 1958 of file TRootSniffer.cxx.

Referenced by ExecuteCmd(), GetItemField(), GetSubFolder(), and SetItemField().

const char * TRootSniffer::GetItemField ( TFolder parent,
TObject item,
const char *  name 
)
protected

return field for specified item

Definition at line 2192 of file TRootSniffer.cxx.

Referenced by ExecuteCmd(), THttpServer::GetItemField(), and GetItemField().

const char * TRootSniffer::GetItemField ( const char *  fullname,
const char *  name 
)

return field for specified item

Definition at line 2207 of file TRootSniffer.cxx.

ULong_t TRootSniffer::GetItemHash ( const char *  itemname)

Get hash function for specified item used to detect any changes in the specified object.

Definition at line 1043 of file TRootSniffer.cxx.

ULong_t TRootSniffer::GetStreamerInfoHash ( )

Returns hash value for streamer infos At the moment - just number of items in streamer infos list.

Definition at line 1034 of file TRootSniffer.cxx.

Referenced by GetItemHash(), and THttpServer::ProcessRequest().

TFolder * TRootSniffer::GetSubFolder ( const char *  foldername,
Bool_t  force = kFALSE 
)
protected

creates subfolder where objects can be registered

Definition at line 2016 of file TRootSniffer.cxx.

Referenced by CreateItem(), and RegisterObject().

Bool_t TRootSniffer::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.

Definition at line 512 of file TRootSniffer.cxx.

Referenced by TRootSnifferScanRec::GoInside().

Bool_t TRootSniffer::IsDrawableClass ( TClass cl)
static

return true if object can be drawn

Definition at line 922 of file TRootSniffer.cxx.

Referenced by CanDrawItem(), and ProduceImage().

Bool_t TRootSniffer::IsItemField ( TObject obj) const
protected

return true when object is TNamed with kItemField bit set such objects used to keep field values for item

Definition at line 2095 of file TRootSniffer.cxx.

Referenced by AccessField(), GetItem(), and ScanCollection().

Bool_t TRootSniffer::IsReadOnly ( ) const
inline

Definition at line 177 of file TRootSniffer.h.

Referenced by THttpServer::IsReadOnly().

Bool_t TRootSniffer::IsScanGlobalDir ( ) const
inline

Definition at line 201 of file TRootSniffer.h.

Referenced by ScanRoot().

Bool_t TRootSniffer::IsStreamerInfoItem ( const char *  itemname)

Return true if it is streamer info item name.

Definition at line 1721 of file TRootSniffer.cxx.

Referenced by FindInHierarchy(), GetItemHash(), and THttpServer::ProcessRequest().

Bool_t TRootSniffer::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.

Definition at line 1904 of file TRootSniffer.cxx.

Referenced by THttpServer::ProcessRequest(), and ProduceMulti().

Bool_t TRootSniffer::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

Definition at line 1732 of file TRootSniffer.cxx.

Referenced by Produce().

Bool_t TRootSniffer::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

Definition at line 1303 of file TRootSniffer.cxx.

Referenced by Produce().

Bool_t TRootSniffer::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

Definition at line 1800 of file TRootSniffer.cxx.

Referenced by Produce().

Bool_t TRootSniffer::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

Definition at line 1238 of file TRootSniffer.cxx.

Referenced by Produce().

Bool_t TRootSniffer::ProduceJson ( const char *  path,
const char *  options,
TString res 
)

produce JSON data for specified item For object conversion TBufferJSON is used

Definition at line 1127 of file TRootSniffer.cxx.

Referenced by Produce().

Bool_t TRootSniffer::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 coded in the POST block and has individual request relative to current path, separated with '
' symbol like item1/root.bin
item2/exe.bin?method=GetList
item3/exe.bin?method=GetTitle
Request requires 'number' URL option which contains number of requested items.

In case of binary request output buffer looks like: 4bytes length + payload, 4bytes length + payload, ... In case of JSON request output is array with results for each item multi.json request do not support binary requests for the items

Definition at line 1621 of file TRootSniffer.cxx.

Referenced by Produce().

Bool_t TRootSniffer::ProduceXml ( const char *  path,
const char *  options,
TString res 
)

produce XML data for specified item For object conversion TBufferXML is used

Definition at line 1255 of file TRootSniffer.cxx.

Referenced by Produce().

Bool_t TRootSniffer::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");

Definition at line 2246 of file TRootSniffer.cxx.

Referenced by THttpServer::RegisterCommand().

Bool_t TRootSniffer::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");

Definition at line 2044 of file TRootSniffer.cxx.

Referenced by THttpServer::Register().

void TRootSniffer::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");

Definition at line 481 of file TRootSniffer.cxx.

Referenced by THttpServer::Restrict().

void TRootSniffer::ScanCollection ( TRootSnifferScanRec rec,
TCollection lst,
const char *  foldername = 0,
TCollection keys_lst = 0 
)
protected

scan collection content

Definition at line 743 of file TRootSniffer.cxx.

Referenced by ScanObjectChilds(), ScanObjectMembers(), and ScanRoot().

void TRootSniffer::ScanHierarchy ( const char *  topname,
const char *  path,
TRootSnifferStore store,
Bool_t  only_fields = kFALSE 
)

Method scans normal objects, registered in ROOT.

scan ROOT hierarchy with provided store object

Definition at line 935 of file TRootSniffer.cxx.

Referenced by THttpServer::ProcessRequest(), and ProduceItem().

void TRootSniffer::ScanObjectChilds ( TRootSnifferScanRec rec,
TObject obj 
)
protectedvirtual

scans object childs (if any) here one scans collection, branches, trees and so on

Definition at line 720 of file TRootSniffer.cxx.

Referenced by ScanCollection().

void TRootSniffer::ScanObjectMembers ( TRootSnifferScanRec rec,
TClass cl,
char *  ptr 
)
protected

scripts names, which are add as _autoload parameter to h.json request

scan object data members some members like enum or static members will be excluded

Definition at line 603 of file TRootSniffer.cxx.

Referenced by ScanObjectChilds().

void TRootSniffer::ScanObjectProperties ( TRootSnifferScanRec rec,
TObject obj 
)
protectedvirtual

scans object properties here such fields as _autoload or _icon properties depending on class or object name could be assigned By default properties, coded in the Class title are scanned.

Example: ClassDef(UserClassName, 1) // class comments SNIFF _field1=value _field2="string value" Here SNIFF mark is important. After it all expressions like field=value are parsed One could use double quotes to code string values with spaces. Fields separated from each other with spaces

Definition at line 688 of file TRootSniffer.cxx.

Referenced by ScanCollection().

void TRootSniffer::ScanRoot ( TRootSnifferScanRec rec)
protectedvirtual

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

Definition at line 887 of file TRootSniffer.cxx.

Referenced by FindInHierarchy(), and ScanHierarchy().

void TRootSniffer::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.

Definition at line 495 of file TRootSniffer.cxx.

void TRootSniffer::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

Definition at line 457 of file TRootSniffer.cxx.

Referenced by THttpServer::ProcessRequests().

Bool_t TRootSniffer::SetItemField ( const char *  fullname,
const char *  name,
const char *  value 
)

set field for specified item

Definition at line 2172 of file TRootSniffer.cxx.

Referenced by RegisterCommand(), and THttpServer::SetItemField().

void TRootSniffer::SetReadOnly ( Bool_t  on = kTRUE)
inline

Definition at line 169 of file TRootSniffer.h.

Referenced by THttpServer::SetReadOnly().

void TRootSniffer::SetScanGlobalDir ( Bool_t  on = kTRUE)
inline

Definition at line 190 of file TRootSniffer.h.

Bool_t TRootSniffer::UnregisterObject ( TObject obj)

unregister (remove) object from folders structures folder itself will remain even when it will be empty

Definition at line 2061 of file TRootSniffer.cxx.

Referenced by THttpServer::Unregister().

Int_t TRootSniffer::WithCurrentUserName ( const char *  option)
protected

return 2 when option match to current user name return 1 when option==all return 0 when option does not match user name

Definition at line 524 of file TRootSniffer.cxx.

Referenced by CheckRestriction().

Member Data Documentation

TString TRootSniffer::fAutoLoad
protected

list of restrictions for different locations

Definition at line 130 of file TRootSniffer.h.

Referenced by GetAutoLoad(), and SetAutoLoad().

TString TRootSniffer::fCurrentAllowedMethods
protected

current restriction for last-found object

Definition at line 128 of file TRootSniffer.h.

Referenced by CheckRestriction(), ProduceExe(), and SetCurrentCallArg().

THttpCallArg* TRootSniffer::fCurrentArg
protected

when enabled (default), scan gROOT for histograms, canvases, open files

Definition at line 126 of file TRootSniffer.h.

Referenced by HasRestriction(), ProduceBinary(), ProduceExe(), ProduceMulti(), ScanRoot(), SetCurrentCallArg(), and WithCurrentUserName().

Int_t TRootSniffer::fCurrentRestrict
protected

current http arguments (if any)

Definition at line 127 of file TRootSniffer.h.

Referenced by ExecuteCmd(), FindInHierarchy(), ProduceExe(), and SetCurrentCallArg().

TMemFile* TRootSniffer::fMemFile
protected

default path for registered objects

Definition at line 122 of file TRootSniffer.h.

Referenced by CreateMemFile(), ProduceBinary(), and ~TRootSniffer().

TString TRootSniffer::fObjectsPath
protected

Definition at line 121 of file TRootSniffer.h.

Referenced by GetItem().

Bool_t TRootSniffer::fReadOnly
protected

last produced streamer info

Definition at line 124 of file TRootSniffer.h.

Referenced by IsReadOnly(), ProduceExe(), ScanCollection(), and ScanObjectChilds().

TList TRootSniffer::fRestrictions
protected

list of allowed methods, extracted when analyzed object restrictions

Definition at line 129 of file TRootSniffer.h.

Referenced by CheckRestriction(), ExecuteCmd(), HasRestriction(), and Restrict().

Bool_t TRootSniffer::fScanGlobalDir
protected

indicate if sniffer allowed to change ROOT structures - for instance, read objects from files

Definition at line 125 of file TRootSniffer.h.

Referenced by IsScanGlobalDir().

TList* TRootSniffer::fSinfo
protected

file used to manage streamer infos

Definition at line 123 of file TRootSniffer.h.

Referenced by CreateMemFile(), FindInHierarchy(), GetStreamerInfoHash(), ProduceBinary(), and ~TRootSniffer().


The documentation for this class was generated from the following files: