Logo ROOT   6.08/07
Reference Guide
TRootSnifferStore.h
Go to the documentation of this file.
1 // $Id$
2 // Author: Sergey Linev 22/12/2013
3 
4 #ifndef ROOT_TRootSnifferStore
5 #define ROOT_TRootSnifferStore
6 
7 #ifndef ROOT_TObject
8 #include "TObject.h"
9 #endif
10 
11 #ifndef ROOT_TString
12 #include "TString.h"
13 #endif
14 
15 class TDataMember;
16 class TFolder;
17 
18 /** Abstract interface for storage of hierarchy scan in TRootSniffer */
19 
20 class TRootSnifferStore : public TObject {
21 protected:
22  void *fResPtr; //! pointer on found item
23  TClass *fResClass; //! class of found item
24  TDataMember *fResMember; //! datamember pointer of found item
25  Int_t fResNumChilds; //! count of found childs, -1 by default
26  Int_t fResRestrict; //! restriction for result, 0-default, 1-readonly, 2-full
27 public:
29  virtual ~TRootSnifferStore();
30 
31  virtual void CreateNode(Int_t, const char *) {}
32  virtual void SetField(Int_t, const char *, const char *, Bool_t) {}
33  virtual void BeforeNextChild(Int_t, Int_t, Int_t) {}
34  virtual void CloseNode(Int_t, Int_t) {}
35 
36  void SetResult(void *_res, TClass *_rescl, TDataMember *_resmemb,
37  Int_t _res_chld, Int_t restr = 0);
38 
39  void *GetResPtr() const
40  {
41  return fResPtr;
42  }
44  {
45  return fResClass;
46  }
48  {
49  return fResMember;
50  }
52  {
53  return fResNumChilds;
54  }
56  {
57  return fResRestrict;
58  }
59  virtual Bool_t IsXml() const
60  {
61  return kFALSE;
62  }
63 
64  ClassDef(TRootSnifferStore, 0) // structure for results store of objects sniffer
65 };
66 
67 // ========================================================================
68 
69 /** Storage of hierarchy scan in TRootSniffer in XML format */
70 
72 protected:
73  TString *fBuf; //! output buffer
74  Bool_t fCompact; //! produce compact xml code
75 
76 public:
79  fBuf(&_buf),
80  fCompact(_compact) {}
81 
82  virtual ~TRootSnifferStoreXml() {}
83 
84  virtual void CreateNode(Int_t lvl, const char *nodename);
85  virtual void SetField(Int_t lvl, const char *field, const char *value, Bool_t);
86  virtual void BeforeNextChild(Int_t lvl, Int_t nchld, Int_t);
87  virtual void CloseNode(Int_t lvl, Int_t numchilds);
88 
89  virtual Bool_t IsXml() const
90  {
91  return kTRUE;
92  }
93 
94  ClassDef(TRootSnifferStoreXml, 0) // xml results store of objects sniffer
95 };
96 
97 // ========================================================================
98 
99 /** Storage of hierarchy scan in TRootSniffer in JSON format */
100 
102 protected:
103  TString *fBuf; //! output buffer
104  Bool_t fCompact; //! produce compact json code
105 public:
108  fBuf(&_buf),
109  fCompact(_compact) {}
111 
112  virtual void CreateNode(Int_t lvl, const char *nodename);
113  virtual void SetField(Int_t lvl, const char *field, const char *value, Bool_t with_quotes);
114  virtual void BeforeNextChild(Int_t lvl, Int_t nchld, Int_t nfld);
115  virtual void CloseNode(Int_t lvl, Int_t numchilds);
116 
117  ClassDef(TRootSnifferStoreJson, 0) // json results store of objects sniffer
118 };
119 
120 
121 #endif
A TFolder object is a collection of objects and folders.
Definition: TFolder.h:32
virtual Bool_t IsXml() const
TClass * GetResClass() const
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:33
Storage of hierarchy scan in TRootSniffer in JSON format.
Bool_t fCompact
output buffer
void * GetResPtr() const
Basic string class.
Definition: TString.h:137
TDataMember * fResMember
class of found item
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual Bool_t IsXml() const
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void BeforeNextChild(Int_t, Int_t, Int_t)
Int_t fResRestrict
count of found childs, -1 by default
Int_t fResNumChilds
datamember pointer of found item
Abstract interface for storage of hierarchy scan in TRootSniffer.
virtual ~TRootSnifferStore()
destructor
TRootSnifferStore()
restriction for result, 0-default, 1-readonly, 2-full
#define ClassDef(name, id)
Definition: Rtypes.h:254
TRootSnifferStoreJson(TString &_buf, Bool_t _compact=kFALSE)
produce compact json code
Storage of hierarchy scan in TRootSniffer in XML format.
Int_t GetResNumChilds() const
Int_t GetResRestrict() const
TRootSnifferStoreXml(TString &_buf, Bool_t _compact=kFALSE)
produce compact xml code
Bool_t fCompact
output buffer
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
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
TDataMember * GetResMember() const
TClass * fResClass
pointer on found item
virtual void CreateNode(Int_t, const char *)
Mother of all ROOT objects.
Definition: TObject.h:37
virtual void SetField(Int_t, const char *, const char *, Bool_t)
virtual void CloseNode(Int_t, Int_t)
const Bool_t kTRUE
Definition: Rtypes.h:91