CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RootDelayedReader.h
Go to the documentation of this file.
1 #ifndef IOPool_Input_RootDelayedReader_h
2 #define IOPool_Input_RootDelayedReader_h
3 
4 /*----------------------------------------------------------------------
5 
6 RootDelayedReader.h // used by ROOT input sources
7 
8 ----------------------------------------------------------------------*/
9 
13 #include "RootTree.h"
14 
15 #include <map>
16 #include <memory>
17 #include <string>
18 
19 class TClass;
20 namespace edm {
21  class InputFile;
22  class RootTree;
24 
25  //------------------------------------------------------------
26  // Class RootDelayedReader: pretends to support file reading.
27  //
28 
30  public:
33  typedef roottree::BranchMap::const_iterator iterator;
36  RootTree const& tree,
37  std::shared_ptr<InputFile> filePtr,
38  InputType inputType);
39 
40  virtual ~RootDelayedReader();
41 
42  RootDelayedReader(RootDelayedReader const&) = delete; // Disallow copying and moving
43  RootDelayedReader& operator=(RootDelayedReader const&) = delete; // Disallow copying and moving
44 
45  private:
46  virtual std::unique_ptr<WrapperBase> getProduct_(BranchKey const& k, EDProductGetter const* ep) const override;
47  virtual void mergeReaders_(DelayedReader* other) override {nextReader_ = other;}
48  virtual void reset_() override {nextReader_ = nullptr;}
49  SharedResourcesAcquirer* sharedResources_() const override;
50 
51  BranchMap const& branches() const {return tree_.branches();}
52  iterator branchIter(BranchKey const& k) const {return branches().find(k);}
53  bool found(iterator const& iter) const {return iter != branches().end();}
54  BranchInfo const& getBranchInfo(iterator const& iter) const {return iter->second; }
55  // NOTE: filePtr_ appears to be unused, but is needed to prevent
56  // the file containing the branch from being reclaimed.
57  RootTree const& tree_;
58  std::shared_ptr<InputFile> filePtr_;
60  std::unique_ptr<SharedResourcesAcquirer> resourceAcquirer_;
63  }; // class RootDelayedReader
64  //------------------------------------------------------------
65 }
66 #endif
InputType
Definition: InputType.h:5
virtual void reset_() override
virtual void mergeReaders_(DelayedReader *other) override
RootTree const & tree_
roottree::BranchMap BranchMap
BranchInfo const & getBranchInfo(iterator const &iter) const
virtual std::unique_ptr< WrapperBase > getProduct_(BranchKey const &k, EDProductGetter const *ep) const override
DelayedReader * nextReader_
std::map< BranchKey const, BranchInfo > BranchMap
Definition: RootTree.h:55
RootDelayedReader(RootTree const &tree, std::shared_ptr< InputFile > filePtr, InputType inputType)
IndexIntoFile::EntryNumber_t EntryNumber
Definition: RootTree.h:41
roottree::BranchMap::const_iterator iterator
RootDelayedReader & operator=(RootDelayedReader const &)=delete
bool found(iterator const &iter) const
roottree::BranchInfo BranchInfo
SharedResourcesAcquirer * sharedResources_() const override
std::unique_ptr< SharedResourcesAcquirer > resourceAcquirer_
std::shared_ptr< InputFile > filePtr_
roottree::EntryNumber EntryNumber
BranchMap const & branches() const
Definition: RootTree.cc:172
iterator branchIter(BranchKey const &k) const
BranchMap const & branches() const