Logo ROOT   6.18/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
19class TDataMember;
20class TFolder;
21
22/** Abstract interface for storage of hierarchy scan in TRootSniffer */
23
24class TRootSnifferStore : public TObject {
25protected:
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
31public:
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; }
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
57protected:
58 TString *fBuf; ///<! output buffer
59 Bool_t fCompact; ///<! produce compact xml code
60
61public:
62 TRootSnifferStoreXml(TString &_buf, Bool_t _compact = kFALSE) : TRootSnifferStore(), fBuf(&_buf), fCompact(_compact)
63 {
64 }
65
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
83protected:
84 TString *fBuf; ///<! output buffer
85 Bool_t fCompact; ///<! produce compact json code
86public:
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
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassDef(name, id)
Definition: Rtypes.h:326
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:75
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:31
A TFolder object is a collection of objects and folders.
Definition: TFolder.h:30
Mother of all ROOT objects.
Definition: TObject.h:37
Storage of hierarchy scan in TRootSniffer in JSON format.
virtual void SetField(Int_t lvl, const char *field, const char *value, Bool_t with_quotes)
set field (json field) in current node
virtual void BeforeNextChild(Int_t lvl, Int_t nchld, Int_t nfld)
called before next child node created
virtual void CreateNode(Int_t lvl, const char *nodename)
starts new json object, will be closed by CloseNode
TRootSnifferStoreJson(TString &_buf, Bool_t _compact=kFALSE)
virtual void CloseNode(Int_t lvl, Int_t numchilds)
called when node should be closed depending from number of childs different xml format is applied
Bool_t fCompact
! produce compact json code
TString * fBuf
! output buffer
Storage of hierarchy scan in TRootSniffer in XML format.
TRootSnifferStoreXml(TString &_buf, Bool_t _compact=kFALSE)
virtual void CreateNode(Int_t lvl, const char *nodename)
starts new xml node, will be closed by CloseNode
virtual Bool_t IsXml() const
Bool_t fCompact
! produce compact xml code
virtual void SetField(Int_t lvl, const char *field, const char *value, Bool_t)
set field (xml attribute) in current node
TString * fBuf
! output buffer
virtual void BeforeNextChild(Int_t lvl, Int_t nchld, Int_t)
called before next child node created
virtual void CloseNode(Int_t lvl, Int_t numchilds)
called when node should be closed depending from number of childs different xml format is applied
Abstract interface for storage of hierarchy scan in TRootSniffer.
TClass * fResClass
! class of found item
Int_t GetResNumChilds() const
TDataMember * GetResMember() const
virtual ~TRootSnifferStore()
destructor
virtual void CreateNode(Int_t, const char *)
void * GetResPtr() const
Int_t fResRestrict
! restriction for result, 0-default, 1-readonly, 2-full
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
TRootSnifferStore()
normal constructor
void * fResPtr
! pointer on found item
virtual void CloseNode(Int_t, Int_t)
TClass * GetResClass() const
virtual Bool_t IsXml() const
virtual void BeforeNextChild(Int_t, Int_t, Int_t)
Int_t GetResRestrict() const
virtual void SetField(Int_t, const char *, const char *, Bool_t)
TDataMember * fResMember
! datamember pointer of found item
Int_t fResNumChilds
! count of found childs, -1 by default
Basic string class.
Definition: TString.h:131