LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
BranchMapper.h
Go to the documentation of this file.
1 #ifndef canvas_Persistency_Provenance_BranchMapper_h
2 #define canvas_Persistency_Provenance_BranchMapper_h
3 
4 // ======================================================================
5 //
6 // BranchMapper: Manages the per event/subRun/run per product provenance.
7 //
8 // ======================================================================
9 
12 #include "cetlib/container_algorithms.h"
13 #include "cetlib/exempt_ptr.h"
14 #include "cetlib/value_ptr.h"
15 
16 #include <iosfwd>
17 #include <map>
18 #include <memory>
19 #include <set>
20 
21 namespace art {
22  // defined below:
23  class BranchMapper;
24  std::ostream& operator<<(std::ostream&, BranchMapper const&);
25 
26  // forward declaration:
27  class ProductID;
28 }
29 
30 // ----------------------------------------------------------------------
31 
33 public:
34  BranchMapper(BranchMapper const&) = delete;
35  BranchMapper& operator=(BranchMapper const&) = delete;
36 
37  using result_t = cet::exempt_ptr<ProductProvenance const>;
38 
39  explicit BranchMapper(bool delayedRead = false);
40  virtual ~BranchMapper() = default;
41 
42  void write(std::ostream&) const;
43 
45  result_t insert(std::unique_ptr<ProductProvenance const>&&);
46 
47  void
48  setDelayedRead(bool const value)
49  {
51  }
52 
53 private:
54  using eiSet = std::map<ProductID, cet::value_ptr<ProductProvenance const>>;
55 
57  mutable bool delayedRead_;
58 
59  void readProvenance() const;
60  virtual void
62  {}
63 
64 }; // BranchMapper
65 
66 inline std::ostream&
67 art::operator<<(std::ostream& os, BranchMapper const& p)
68 {
69  p.write(os);
70  return os;
71 }
72 
73  // ======================================================================
74 
75 #endif /* canvas_Persistency_Provenance_BranchMapper_h */
76 
77 // Local Variables:
78 // mode: c++
79 // End:
void write(std::ostream &) const
std::ostream & operator<<(std::ostream &os, EDAnalyzer::Table< T > const &t)
Definition: EDAnalyzer.h:184
cet::exempt_ptr< ProductProvenance const > result_t
Definition: BranchMapper.h:37
std::map< ProductID, cet::value_ptr< ProductProvenance const >> eiSet
Definition: BranchMapper.h:54
virtual void readProvenance_() const
Definition: BranchMapper.h:61
BranchMapper & operator=(BranchMapper const &)=delete
result_t insert(std::unique_ptr< ProductProvenance const > &&)
Definition: BranchMapper.cc:24
void setDelayedRead(bool const value)
Definition: BranchMapper.h:48
result_t branchToProductProvenance(ProductID const) const
Definition: BranchMapper.cc:33
std::string value(boost::any const &)
void readProvenance() const
Definition: BranchMapper.cc:15
HLT enums.
BranchMapper(BranchMapper const &)=delete
virtual ~BranchMapper()=default