Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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{nullptr}; ///<! pointer on found item
27 TClass *fResClass{nullptr}; ///<! class of found item
28 TDataMember *fResMember{nullptr}; ///<! datamember pointer of found item
29 Int_t fResNumChilds{-1}; ///<! count of found childs, -1 by default
30 Int_t fResRestrict{0}; ///<! restriction for result, 0-default, 1-readonly, 2-full
31public:
32 virtual ~TRootSnifferStore() = default;
33
34 virtual void CreateNode(Int_t, const char *) {}
35 virtual void SetField(Int_t, const char *, const char *, Bool_t) {}
36 virtual void BeforeNextChild(Int_t, Int_t, Int_t) {}
37 virtual void CloseNode(Int_t, Int_t) {}
38
39 void SetResult(void *_res, TClass *_rescl, TDataMember *_resmemb, Int_t _res_chld, Int_t restr = 0);
40
41 void *GetResPtr() const { return fResPtr; }
42 TClass *GetResClass() const { return fResClass; }
43 TDataMember *GetResMember() const { return fResMember; }
45 Int_t GetResRestrict() const { return fResRestrict; }
46 virtual Bool_t IsXml() const { return kFALSE; }
47
48 ClassDef(TRootSnifferStore, 0) // structure for results store of objects sniffer
49};
50
51// ========================================================================
52
53/** Storage of hierarchy scan in TRootSniffer in XML format */
54
56protected:
57 TString &fBuf; ///<! output buffer
58 Bool_t fCompact{kFALSE}; ///<! produce compact xml code
59
60public:
61 explicit TRootSnifferStoreXml(TString &_buf, Bool_t _compact = kFALSE) : TRootSnifferStore(), fBuf(_buf), fCompact(_compact)
62 {
63 }
64
65 void CreateNode(Int_t lvl, const char *nodename) final;
66 void SetField(Int_t lvl, const char *field, const char *value, Bool_t) final;
67 void BeforeNextChild(Int_t lvl, Int_t nchld, Int_t) final;
68 void CloseNode(Int_t lvl, Int_t numchilds) final;
69
70 Bool_t IsXml() const final { return kTRUE; }
71
72 ClassDefOverride(TRootSnifferStoreXml, 0) // xml results store of objects sniffer
73};
74
75// ========================================================================
76
77/** Storage of hierarchy scan in TRootSniffer in JSON format */
78
80protected:
81 TString &fBuf; ///<! output buffer
82 Bool_t fCompact{kFALSE}; ///<! produce compact json code
83public:
84 explicit TRootSnifferStoreJson(TString &_buf, Bool_t _compact = kFALSE) : TRootSnifferStore(), fBuf(_buf), fCompact(_compact)
85 {
86 }
87
88 void CreateNode(Int_t lvl, const char *nodename) final;
89 void SetField(Int_t lvl, const char *field, const char *value, Bool_t with_quotes) final;
90 void BeforeNextChild(Int_t lvl, Int_t nchld, Int_t nfld) final;
91 void CloseNode(Int_t lvl, Int_t numchilds) final;
92
93 ClassDefOverride(TRootSnifferStoreJson, 0) // json results store of objects sniffer
94};
95
96#endif
int Int_t
Definition RtypesCore.h:45
const Bool_t kFALSE
Definition RtypesCore.h:101
bool Bool_t
Definition RtypesCore.h:63
const Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassDef(name, id)
Definition Rtypes.h:325
#define ClassDefOverride(name, id)
Definition Rtypes.h:329
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:80
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:41
Storage of hierarchy scan in TRootSniffer in JSON format.
void CreateNode(Int_t lvl, const char *nodename) final
starts new json object, will be closed by CloseNode
void CloseNode(Int_t lvl, Int_t numchilds) final
called when node should be closed depending from number of childs different xml format is applied
void SetField(Int_t lvl, const char *field, const char *value, Bool_t with_quotes) final
set field (json field) in current node
TString & fBuf
! output buffer
void BeforeNextChild(Int_t lvl, Int_t nchld, Int_t nfld) final
called before next child node created
TRootSnifferStoreJson(TString &_buf, Bool_t _compact=kFALSE)
Bool_t fCompact
! produce compact json code
Storage of hierarchy scan in TRootSniffer in XML format.
TRootSnifferStoreXml(TString &_buf, Bool_t _compact=kFALSE)
void SetField(Int_t lvl, const char *field, const char *value, Bool_t) final
set field (xml attribute) in current node
Bool_t fCompact
! produce compact xml code
void CloseNode(Int_t lvl, Int_t numchilds) final
called when node should be closed depending from number of childs different xml format is applied
Bool_t IsXml() const final
TString & fBuf
! output buffer
void CreateNode(Int_t lvl, const char *nodename) final
starts new xml node, will be closed by CloseNode
void BeforeNextChild(Int_t lvl, Int_t nchld, Int_t) final
called before next child node created
Abstract interface for storage of hierarchy scan in TRootSniffer.
TClass * fResClass
! class of found item
Int_t GetResNumChilds() const
TDataMember * GetResMember() const
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
void * fResPtr
! pointer on found item
virtual void CloseNode(Int_t, Int_t)
TClass * GetResClass() const
virtual ~TRootSnifferStore()=default
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:136