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 
34  public:
35 
37  virtual ~EDProductGetter();
38 
39  EDProductGetter(EDProductGetter const&) = delete; // stop default
40 
41  EDProductGetter const& operator=(EDProductGetter const&) = delete; // stop default
42 
43  // ---------- const member functions ---------------------
44  virtual WrapperBase const* getIt(ProductID const&) const = 0;
45 
46  // getThinnedProduct assumes getIt was already called and failed to find
47  // the product. The input key is the index of the desired element in the
48  // container identified by ProductID (which cannot be found).
49  // If the return value is not null, then the desired element was found
50  // in a thinned container and key is modified to be the index into
51  // that thinned container. If the desired element is not found, then
52  // nullptr is returned.
53  virtual WrapperBase const* getThinnedProduct(ProductID const&, unsigned int& key) const = 0;
54 
55  // getThinnedProducts assumes getIt was already called and failed to find
56  // the product. The input keys are the indexes into the container identified
57  // by ProductID (which cannot be found). On input the WrapperBase pointers
58  // must all be set to nullptr (except when the function calls itself
59  // recursively where non-null pointers mark already found elements).
60  // Thinned containers derived from the product are searched to see
61  // if they contain the desired elements. For each that is
62  // found, the corresponding WrapperBase pointer is set and the key
63  // is modified to be the key into the container where the element
64  // was found. The WrapperBase pointers might or might not all point
65  // to the same thinned container.
66  virtual void getThinnedProducts(ProductID const& pid,
67  std::vector<WrapperBase const*>& foundContainers,
68  std::vector<unsigned int>& keys) const = 0;
69 
70  unsigned int transitionIndex() const {
71  return transitionIndex_();
72  }
73 
74  // ---------- member functions ---------------------------
75 
78  static void assignEDProductGetter(EDProductGetter const*&);
79 
80 private:
81  virtual unsigned int transitionIndex_() const = 0;
82 
83  // ---------- member data --------------------------------
84 
85  };
86 
87  EDProductGetter const*
88  mustBeNonZero(EDProductGetter const* prodGetter, std::string refType, ProductID const& productID);
89 }
90 #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.