CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/IOPool/Input/src/RootDelayedReader.h

Go to the documentation of this file.
00001 #ifndef IOPool_Input_RootDelayedReader_h
00002 #define IOPool_Input_RootDelayedReader_h
00003 
00004 /*----------------------------------------------------------------------
00005 
00006 RootDelayedReader.h // used by ROOT input sources
00007 
00008 ----------------------------------------------------------------------*/
00009 
00010 #include "DataFormats/Provenance/interface/BranchKey.h"
00011 #include "FWCore/Framework/interface/DelayedReader.h"
00012 #include "RootTree.h"
00013 
00014 #include <map>
00015 #include <memory>
00016 #include <string>
00017 
00018 namespace edm {
00019   class InputFile;
00020   class RootTree;
00021 
00022   //------------------------------------------------------------
00023   // Class RootDelayedReader: pretends to support file reading.
00024   //
00025 
00026   class RootDelayedReader : public DelayedReader {
00027   public:
00028     typedef roottree::BranchInfo BranchInfo;
00029     typedef roottree::BranchMap BranchMap;
00030     typedef roottree::BranchMap::const_iterator iterator;
00031     typedef roottree::EntryNumber EntryNumber;
00032     RootDelayedReader(
00033       RootTree const& tree,
00034       boost::shared_ptr<InputFile> filePtr);
00035 
00036     virtual ~RootDelayedReader();
00037 
00038     RootDelayedReader(RootDelayedReader const&) = delete; // Disallow copying and moving
00039     RootDelayedReader& operator=(RootDelayedReader const&) = delete; // Disallow copying and moving
00040 
00041   private:
00042     virtual WrapperOwningHolder getProduct_(BranchKey const& k, WrapperInterfaceBase const* interface, EDProductGetter const* ep) const;
00043     virtual void mergeReaders_(DelayedReader* other) {nextReader_ = other;}
00044     virtual void reset_() {nextReader_ = 0;}
00045     BranchMap const& branches() const {return tree_.branches();}
00046     EntryNumber const& entryNumber() const {return tree_.entryNumber();}
00047     iterator branchIter(BranchKey const& k) const {return branches().find(k);}
00048     bool found(iterator const& iter) const {return iter != branches().end();}
00049     BranchInfo const& getBranchInfo(iterator const& iter) const {return iter->second; }
00050     // NOTE: filePtr_ appears to be unused, but is needed to prevent
00051     // the file containing the branch from being reclaimed.
00052     RootTree const& tree_;
00053     boost::shared_ptr<InputFile> filePtr_;
00054     DelayedReader* nextReader_;
00055   }; // class RootDelayedReader
00056   //------------------------------------------------------------
00057 }
00058 #endif