File indexing completed on 2024-04-06 12:12:04
0001 #ifndef FWCore_Framework_NoDataException_h
0002 #define FWCore_Framework_NoDataException_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066 #include <string>
0067
0068
0069 #include "FWCore/Framework/interface/DataKey.h"
0070 #include "FWCore/Framework/interface/EventSetupRecordKey.h"
0071 #include "FWCore/Framework/interface/HCTypeTag.h"
0072 #include "FWCore/Utilities/interface/Exception.h"
0073
0074
0075 namespace edm {
0076 namespace eventsetup {
0077
0078 class NoDataExceptionBase : public cms::Exception {
0079 public:
0080 NoDataExceptionBase(const EventSetupRecordKey& iRecordKey,
0081 const DataKey& iDataKey,
0082 const char* category_name = "NoDataException");
0083 ~NoDataExceptionBase() noexcept override;
0084 const DataKey& dataKey() const;
0085
0086 protected:
0087 static std::string providerButNoDataMessage(const EventSetupRecordKey& iKey);
0088 static std::string noProviderMessage();
0089 void constructMessage(const char* iClassName, const std::string& iExtraInfo);
0090
0091 private:
0092 void beginDataTypeMessage(std::string&) const;
0093 void endDataTypeMessage(std::string&) const;
0094
0095
0096
0097
0098
0099
0100 EventSetupRecordKey record_;
0101 DataKey dataKey_;
0102 };
0103
0104 template <class T>
0105 class NoDataException : public NoDataExceptionBase {
0106 public:
0107 NoDataException(const EventSetupRecordKey& iRecordKey,
0108 const DataKey& iDataKey,
0109 const char* category_name = "NoDataException")
0110 : NoDataExceptionBase(iRecordKey, iDataKey, category_name) {
0111 constructMessage(heterocontainer::className<T>(), providerButNoDataMessage(iRecordKey));
0112 }
0113
0114 NoDataException(const EventSetupRecordKey& iRecordKey,
0115 const DataKey& iDataKey,
0116 const char* category_name,
0117 const std::string& iExtraInfo)
0118 : NoDataExceptionBase(iRecordKey, iDataKey, category_name) {
0119 constructMessage(heterocontainer::className<T>(), iExtraInfo);
0120 }
0121 };
0122
0123 }
0124 }
0125 #endif