File indexing completed on 2023-03-17 10:39:07
0001 #ifndef GENERS_IOEXCEPTION_HH_
0002 #define GENERS_IOEXCEPTION_HH_
0003
0004 #include <string>
0005
0006 #include "FWCore/Utilities/interface/Exception.h"
0007
0008 namespace gs {
0009
0010 struct IOException : public cms::Exception {
0011 inline IOException() : cms::Exception("gs::IOException") {}
0012
0013 inline explicit IOException(const std::string &description) : cms::Exception(description) {}
0014
0015 inline explicit IOException(const char *description) : cms::Exception(description) {}
0016
0017 ~IOException() throw() override {}
0018 };
0019
0020 struct IOLengthError : public IOException {
0021 inline IOLengthError() : IOException("gs::IOLengthError") {}
0022
0023 inline explicit IOLengthError(const std::string &description) : IOException(description) {}
0024
0025 ~IOLengthError() throw() override {}
0026 };
0027
0028 struct IOOutOfRange : public IOException {
0029 inline IOOutOfRange() : IOException("gs::IOOutOfRange") {}
0030
0031 inline explicit IOOutOfRange(const std::string &description) : IOException(description) {}
0032
0033 ~IOOutOfRange() throw() override {}
0034 };
0035
0036 struct IOInvalidArgument : public IOException {
0037 inline IOInvalidArgument() : IOException("gs::IOInvalidArgument") {}
0038
0039 inline explicit IOInvalidArgument(const std::string &description) : IOException(description) {}
0040
0041 ~IOInvalidArgument() throw() override {}
0042 };
0043
0044
0045
0046
0047
0048
0049
0050
0051 class IOOpeningFailure : public IOException {
0052 inline static std::string fileOpeningFailure(const std::string &whereInTheCode, const std::string &filename) {
0053 std::string msg("In ");
0054 msg += whereInTheCode;
0055 msg += ": failed to open file \"";
0056 msg += filename;
0057 msg += "\"";
0058 return msg;
0059 }
0060
0061 public:
0062 inline IOOpeningFailure() : IOException("gs::IOOpeningFailure") {}
0063
0064 inline explicit IOOpeningFailure(const std::string &description) : IOException(description) {}
0065
0066 inline IOOpeningFailure(const std::string &whereInTheCode, const std::string &filename)
0067 : IOException(fileOpeningFailure(whereInTheCode, filename)) {}
0068
0069 ~IOOpeningFailure() throw() override {}
0070 };
0071
0072
0073
0074
0075
0076
0077 struct IOWriteFailure : public IOException {
0078 inline IOWriteFailure() : IOException("gs::IOWriteFailure") {}
0079
0080 inline explicit IOWriteFailure(const std::string &description) : IOException(description) {}
0081
0082 ~IOWriteFailure() throw() override {}
0083 };
0084
0085
0086
0087
0088
0089
0090 struct IOReadFailure : public IOException {
0091 inline IOReadFailure() : IOException("gs::IOReadFailure") {}
0092
0093 inline explicit IOReadFailure(const std::string &description) : IOException(description) {}
0094
0095 ~IOReadFailure() throw() override {}
0096 };
0097
0098
0099
0100
0101
0102 struct IOInvalidData : public IOException {
0103 inline IOInvalidData() : IOException("gs::IOInvalidData") {}
0104
0105 inline explicit IOInvalidData(const std::string &description) : IOException(description) {}
0106
0107 ~IOInvalidData() throw() override {}
0108 };
0109 }
0110
0111 #endif