CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DataFormats/Common/src/EDProductGetter.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     EDProduct
00004 // Class  :     EDProductGetter
00005 // 
00006 // Implementation:
00007 //     <Notes on implementation>
00008 //
00009 // Original Author:  Chris Jones
00010 //         Created:  Tue Nov  1 15:06:41 EST 2005
00011 //
00012 
00013 // system include files
00014 
00015 // user include files
00016 #include "DataFormats/Common/interface/EDProductGetter.h"
00017 #include "FWCore/Utilities/interface/EDMException.h"
00018 
00019 namespace edm {
00020   //
00021   // constants, enums and typedefs
00022   //
00023   
00024   //
00025   // static data member definitions
00026   //
00027   
00028   //
00029   // constructors and destructor
00030   //
00031   EDProductGetter::EDProductGetter()
00032   {
00033   }
00034   
00035   // EDProductGetter::EDProductGetter(EDProductGetter const& rhs)
00036   // {
00037   //    // do actual copying here;
00038   // }
00039   
00040   EDProductGetter::~EDProductGetter()
00041   {
00042   }
00043   
00044   //
00045   // assignment operators
00046   //
00047   // EDProductGetter const& EDProductGetter::operator=(EDProductGetter const& rhs)
00048   // {
00049   //   //An exception safe implementation is
00050   //   EDProductGetter temp(rhs);
00051   //   swap(rhs);
00052   //
00053   //   return *this;
00054   // }
00055   
00056   //
00057   // member functions
00058   //
00059   
00060   //
00061   // const member functions
00062   //
00063   
00064   //
00065   // static member functions
00066   //
00067   
00068   EDProductGetter const*
00069   mustBeNonZero(EDProductGetter const* prodGetter, std::string refType, ProductID const& productID) {
00070     if (prodGetter != 0) return prodGetter;
00071         throw Exception(errors::InvalidReference, refType)
00072         << "Attempt to construct a " << refType << " with ProductID " << productID << "\n"
00073         << "but with a null pointer to a product getter.\n"
00074         << "The product getter pointer passed to the constructor must refer\n"
00075         << "to a real getter, such as an EventPrincipal.\n";
00076   }
00077   
00078   static EDProductGetter const* s_productGetter=0;
00079   EDProductGetter const* 
00080   EDProductGetter::switchProductGetter(EDProductGetter const* iNew) 
00081   {
00082     //std::cout <<"switch from "<<s_productGetter<<" to "<<iNew<<std::endl;
00083     EDProductGetter const* old = s_productGetter;
00084     s_productGetter = iNew;
00085     return old;
00086   }
00087   void 
00088   EDProductGetter::assignEDProductGetter(EDProductGetter const* & iGetter)
00089   {    
00090     //std::cout <<"assign "<<s_productGetter<<std::endl;
00091     
00092     iGetter = s_productGetter;
00093   }
00094 
00095 
00096 }