#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, const char *_obj_name = 0);
void BeforeNextChild();
void SetField(const char *name, const char *value);
void SetRootClass(TClass *cl);
Bool_t CanExpandItem();
Bool_t SetResult(void *obj, TClass *cl, TDataMember *member = 0, Int_t chlds = -1);
Int_t Depth() const;
Int_t ExtraFolderLevel();
Bool_t Done();
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;
Int_t fCompression;
void ScanObjectMemebers(TRootSnifferScanRec &rec, TClass *cl, char *ptr, unsigned long int cloffset);
void ScanObject(TRootSnifferScanRec &rec, TObject *obj);
void ScanCollection(TRootSnifferScanRec &rec, TCollection *lst, const char *foldername = 0, Bool_t extra = kFALSE);
virtual void ScanRoot(TRootSnifferScanRec &rec);
void CreateMemFile();
Bool_t CreateBindData(TBufferFile *sbuf, void *&ptr, Long_t &length);
public:
TRootSniffer(const char *name, const char *objpath = "online");
virtual ~TRootSniffer();
static Bool_t IsDrawableClass(TClass *cl);
static Bool_t IsBrowsableClass(TClass *cl);
Bool_t RegisterObject(const char *subfolder, TObject *obj);
Bool_t UnregisterObject(TObject *obj);
void SetCompression(Int_t lvl)
{
fCompression = lvl;
}
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 Produce(const char *path, const char *file, const char *options, void *&ptr, Long_t &length);
ClassDef(TRootSniffer, 0)
};
#endif