Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
// -*- C++ -*-
//
// Package:     EDProduct
// Class  :     EDProductGetter
//
// Implementation:
//     <Notes on implementation>
//
// Original Author:  Chris Jones
//         Created:  Tue Nov  1 15:06:41 EST 2005
//

// system include files

// user include files
#include "DataFormats/Common/interface/EDProductGetter.h"
#include "DataFormats/Provenance/interface/ProductID.h"
#include "FWCore/Utilities/interface/EDMException.h"

namespace edm {
  //
  // constants, enums and typedefs
  //

  //
  // static data member definitions
  //

  //
  // constructors and destructor
  //
  EDProductGetter::EDProductGetter() {}

  // EDProductGetter::EDProductGetter(EDProductGetter const& rhs)
  // {
  //    // do actual copying here;
  // }

  EDProductGetter::~EDProductGetter() {}

  //
  // assignment operators
  //
  // EDProductGetter const& EDProductGetter::operator=(EDProductGetter const& rhs)
  // {
  //   //An exception safe implementation is
  //   EDProductGetter temp(rhs);
  //   swap(rhs);
  //
  //   return *this;
  // }

  //
  // member functions
  //

  //
  // const member functions
  //

  //
  // static member functions
  //

  EDProductGetter const* mustBeNonZero(EDProductGetter const* prodGetter,
                                       std::string refType,
                                       ProductID const& productID) {
    if (prodGetter != nullptr)
      return prodGetter;
    throw Exception(errors::InvalidReference, refType)
        << "Attempt to construct a " << refType << " with ProductID " << productID << "\n"
        << "but with a null pointer to a product getter.\n"
        << "The product getter pointer passed to the constructor must refer\n"
        << "to a real getter, such as an EventPrincipal.\n";
  }

  thread_local EDProductGetter const* s_productGetter = nullptr;
  EDProductGetter const* EDProductGetter::switchProductGetter(EDProductGetter const* iNew) {
    //std::cout <<"switch from "<<s_productGetter<<" to "<<iNew<<std::endl;
    EDProductGetter const* old = s_productGetter;
    s_productGetter = iNew;
    return old;
  }
  void EDProductGetter::assignEDProductGetter(EDProductGetter const*& iGetter) {
    //std::cout <<"assign "<<s_productGetter<<std::endl;

    iGetter = s_productGetter;
  }

}  // namespace edm