#ifndef ROOT_TRootSniffer
#define ROOT_TRootSniffer
#ifndef ROOT_TNamed
#include "TNamed.h"
#endif
#ifndef ROOT_TList
#include "TList.h"
#endif
enum {
mask_Scan = 0x0001,
mask_Expand = 0x0002,
mask_Search = 0x0004,
mask_CheckChld = 0x0008,
mask_Actions = 0x000F,
mask_ExtraFolder = 0x0010
};
class TMemFile;
class TBufferFile;
class TDataMember;
class TRootSnifferStore;
class TRootSnifferScanRec {
public:
TRootSnifferScanRec *parent;
UInt_t mask;
const char *searchpath;
Int_t lvl;
TList fItemsNames;
TRootSnifferStore *store;
Bool_t has_more;
TString started_node;
Int_t num_fields;
Int_t num_childs;
TRootSnifferScanRec();
virtual ~TRootSnifferScanRec();
void CloseNode();
Bool_t CanSetFields()
{
return (mask & mask_Scan) && (store != 0);
}
void CreateNode(const char *_node_name);
void BeforeNextChild();
void SetField(const char *name, const char *value, Bool_t with_quotes = kTRUE);
void SetRootClass(TClass *cl);
Bool_t CanExpandItem();
Bool_t IsReadyForResult() const;
Bool_t SetResult(void *obj, TClass *cl, TDataMember *member = 0, Int_t chlds = -1);
Int_t Depth() const;
Int_t ExtraFolderLevel();
Bool_t Done() const;
void MakeItemName(const char *objname, TString& itemname);
Bool_t GoInside(TRootSnifferScanRec &super, TObject *obj, const char *obj_name = 0);
ClassDef(TRootSnifferScanRec, 0)
};
class TRootSniffer : public TNamed {
protected:
TString fObjectsPath;
TMemFile *fMemFile;
Int_t fSinfoSize;
Bool_t fReadOnly;
void ScanObjectMemebers(TRootSnifferScanRec &rec, TClass *cl, char *ptr, unsigned long int cloffset);
void ScanObject(TRootSnifferScanRec &rec, TObject *obj);
virtual void ScanObjectProperties(TRootSnifferScanRec &rec, TObject* &obj, TClass* &obj_class);
virtual void ScanObjectChilds(TRootSnifferScanRec &rec, TObject *obj);
void ScanCollection(TRootSnifferScanRec &rec, TCollection *lst,
const char *foldername = 0, Bool_t extra = kFALSE, TCollection* keys_lst = 0);
virtual void ScanRoot(TRootSnifferScanRec &rec);
void CreateMemFile();
TString DecodeUrlOptionValue(const char* value, Bool_t remove_quotes = kTRUE);
public:
TRootSniffer(const char *name, const char *objpath = "online");
virtual ~TRootSniffer();
static Bool_t IsDrawableClass(TClass *cl);
void SetReadOnly(Bool_t on = kTRUE) { fReadOnly = on; }
Bool_t IsReadOnly() const { return fReadOnly; }
Bool_t RegisterObject(const char *subfolder, TObject *obj);
Bool_t UnregisterObject(TObject *obj);
void ScanHierarchy(const char *topname, const char *path, TRootSnifferStore *store);
TObject *FindTObjectInHierarchy(const char *path);
virtual void *FindInHierarchy(const char *path, TClass **cl = 0, TDataMember **member = 0, Int_t *chld = 0);
Bool_t CanDrawItem(const char *path);
Bool_t CanExploreItem(const char *path);
Bool_t IsStreamerInfoItem(const char *itemname);
ULong_t GetStreamerInfoHash();
ULong_t GetItemHash(const char *itemname);
Bool_t ProduceJson(const char *path, const char *options, TString &res);
Bool_t ProduceXml(const char *path, const char *options, TString &res);
Bool_t ProduceBinary(const char *path, const char *options, void *&ptr, Long_t &length);
Bool_t ProduceImage(Int_t kind, const char *path, const char *options, void *&ptr, Long_t &length);
Bool_t ProduceExe(const char *path, const char *options, TString &res, Bool_t astxt = kFALSE);
Bool_t Produce(const char *path, const char *file, const char *options, void *&ptr, Long_t &length);
ClassDef(TRootSniffer, 0)
};
#endif