CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/FWCore/Framework/interface/DependentRecordImplementation.h

Go to the documentation of this file.
00001 #ifndef FWCore_Framework_DependentRecordImplementation_h
00002 #define FWCore_Framework_DependentRecordImplementation_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     Framework
00006 // Class  :     DependentRecordImplementation
00007 // 
00016 //
00017 // Author:      Chris Jones
00018 // Created:     Fri Apr 29 10:03:54 EDT 2005
00019 //
00020 
00021 // system include files
00022 #include "boost/mpl/begin_end.hpp"
00023 #include "boost/mpl/find.hpp"
00024 
00025 // user include files
00026 #include "FWCore/Framework/interface/EventSetupRecordImplementation.h"
00027 #include "FWCore/Framework/interface/EventSetup.h"
00028 #include "FWCore/Framework/interface/NoRecordException.h"
00029 #include "FWCore/Framework/interface/DependentRecordTag.h"
00030 
00031 // forward declarations
00032 namespace edm {
00033 namespace eventsetup {
00034    
00035 template< class RecordT, class ListT>
00036 class DependentRecordImplementation : public EventSetupRecordImplementation<RecordT>, public DependentRecordTag
00037 {
00038 
00039    public:
00040       DependentRecordImplementation() {}
00041       typedef ListT list_type;
00042       //virtual ~DependentRecordImplementation();
00043       
00044       // ---------- const member functions ---------------------
00045       template<class DepRecordT>
00046       const DepRecordT& getRecord() const {
00047          //Make sure that DepRecordT is a type in ListT
00048          typedef typename boost::mpl::end< ListT >::type EndItrT;
00049          typedef typename boost::mpl::find< ListT, DepRecordT>::type FoundItrT; 
00050          BOOST_STATIC_ASSERT((! boost::is_same<FoundItrT, EndItrT>::value));
00051          EventSetup const& eventSetupT = this->eventSetup();
00052          //can't do the following because of a compiler error in gcc 3.*
00053          // return eventSetupT.get<DepRecordT>();
00054          const DepRecordT* temp = 0;
00055          try { 
00056             eventSetupT.getAvoidCompilerBug(temp);
00057          } catch(NoRecordException<DepRecordT>&) {
00058             //rethrow but this time with dependent information.
00059             throw NoRecordException<DepRecordT>(this->key());
00060          } catch(cms::Exception& e) {  
00061             e<<"Exception occurred while getting dependent record from record \""<<
00062                this->key().type().name()<<"\""<<std::endl;
00063             throw;
00064          }
00065          
00066          return *temp;
00067       }
00068       
00069       // ---------- static member functions --------------------
00070 
00071       // ---------- member functions ---------------------------
00072 
00073    private:
00074       DependentRecordImplementation(const DependentRecordImplementation&); // stop default
00075 
00076       const DependentRecordImplementation& operator=(const DependentRecordImplementation&); // stop default
00077 
00078       // ---------- member data --------------------------------
00079 
00080 };
00081 
00082   }
00083 }
00084 
00085 #endif