FunctionFactoryErrors.h

Go to the documentation of this file.
00001 //# FunctionFactoryErrors:  Exception classes for use by FunctionFactories & clients
00002 //# Copyright (C) 2002
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id$
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 { //# NAMESPACE CASACORE - BEGIN
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     // create an exception indicating that the a function of the given name
00047     // is not recognized
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     // create an exception indicating a Record serialization of a 
00063     // Function is invalid.  The error message will be a "Invalid function 
00064     // description in  record: " + reason.
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 } //# NAMESPACE CASACORE - END
00091 
00092 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1