CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 #include "boost/utility.hpp"
26 
27 // forward declarations
28 
29 namespace edm {
30 
31  class ProductID;
32  class WrapperBase;
33 
34  class EDProductGetter : private boost::noncopyable {
35 
36  public:
37 
39  virtual ~EDProductGetter();
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 {
69  return transitionIndex_();
70  }
71 
72  // ---------- member functions ---------------------------
73 
76  static void assignEDProductGetter(EDProductGetter const*&);
77 
78 private:
79  virtual unsigned int transitionIndex_() const = 0;
80 
81  // ---------- member data --------------------------------
82 
83  };
84 
85  EDProductGetter const*
86  mustBeNonZero(EDProductGetter const* prodGetter, std::string refType, ProductID const& productID);
87 }
88 #endif
EDProductGetter const * mustBeNonZero(EDProductGetter const *prodGetter, std::string refType, ProductID const &productID)
virtual void getThinnedProducts(ProductID const &pid, std::vector< WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys) const =0
virtual WrapperBase const * getIt(ProductID const &) const =0
virtual WrapperBase const * getThinnedProduct(ProductID const &, unsigned int &key) const =0
tuple pid
Definition: sysUtil.py:22
unsigned int transitionIndex() const
virtual unsigned int transitionIndex_() const =0
static void assignEDProductGetter(EDProductGetter const *&)
list key
Definition: combine.py:13
static EDProductGetter const * switchProductGetter(EDProductGetter const *)
These can only be used internally by the framework.