Logo ROOT   6.14/05
Reference Guide
TRootSnifferStore.h
Go to the documentation of this file.
1 // $Id$
2 // Author: Sergey Linev 22/12/2013
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TRootSnifferStore
13 #define ROOT_TRootSnifferStore
14 
15 #include "TObject.h"
16 
17 #include "TString.h"
18 
19 class TDataMember;
20 class TFolder;
21 
22 /** Abstract interface for storage of hierarchy scan in TRootSniffer */
23 
24 class TRootSnifferStore : public TObject {
25 protected:
26  void *fResPtr; ///<! pointer on found item
27  TClass *fResClass; ///<! class of found item
28  TDataMember *fResMember; ///<! datamember pointer of found item
29  Int_t fResNumChilds; ///<! count of found childs, -1 by default
30  Int_t fResRestrict; ///<! restriction for result, 0-default, 1-readonly, 2-full
31 public:
33  virtual ~TRootSnifferStore();
34 
35  virtual void CreateNode(Int_t, const char *) {}
36  virtual void SetField(Int_t, const char *, const char *, Bool_t) {}
37  virtual void BeforeNextChild(Int_t, Int_t, Int_t) {}
38  virtual void CloseNode(Int_t, Int_t) {}
39 
40  void SetResult(void *_res, TClass *_rescl, TDataMember *_resmemb, Int_t _res_chld, Int_t restr = 0);
41 
42  void *GetResPtr() const { return fResPtr; }
43  TClass *GetResClass() const { return fResClass; }
44  TDataMember *GetResMember() const { return fResMember; }
45  Int_t GetResNumChilds() const { return fResNumChilds; }
46  Int_t GetResRestrict() const { return fResRestrict; }
47  virtual Bool_t IsXml() const { return kFALSE; }
48 
49  ClassDef(TRootSnifferStore, 0) // structure for results store of objects sniffer
50 };
51 
52 // ========================================================================
53 
54 /** Storage of hierarchy scan in TRootSniffer in XML format */
55 
57 protected:
58  TString *fBuf; ///<! output buffer
59  Bool_t fCompact; ///<! produce compact xml code
60 
61 public:
62  TRootSnifferStoreXml(TString &_buf, Bool_t _compact = kFALSE) : TRootSnifferStore(), fBuf(&_buf), fCompact(_compact)
63  {
64  }
65 
66  virtual ~TRootSnifferStoreXml() {}
67 
68  virtual void CreateNode(Int_t lvl, const char *nodename);
69  virtual void SetField(Int_t lvl, const char *field, const char *value, Bool_t);
70  virtual void BeforeNextChild(Int_t lvl, Int_t nchld, Int_t);
71  virtual void CloseNode(Int_t lvl, Int_t numchilds);
72 
73  virtual Bool_t IsXml() const { return kTRUE; }
74 
75  ClassDef(TRootSnifferStoreXml, 0) // xml results store of objects sniffer
76 };
77 
78 // ========================================================================
79 
80 /** Storage of hierarchy scan in TRootSniffer in JSON format */
81 
83 protected:
84  TString *fBuf; ///<! output buffer
85  Bool_t fCompact; ///<! produce compact json code
86 public:
87  TRootSnifferStoreJson(TString &_buf, Bool_t _compact = kFALSE) : TRootSnifferStore(), fBuf(&_buf), fCompact(_compact)
88  {
89  }
91 
92  virtual void CreateNode(Int_t lvl, const char *nodename);
93  virtual void SetField(Int_t lvl, const char *field, const char *value, Bool_t with_quotes);
94  virtual void BeforeNextChild(Int_t lvl, Int_t nchld, Int_t nfld);
95  virtual void CloseNode(Int_t lvl, Int_t numchilds);
96 
97  ClassDef(TRootSnifferStoreJson, 0) // json results store of objects sniffer
98 };
99 
100 #endif
A TFolder object is a collection of objects and folders.
Definition: TFolder.h:30
virtual Bool_t IsXml() const
void * fResPtr
! pointer on found item
TClass * GetResClass() const
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:31
Storage of hierarchy scan in TRootSniffer in JSON format.
Bool_t fCompact
! produce compact json code
void * GetResPtr() const
TString * fBuf
! output buffer
Basic string class.
Definition: TString.h:131
TDataMember * fResMember
! datamember pointer of found item
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual Bool_t IsXml() const
virtual void BeforeNextChild(Int_t, Int_t, Int_t)
Int_t fResRestrict
! restriction for result, 0-default, 1-readonly, 2-full
Int_t fResNumChilds
! count of found childs, -1 by default
Abstract interface for storage of hierarchy scan in TRootSniffer.
TString * fBuf
! output buffer
virtual ~TRootSnifferStore()
destructor
TRootSnifferStore()
normal constructor
#define ClassDef(name, id)
Definition: Rtypes.h:320
TRootSnifferStoreJson(TString &_buf, Bool_t _compact=kFALSE)
Storage of hierarchy scan in TRootSniffer in XML format.
Int_t GetResNumChilds() const
Int_t GetResRestrict() const
TRootSnifferStoreXml(TString &_buf, Bool_t _compact=kFALSE)
Bool_t fCompact
! produce compact xml code
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:75
const Bool_t kFALSE
Definition: RtypesCore.h:88
TDataMember * GetResMember() const
TClass * fResClass
! class of 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: RtypesCore.h:87