Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:47

0001 #ifndef FWCore_Framework_NoRecordException_h
0002 #define FWCore_Framework_NoRecordException_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     Framework
0006 // Module:      NoRecordException
0007 //
0008 /**\class NoRecordException NoRecordException.h Framework/interface/NoRecordException.h
0009 
0010  Description: An exception that is thrown whenever a EventSetup is asked to retrieve
0011               a Record it does not have.
0012 
0013  Usage:
0014    This exception will be thrown if you call the EventSetup method get() and the
0015     record type you request does not exist.
0016     E.g.
0017     \code
0018     try {
0019       iEventSetup.get<MyRecord>()...;
0020     } catch(eventsetup::NoRecordException& iException) {
0021        //no record of type MyRecord found in EventSetup
0022        ...
0023     }
0024     \endcode  
0025 */
0026 //
0027 // Author:      Chris D Jones
0028 // Created:     Sat Mar 26 10:31:01 EST 2005
0029 //
0030 
0031 // system include files
0032 // user include files
0033 #include "FWCore/Framework/interface/HCTypeTag.h"
0034 #include "FWCore/Utilities/interface/Exception.h"
0035 
0036 // forward declarations
0037 namespace edm {
0038   class IOVSyncValue;
0039   class EventSetupImpl;
0040   namespace eventsetup {
0041     class EventSetupRecordKey;
0042     void no_record_exception_message_builder(cms::Exception&, const char*, bool iKnownRecord);
0043     bool recordDoesExist(edm::EventSetupImpl const&, edm::eventsetup::EventSetupRecordKey const&);
0044 
0045     //NOTE: when EDM gets own exception hierarchy, will need to change inheritance
0046     template <class T>
0047     class NoRecordException : public cms::Exception {
0048     public:
0049       // ---------- Constructors and destructor ----------------
0050       explicit NoRecordException(bool iKnownRecord) : cms::Exception("NoRecord") {
0051         no_record_exception_message_builder(*this, heterocontainer::className<T>(), iKnownRecord);
0052       }
0053 
0054       ~NoRecordException() noexcept override {}
0055 
0056       // ---------- const member functions ---------------------
0057 
0058       // ---------- static member functions --------------------
0059 
0060       // ---------- member functions ---------------------------
0061 
0062     private:
0063       // ---------- Constructors and destructor ----------------
0064       //NoRecordException(const NoRecordException&); // stop default
0065 
0066       // ---------- assignment operator(s) ---------------------
0067       //const NoRecordException& operator=(const NoRecordException&); // stop default
0068 
0069       // ---------- data members -------------------------------
0070     };
0071 
0072     // inline function definitions
0073   }  // namespace eventsetup
0074 }  // namespace edm
0075 #endif