casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
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: FunctionFactoryErrors.h 18093 2004-11-30 17:51:10Z ddebonis $
00028 
00029 #ifndef SCIMATH_FUNCTIONFACTORYERRORS_H
00030 #define SCIMATH_FUNCTIONFACTORYERRORS_H
00031 
00032 #include <casa/Exceptions/Error.h>
00033 
00034 namespace casa { //# NAMESPACE CASA - BEGIN
00035 
00036 class FunctionFactoryError : public AipsError {
00037 public:
00038     FunctionFactoryError(const String& message,Category c=GENERAL) : AipsError(message,c) {}
00039     virtual ~FunctionFactoryError() throw();
00040 };
00041 
00042 class UnrecognizedFunctionError : public FunctionFactoryError {
00043 public:
00044 
00045     // create an exception indicating that the a function of the given name
00046     // is not recognized
00047     UnrecognizedFunctionError(const String& name, Category c=INVALID_ARGUMENT) : 
00048         FunctionFactoryError(String("Unrecognized function: ") + name,c), 
00049         fname(name) 
00050     {}
00051     virtual ~UnrecognizedFunctionError() throw();
00052 
00053     const String& getName() { return fname; }
00054 
00055 private:
00056     String fname;
00057 };
00058 
00059 class InvalidSerializationError : public FunctionFactoryError {
00060 public:
00061     // create an exception indicating a Record serialization of a 
00062     // Function is invalid.  The error message will be a "Invalid function 
00063     // description in  record: " + reason.
00064     InvalidSerializationError(const String& reason,Category c=GENERAL) : 
00065         FunctionFactoryError(preamble + reason,c), reas(reason) {}
00066 
00067     virtual ~InvalidSerializationError() throw();
00068     const String& getReason() { return reas; } 
00069 
00070     static const String preamble;
00071 
00072 private:
00073     String reas;
00074 };
00075 
00076 class FieldNotFoundError : public InvalidSerializationError {
00077 public:
00078     FieldNotFoundError(const String& field,Category c=GENERAL) : 
00079         InvalidSerializationError(String("No ") + field + " defined",c),
00080         fname(field)
00081     {}
00082     virtual ~FieldNotFoundError() throw();
00083 
00084 private:
00085     String fname;
00086 };
00087 
00088 
00089 } //# NAMESPACE CASA - END
00090 
00091 #endif