FunctionFactoryErrors.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef SCIMATH_FUNCTIONFACTORYERRORS_H
00030 #define SCIMATH_FUNCTIONFACTORYERRORS_H
00031
00032 #include <casacore/casa/aips.h>
00033 #include <casacore/casa/Exceptions/Error.h>
00034
00035 namespace casacore {
00036
00037 class FunctionFactoryError : public AipsError {
00038 public:
00039 FunctionFactoryError(const String& message,Category c=GENERAL) : AipsError(message,c) {}
00040 virtual ~FunctionFactoryError() throw();
00041 };
00042
00043 class UnrecognizedFunctionError : public FunctionFactoryError {
00044 public:
00045
00046
00047
00048 UnrecognizedFunctionError(const String& name, Category c=INVALID_ARGUMENT) :
00049 FunctionFactoryError(String("Unrecognized function: ") + name,c),
00050 fname(name)
00051 {}
00052 virtual ~UnrecognizedFunctionError() throw();
00053
00054 const String& getName() { return fname; }
00055
00056 private:
00057 String fname;
00058 };
00059
00060 class InvalidSerializationError : public FunctionFactoryError {
00061 public:
00062
00063
00064
00065 InvalidSerializationError(const String& reason,Category c=GENERAL) :
00066 FunctionFactoryError(preamble + reason,c), reas(reason) {}
00067
00068 virtual ~InvalidSerializationError() throw();
00069 const String& getReason() { return reas; }
00070
00071 static const String preamble;
00072
00073 private:
00074 String reas;
00075 };
00076
00077 class FieldNotFoundError : public InvalidSerializationError {
00078 public:
00079 FieldNotFoundError(const String& field,Category c=GENERAL) :
00080 InvalidSerializationError(String("No ") + field + " defined",c),
00081 fname(field)
00082 {}
00083 virtual ~FieldNotFoundError() throw();
00084
00085 private:
00086 String fname;
00087 };
00088
00089
00090 }
00091
00092 #endif