CMS 3D CMS Logo

EDProductGetter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EDProduct
4 // Class : EDProductGetter
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Tue Nov 1 15:06:41 EST 2005
11 //
12 
13 // system include files
14 
15 // user include files
19 
20 namespace edm {
21  //
22  // constants, enums and typedefs
23  //
24 
25  //
26  // static data member definitions
27  //
28 
29  //
30  // constructors and destructor
31  //
33  {
34  }
35 
36  // EDProductGetter::EDProductGetter(EDProductGetter const& rhs)
37  // {
38  // // do actual copying here;
39  // }
40 
42  {
43  }
44 
45  //
46  // assignment operators
47  //
48  // EDProductGetter const& EDProductGetter::operator=(EDProductGetter const& rhs)
49  // {
50  // //An exception safe implementation is
51  // EDProductGetter temp(rhs);
52  // swap(rhs);
53  //
54  // return *this;
55  // }
56 
57  //
58  // member functions
59  //
60 
61  //
62  // const member functions
63  //
64 
65  //
66  // static member functions
67  //
68 
69  EDProductGetter const*
70  mustBeNonZero(EDProductGetter const* prodGetter, std::string refType, ProductID const& productID) {
71  if (prodGetter != nullptr) return prodGetter;
72  throw Exception(errors::InvalidReference, refType)
73  << "Attempt to construct a " << refType << " with ProductID " << productID << "\n"
74  << "but with a null pointer to a product getter.\n"
75  << "The product getter pointer passed to the constructor must refer\n"
76  << "to a real getter, such as an EventPrincipal.\n";
77  }
78 
79  thread_local EDProductGetter const* s_productGetter = nullptr;
80  EDProductGetter const*
82  {
83  //std::cout <<"switch from "<<s_productGetter<<" to "<<iNew<<std::endl;
84  EDProductGetter const* old = s_productGetter;
85  s_productGetter = iNew;
86  return old;
87  }
88  void
90  {
91  //std::cout <<"assign "<<s_productGetter<<std::endl;
92 
93  iGetter = s_productGetter;
94  }
95 
96 
97 }
EDProductGetter const * mustBeNonZero(EDProductGetter const *prodGetter, std::string refType, ProductID const &productID)
thread_local EDProductGetter const * s_productGetter
static void assignEDProductGetter(EDProductGetter const *&)
HLT enums.
static EDProductGetter const * switchProductGetter(EDProductGetter const *)
These can only be used internally by the framework.