CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OccurrenceForOutput.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_OccurrenceForOutput_h
2 #define FWCore_Framework_OccurrenceForOutput_h
3 
4 // -*- C++ -*-
5 //
6 // Package: Framework
7 // Class : OccurrenceForOutput
8 //
12 /*----------------------------------------------------------------------
13 ----------------------------------------------------------------------*/
14 
20 
26 
27 #include <memory>
28 #include <string>
29 #include <typeinfo>
30 #include <vector>
31 
32 class testEventGetRefBeforePut;
33 
34 namespace edmtest {
35  class TestOutputModule;
36 }
37 
38 namespace edm {
39 
40  class BranchDescription;
41  class ModuleCallingContext;
42  class Principal;
43  class EDConsumerBase;
44 
46  public:
47  OccurrenceForOutput(Principal const& ep, ModuleDescription const& md,
48  ModuleCallingContext const*);
49  virtual ~OccurrenceForOutput();
50 
51  //Used in conjunction with EDGetToken
52  void setConsumer(EDConsumerBase const* iConsumer);
53 
54  ProcessHistoryID const& processHistoryID() const;
55 
56  bool
57  getByToken(EDGetToken token, TypeID const& typeID, BasicHandle& result) const;
58 
59  template<typename PROD>
60  bool
61  getByToken(EDGetToken token, Handle<PROD>& result) const;
62 
63  template<typename PROD>
64  bool
65  getByToken(EDGetTokenT<PROD> token, Handle<PROD>& result) const;
66 
68  getProvenance(BranchID const& theID) const;
69 
70  void
71  getAllProvenance(std::vector<Provenance const*>& provenances) const;
72 
73  void
74  getAllStableProvenance(std::vector<StableProvenance const*>& provenances) const;
75 
76  virtual ProcessHistory const&
77  processHistory() const;
78 
79  size_t size() const;
80 
81  protected:
82  Principal const&
83  principal() const;
84 
85  private:
86  friend class edmtest::TestOutputModule; // For testing
88 
90 
92  };
93 
94  template<typename PROD>
95  bool
99  }
100  result.clear();
102  convert_handle(std::move(bh), result); // throws on conversion error
103  if (result.failedToGet()) {
104  return false;
105  }
106  return true;
107  }
108 
109  template<typename PROD>
110  bool
113  principal_get_adapter_detail::throwOnPrematureRead("RunOrLumi", TypeID(typeid(PROD)), token);
114  }
115  result.clear();
117  convert_handle(std::move(bh), result); // throws on conversion error
118  if (result.failedToGet()) {
119  return false;
120  }
121  return true;
122  }
123 
124 }
125 #endif
126 
BasicHandle getByToken_(TypeID const &id, KindOfType kindOfType, EDGetToken token, ModuleCallingContext const *mcc) const
ModuleCallingContext const * moduleCallingContext() const
virtual ProcessHistory const & processHistory() const
friend class edmtest::TestOutputModule
tuple result
Definition: mps_fire.py:84
bool getByToken(EDGetToken token, TypeID const &typeID, BasicHandle &result) const
def move
Definition: eostools.py:510
Provenance getProvenance(BranchID const &theID) const
void convert_handle(BasicHandle &&bh, Handle< T > &result)
Definition: ConvertHandle.h:19
ModuleCallingContext const * moduleCallingContext_
bool failedToGet() const
Definition: HandleBase.h:79
void getAllStableProvenance(std::vector< StableProvenance const * > &provenances) const
ProcessHistoryID const & processHistoryID() const
#define PROD(A, B)
void setConsumer(EDConsumerBase const *iConsumer)
void throwOnPrematureRead(char const *principalType, TypeID const &productType, std::string const &moduleLabel, std::string const &productInstanceName)
OccurrenceForOutput(Principal const &ep, ModuleDescription const &md, ModuleCallingContext const *)
void getAllProvenance(std::vector< Provenance const * > &provenances) const
Principal const & principal() const
PrincipalGetAdapter provRecorder_