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  // EDProductGetter::EDProductGetter(EDProductGetter const& rhs)
35  // {
36  // // do actual copying here;
37  // }
38 
40 
41  //
42  // assignment operators
43  //
44  // EDProductGetter const& EDProductGetter::operator=(EDProductGetter const& rhs)
45  // {
46  // //An exception safe implementation is
47  // EDProductGetter temp(rhs);
48  // swap(rhs);
49  //
50  // return *this;
51  // }
52 
53  //
54  // member functions
55  //
56 
57  //
58  // const member functions
59  //
60 
61  //
62  // static member functions
63  //
64 
65  EDProductGetter const* mustBeNonZero(EDProductGetter const* prodGetter,
66  std::string refType,
67  ProductID const& productID) {
68  if (prodGetter != nullptr)
69  return prodGetter;
70  throw Exception(errors::InvalidReference, refType)
71  << "Attempt to construct a " << refType << " with ProductID " << productID << "\n"
72  << "but with a null pointer to a product getter.\n"
73  << "The product getter pointer passed to the constructor must refer\n"
74  << "to a real getter, such as an EventPrincipal.\n";
75  }
76 
77  thread_local EDProductGetter const* s_productGetter = nullptr;
79  //std::cout <<"switch from "<<s_productGetter<<" to "<<iNew<<std::endl;
80  EDProductGetter const* old = s_productGetter;
81  s_productGetter = iNew;
82  return old;
83  }
85  //std::cout <<"assign "<<s_productGetter<<std::endl;
86 
87  iGetter = s_productGetter;
88  }
89 
90 } // namespace edm
edm::EDProductGetter::switchProductGetter
static EDProductGetter const * switchProductGetter(EDProductGetter const *)
These can only be used internally by the framework.
Definition: EDProductGetter.cc:78
edm::errors::InvalidReference
Definition: EDMException.h:39
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::mustBeNonZero
EDProductGetter const * mustBeNonZero(EDProductGetter const *prodGetter, std::string refType, ProductID const &productID)
Definition: EDProductGetter.cc:65
EDMException.h
edm::EDProductGetter
Definition: EDProductGetter.h:41
edm::EDProductGetter::assignEDProductGetter
static void assignEDProductGetter(EDProductGetter const *&)
Definition: EDProductGetter.cc:84
ProductID.h
edm::s_productGetter
thread_local EDProductGetter const * s_productGetter
Definition: EDProductGetter.cc:77
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::EDProductGetter::~EDProductGetter
virtual ~EDProductGetter()
Definition: EDProductGetter.cc:39
Exception
Definition: hltDiff.cc:245
EDProductGetter.h
edm::ProductID
Definition: ProductID.h:27
edm::EDProductGetter::EDProductGetter
EDProductGetter()
Definition: EDProductGetter.cc:32