CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/FWCore/Framework/interface/NoDataException.h

Go to the documentation of this file.
00001 #ifndef FWCore_Framework_NoDataException_h
00002 #define FWCore_Framework_NoDataException_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     Framework
00006 // Module:      NoDataException
00007 // 
00060 //
00061 // Author:      Chris D Jones
00062 // Created:     Tue Dec  7 09:10:34 EST 1999
00063 //
00064 
00065 // system include files
00066 #include <string>
00067 
00068 // user include files
00069 #include "FWCore/Framework/interface/DataKey.h"
00070 #include "FWCore/Framework/interface/EventSetupRecordKey.h"
00071 #include "FWCore/Framework/interface/HCTypeTag.h"
00072 #include "FWCore/Utilities/interface/Exception.h"
00073 
00074 // forward declarations
00075 namespace edm {
00076    namespace eventsetup {
00077 
00078 class NoDataExceptionBase : public cms::Exception
00079 {
00080 public:
00081   NoDataExceptionBase(const EventSetupRecordKey& iRecordKey,
00082                         const DataKey& iDataKey,
00083                         const char* category_name = "NoDataException") ;
00084   virtual ~NoDataExceptionBase() throw();
00085   const DataKey& dataKey() const;
00086 protected:
00087   static std::string providerButNoDataMessage(const EventSetupRecordKey& iKey);
00088   static std::string noProxyMessage();
00089   void constructMessage(const char* iClassName, const std::string& iExtraInfo);
00090 private:
00091   void beginDataTypeMessage(std::string&) const;
00092   void endDataTypeMessage(std::string&) const;
00093   
00094   // ---------- Constructors and destructor ----------------
00095   //NoDataExceptionBase(const NoDataExceptionBase&) ; //allow default
00096   //const NoDataExceptionBase& operator=(const NoDataExceptionBase&); // allow default
00097 
00098   // ---------- data members -------------------------------
00099   EventSetupRecordKey record_;
00100   DataKey dataKey_;
00101 };
00102 
00103 template <class T>
00104  class NoDataException : public NoDataExceptionBase 
00105 {
00106 public:
00107   NoDataException(const EventSetupRecordKey& iRecordKey,
00108                   const DataKey& iDataKey,
00109                   const char* category_name = "NoDataException") :
00110   NoDataExceptionBase(iRecordKey, iDataKey, category_name)
00111   {
00112     constructMessage(heterocontainer::className<T>(),
00113                      providerButNoDataMessage(iRecordKey));
00114   }
00115 
00116   NoDataException(const EventSetupRecordKey& iRecordKey,
00117                   const DataKey& iDataKey,
00118                   const char* category_name ,
00119                   const std::string& iExtraInfo ) :
00120   NoDataExceptionBase(iRecordKey, iDataKey, category_name)  
00121   {
00122     constructMessage(heterocontainer::className<T>(),
00123                      iExtraInfo);
00124   }
00125 
00126 };
00127 
00128    }
00129 }
00130 #endif