// @(#)root/tree:$Id$
// Author: Axel Naumann, 2010-10-12

/*************************************************************************
 * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TTreeReaderUtils
#define ROOT_TTreeReaderUtils


////////////////////////////////////////////////////////////////////////////
//                                                                        //
// TTreeReaderUtils                                                       //
//                                                                        //
// TTreeReader's helpers.                                                 //
//                                                                        //
//                                                                        //
////////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TBranchProxyDirector
#include "TBranchProxyDirector.h"
#endif
#ifndef ROOT_TBranchProxy
#include "TBranchProxy.h"
#endif
#include "TTreeReaderValue.h"

class TDictionary;
class TTree;

namespace ROOT {
   class TBranchProxy;
   class TBranchProxyDirector;
   class TTreeReaderArrayBase;

   class TNamedBranchProxy: public TObject {
   public:
      TNamedBranchProxy(): fDict(0), fContentDict(0) {}
      TNamedBranchProxy(TBranchProxyDirector* boss, TBranch* branch, const char* membername):
         fProxy(boss, branch, membername), fDict(0), fContentDict(0) {}

      const char* GetName() const { return fProxy.GetBranchName(); }
      const ROOT::TBranchProxy* GetProxy() const { return &fProxy; }
      ROOT::TBranchProxy* GetProxy() { return &fProxy; }
      TDictionary* GetDict() const { return fDict; }
      void SetDict(TDictionary* dict) { fDict = dict; }
      TDictionary* GetContentDict() const { return fContentDict; }
      void SetContentDict(TDictionary* dict) { fContentDict = dict; }

   private:
      ROOT::TBranchProxy fProxy;
      TDictionary*       fDict;
      TDictionary*       fContentDict; // type of content, if a collection
      ClassDef(TNamedBranchProxy, 0); // branch proxy with a name
   };

   // Used by TTreeReaderArray
   class TVirtualCollectionReader {
   public:
      ROOT::TTreeReaderValueBase::EReadStatus fReadStatus;

      TVirtualCollectionReader() : fReadStatus(ROOT::TTreeReaderValueBase::kReadNothingYet) {}

      virtual ~TVirtualCollectionReader();
      virtual size_t GetSize(TBranchProxy*) = 0;
      virtual void* At(TBranchProxy*, size_t /*idx*/) = 0;
   };

}

#endif // defined TTreeReaderUtils
 TTreeReaderUtils.h:1
 TTreeReaderUtils.h:2
 TTreeReaderUtils.h:3
 TTreeReaderUtils.h:4
 TTreeReaderUtils.h:5
 TTreeReaderUtils.h:6
 TTreeReaderUtils.h:7
 TTreeReaderUtils.h:8
 TTreeReaderUtils.h:9
 TTreeReaderUtils.h:10
 TTreeReaderUtils.h:11
 TTreeReaderUtils.h:12
 TTreeReaderUtils.h:13
 TTreeReaderUtils.h:14
 TTreeReaderUtils.h:15
 TTreeReaderUtils.h:16
 TTreeReaderUtils.h:17
 TTreeReaderUtils.h:18
 TTreeReaderUtils.h:19
 TTreeReaderUtils.h:20
 TTreeReaderUtils.h:21
 TTreeReaderUtils.h:22
 TTreeReaderUtils.h:23
 TTreeReaderUtils.h:24
 TTreeReaderUtils.h:25
 TTreeReaderUtils.h:26
 TTreeReaderUtils.h:27
 TTreeReaderUtils.h:28
 TTreeReaderUtils.h:29
 TTreeReaderUtils.h:30
 TTreeReaderUtils.h:31
 TTreeReaderUtils.h:32
 TTreeReaderUtils.h:33
 TTreeReaderUtils.h:34
 TTreeReaderUtils.h:35
 TTreeReaderUtils.h:36
 TTreeReaderUtils.h:37
 TTreeReaderUtils.h:38
 TTreeReaderUtils.h:39
 TTreeReaderUtils.h:40
 TTreeReaderUtils.h:41
 TTreeReaderUtils.h:42
 TTreeReaderUtils.h:43
 TTreeReaderUtils.h:44
 TTreeReaderUtils.h:45
 TTreeReaderUtils.h:46
 TTreeReaderUtils.h:47
 TTreeReaderUtils.h:48
 TTreeReaderUtils.h:49
 TTreeReaderUtils.h:50
 TTreeReaderUtils.h:51
 TTreeReaderUtils.h:52
 TTreeReaderUtils.h:53
 TTreeReaderUtils.h:54
 TTreeReaderUtils.h:55
 TTreeReaderUtils.h:56
 TTreeReaderUtils.h:57
 TTreeReaderUtils.h:58
 TTreeReaderUtils.h:59
 TTreeReaderUtils.h:60
 TTreeReaderUtils.h:61
 TTreeReaderUtils.h:62
 TTreeReaderUtils.h:63
 TTreeReaderUtils.h:64
 TTreeReaderUtils.h:65
 TTreeReaderUtils.h:66
 TTreeReaderUtils.h:67
 TTreeReaderUtils.h:68
 TTreeReaderUtils.h:69
 TTreeReaderUtils.h:70
 TTreeReaderUtils.h:71
 TTreeReaderUtils.h:72
 TTreeReaderUtils.h:73
 TTreeReaderUtils.h:74
 TTreeReaderUtils.h:75
 TTreeReaderUtils.h:76