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 
14 #include "RootTree.h"
15 
16 #include <map>
17 #include <memory>
18 #include <string>
19 
20 class TClass;
21 namespace edm {
22  class InputFile;
23  class RootTree;
25  class Exception;
26 
27  //------------------------------------------------------------
28  // Class RootDelayedReader: pretends to support file reading.
29  //
30 
32  public:
35  typedef roottree::BranchMap::const_iterator iterator;
38  RootTree const& tree,
39  std::shared_ptr<InputFile> filePtr,
40  InputType inputType);
41 
42  virtual ~RootDelayedReader();
43 
44  RootDelayedReader(RootDelayedReader const&) = delete; // Disallow copying and moving
45  RootDelayedReader& operator=(RootDelayedReader const&) = delete; // Disallow copying and moving
46 
47  private:
48  virtual std::unique_ptr<WrapperBase> getProduct_(BranchKey const& k, EDProductGetter const* ep) override;
49  virtual void mergeReaders_(DelayedReader* other) override {nextReader_ = other;}
50  virtual void reset_() override {nextReader_ = nullptr;}
51  SharedResourcesAcquirer* sharedResources_() const override;
52 
53  BranchMap const& branches() const {return tree_.branches();}
54  iterator branchIter(BranchKey const& k) const {return branches().find(k);}
55  bool found(iterator const& iter) const {return iter != branches().end();}
56  BranchInfo const& getBranchInfo(iterator const& iter) const {return iter->second; }
57  // NOTE: filePtr_ appears to be unused, but is needed to prevent
58  // the file containing the branch from being reclaimed.
59  RootTree const& tree_;
62  std::unique_ptr<SharedResourcesAcquirer> resourceAcquirer_; // We do not use propagate_const because the acquirer is itself mutable.
65  //If a fatal exception happens we need to make a copy so we can
66  // rethrow that exception on other threads. This avoids TTree
67  // non-exception safety problems on later calls to TTree.
68  mutable std::unique_ptr<Exception> lastException_;
69  }; // class RootDelayedReader
70  //------------------------------------------------------------
71 }
72 #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
std::map< BranchKey const, BranchInfo > BranchMap
Definition: RootTree.h:55
virtual std::unique_ptr< WrapperBase > getProduct_(BranchKey const &k, EDProductGetter const *ep) override
RootDelayedReader(RootTree const &tree, std::shared_ptr< InputFile > filePtr, InputType inputType)
IndexIntoFile::EntryNumber_t EntryNumber
Definition: RootTree.h:41
roottree::BranchMap::const_iterator iterator
std::unique_ptr< Exception > lastException_
RootDelayedReader & operator=(RootDelayedReader const &)=delete
bool found(iterator const &iter) const
roottree::BranchInfo BranchInfo
SharedResourcesAcquirer * sharedResources_() const override
std::unique_ptr< SharedResourcesAcquirer > resourceAcquirer_
edm::propagate_const< std::shared_ptr< InputFile > > filePtr_
edm::propagate_const< TClass * > wrapperBaseTClass_
roottree::EntryNumber EntryNumber
BranchMap const & branches() const
Definition: RootTree.cc:172
iterator branchIter(BranchKey const &k) const
edm::propagate_const< DelayedReader * > nextReader_
BranchMap const & branches() const