// $Id$
// Author: Sergey Linev   22/12/2013

#ifndef ROOT_TRootSnifferStore
#define ROOT_TRootSnifferStore

#ifndef ROOT_TObject
#include "TObject.h"
#endif

#ifndef ROOT_TString
#include "TString.h"
#endif

class TDataMember;

class TRootSnifferStore : public TObject {
protected:
   void *fResPtr;           //! pointer on found item
   TClass *fResClass;       //! class of found item
   TDataMember *fResMember; //! datamember pointer of found item
   Int_t fResNumChilds;     //! count of found childs, -1 by default
public:
   TRootSnifferStore();
   virtual ~TRootSnifferStore();

   virtual void CreateNode(Int_t, const char *) {}
   virtual void SetField(Int_t, const char *, const char *, Int_t) {}
   virtual void BeforeNextChild(Int_t, Int_t, Int_t) {}
   virtual void CloseNode(Int_t, const char *, Int_t) {}

   void SetResult(void *_res, TClass *_rescl, TDataMember *_resmemb, Int_t _res_chld);

   void *GetResPtr() const
   {
      return fResPtr;
   }
   TClass *GetResClass() const
   {
      return fResClass;
   }
   TDataMember *GetResMember() const
   {
      return fResMember;
   }
   Int_t GetResNumChilds() const
   {
      return fResNumChilds;
   }

   ClassDef(TRootSnifferStore, 0) // structure for results store of objects sniffer
};

// ========================================================================

class TRootSnifferStoreXml : public TRootSnifferStore {
protected:
   TString *buf;           //! output buffer

public:
   TRootSnifferStoreXml(TString &_buf) :
      TRootSnifferStore(),
      buf(&_buf) {}

   virtual ~TRootSnifferStoreXml() {}

   virtual void CreateNode(Int_t lvl, const char *nodename);
   virtual void SetField(Int_t lvl, const char *field, const char *value, Int_t);
   virtual void BeforeNextChild(Int_t lvl, Int_t nchld, Int_t);
   virtual void CloseNode(Int_t lvl, const char *nodename, Int_t numchilds);

   ClassDef(TRootSnifferStoreXml, 0) // xml results store of objects sniffer
};

// ========================================================================


class TRootSnifferStoreJson : public TRootSnifferStore {
protected:
   TString *buf;     //! output buffer
public:
   TRootSnifferStoreJson(TString &_buf) :
      TRootSnifferStore(),
      buf(&_buf) {}
   virtual ~TRootSnifferStoreJson() {}

   virtual void CreateNode(Int_t lvl, const char *nodename);
   virtual void SetField(Int_t lvl, const char *field, const char *value, Int_t);
   virtual void BeforeNextChild(Int_t lvl, Int_t nchld, Int_t nfld);
   virtual void CloseNode(Int_t lvl, const char *nodename, Int_t numchilds);

   ClassDef(TRootSnifferStoreJson, 0) // json results store of objects sniffer
};

#endif
 TRootSnifferStore.h:1
 TRootSnifferStore.h:2
 TRootSnifferStore.h:3
 TRootSnifferStore.h:4
 TRootSnifferStore.h:5
 TRootSnifferStore.h:6
 TRootSnifferStore.h:7
 TRootSnifferStore.h:8
 TRootSnifferStore.h:9
 TRootSnifferStore.h:10
 TRootSnifferStore.h:11
 TRootSnifferStore.h:12
 TRootSnifferStore.h:13
 TRootSnifferStore.h:14
 TRootSnifferStore.h:15
 TRootSnifferStore.h:16
 TRootSnifferStore.h:17
 TRootSnifferStore.h:18
 TRootSnifferStore.h:19
 TRootSnifferStore.h:20
 TRootSnifferStore.h:21
 TRootSnifferStore.h:22
 TRootSnifferStore.h:23
 TRootSnifferStore.h:24
 TRootSnifferStore.h:25
 TRootSnifferStore.h:26
 TRootSnifferStore.h:27
 TRootSnifferStore.h:28
 TRootSnifferStore.h:29
 TRootSnifferStore.h:30
 TRootSnifferStore.h:31
 TRootSnifferStore.h:32
 TRootSnifferStore.h:33
 TRootSnifferStore.h:34
 TRootSnifferStore.h:35
 TRootSnifferStore.h:36
 TRootSnifferStore.h:37
 TRootSnifferStore.h:38
 TRootSnifferStore.h:39
 TRootSnifferStore.h:40
 TRootSnifferStore.h:41
 TRootSnifferStore.h:42
 TRootSnifferStore.h:43
 TRootSnifferStore.h:44
 TRootSnifferStore.h:45
 TRootSnifferStore.h:46
 TRootSnifferStore.h:47
 TRootSnifferStore.h:48
 TRootSnifferStore.h:49
 TRootSnifferStore.h:50
 TRootSnifferStore.h:51
 TRootSnifferStore.h:52
 TRootSnifferStore.h:53
 TRootSnifferStore.h:54
 TRootSnifferStore.h:55
 TRootSnifferStore.h:56
 TRootSnifferStore.h:57
 TRootSnifferStore.h:58
 TRootSnifferStore.h:59
 TRootSnifferStore.h:60
 TRootSnifferStore.h:61
 TRootSnifferStore.h:62
 TRootSnifferStore.h:63
 TRootSnifferStore.h:64
 TRootSnifferStore.h:65
 TRootSnifferStore.h:66
 TRootSnifferStore.h:67
 TRootSnifferStore.h:68
 TRootSnifferStore.h:69
 TRootSnifferStore.h:70
 TRootSnifferStore.h:71
 TRootSnifferStore.h:72
 TRootSnifferStore.h:73
 TRootSnifferStore.h:74
 TRootSnifferStore.h:75
 TRootSnifferStore.h:76
 TRootSnifferStore.h:77
 TRootSnifferStore.h:78
 TRootSnifferStore.h:79
 TRootSnifferStore.h:80
 TRootSnifferStore.h:81
 TRootSnifferStore.h:82
 TRootSnifferStore.h:83
 TRootSnifferStore.h:84
 TRootSnifferStore.h:85
 TRootSnifferStore.h:86
 TRootSnifferStore.h:87
 TRootSnifferStore.h:88
 TRootSnifferStore.h:89
 TRootSnifferStore.h:90
 TRootSnifferStore.h:91
 TRootSnifferStore.h:92
 TRootSnifferStore.h:93
 TRootSnifferStore.h:94
 TRootSnifferStore.h:95