CMS 3D CMS Logo

EDProductGetter.h
Go to the documentation of this file.
1 #ifndef DataFormats_Common_EDProductGetter_h
2 #define DataFormats_Common_EDProductGetter_h
3 // -*- C++ -*-
4 //
5 // Class : EDProductGetter
6 //
14 //
15 // Original Author: Chris Jones
16 // Created: Tue Nov 1 15:06:31 EST 2005
17 //
18 
19 // user include files
20 
21 // system include files
22 #include <string>
23 #include <vector>
24 
25 // forward declarations
26 
27 namespace edm {
28 
29  class ProductID;
30  class WrapperBase;
31 
33  public:
35  virtual ~EDProductGetter();
36 
37  EDProductGetter(EDProductGetter const&) = delete; // stop default
38 
39  EDProductGetter const& operator=(EDProductGetter const&) = delete; // stop default
40 
41  // ---------- const member functions ---------------------
42  virtual WrapperBase const* getIt(ProductID const&) const = 0;
43 
44  // getThinnedProduct assumes getIt was already called and failed to find
45  // the product. The input key is the index of the desired element in the
46  // container identified by ProductID (which cannot be found).
47  // If the return value is not null, then the desired element was found
48  // in a thinned container and key is modified to be the index into
49  // that thinned container. If the desired element is not found, then
50  // nullptr is returned.
51  virtual WrapperBase const* getThinnedProduct(ProductID const&, unsigned int& key) const = 0;
52 
53  // getThinnedProducts assumes getIt was already called and failed to find
54  // the product. The input keys are the indexes into the container identified
55  // by ProductID (which cannot be found). On input the WrapperBase pointers
56  // must all be set to nullptr (except when the function calls itself
57  // recursively where non-null pointers mark already found elements).
58  // Thinned containers derived from the product are searched to see
59  // if they contain the desired elements. For each that is
60  // found, the corresponding WrapperBase pointer is set and the key
61  // is modified to be the key into the container where the element
62  // was found. The WrapperBase pointers might or might not all point
63  // to the same thinned container.
64  virtual void getThinnedProducts(ProductID const& pid,
65  std::vector<WrapperBase const*>& foundContainers,
66  std::vector<unsigned int>& keys) const = 0;
67 
68  unsigned int transitionIndex() const { return transitionIndex_(); }
69 
70  // ---------- member functions ---------------------------
71 
74  static void assignEDProductGetter(EDProductGetter const*&);
75 
76  private:
77  virtual unsigned int transitionIndex_() const = 0;
78 
79  // ---------- member data --------------------------------
80  };
81 
82  EDProductGetter const* mustBeNonZero(EDProductGetter const* prodGetter,
83  std::string refType,
84  ProductID const& productID);
85 } // namespace edm
86 #endif
EDProductGetter const * mustBeNonZero(EDProductGetter const *prodGetter, std::string refType, ProductID const &productID)
virtual WrapperBase const * getThinnedProduct(ProductID const &, unsigned int &key) const =0
virtual unsigned int transitionIndex_() const =0
virtual WrapperBase const * getIt(ProductID const &) const =0
virtual void getThinnedProducts(ProductID const &pid, std::vector< WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys) const =0
EDProductGetter const & operator=(EDProductGetter const &)=delete
unsigned int transitionIndex() const
static void assignEDProductGetter(EDProductGetter const *&)
HLT enums.
static EDProductGetter const * switchProductGetter(EDProductGetter const *)
These can only be used internally by the framework.