casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MirExceptions.h
Go to the documentation of this file.
1 //# <MirExceptions.h>: this defines exception classes associated with filling errors
2 //# Copyright (C) 2000,2001,2003
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 //# $Id: MirExceptions.h,v 1.1 2009/09/03 18:54:47 pteuben Exp $
28 
29 #ifndef BIMA_MIREXCEPTIONS_H
30 #define BIMA_MIREXCEPTIONS_H
31 
32 #include <casa/Exceptions/Error.h>
33 
34 #include <casa/namespace.h>
35 //# Forward Declarations
36 
37 //# UnavailableMiriadDataSelectionError
38 // <summary>
39 // an exception indicating that a requested data selection from a Miriad
40 // dataset is not available.
41 // </summary>
42 //
43 // <use visibility=export>
44 //
45 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
46 // </reviewed>
47 //
48 // <synopsis>
49 // This class can be thrown as an exception to indicate that a requested
50 // data selection from a Miriad dataset is not available, usually because
51 // the selection is out of the bounds of the dataset's contents.
52 // </synopsis>
53 //
54 // <example>
55 // <srcblock>
56 // if (win > maxwin || win <= 0)
57 // throw UnavailableMiriadDataSelectionError("No such window", win);
58 // }
59 // </srcblock>
60 // </example>
61 //
62 // <motivation>
63 // Users can potentially make illegal data selection requests.
64 // </motivation>
65 //
67 public:
68 
69  // An exception with a message. win usually is a window number.
71 
72  // An exception with a message. sel is the data selection value (e.g.
73  // requested source name).
75 
76  virtual ~UnavailableMiriadDataSelectionError() throw();
77 
78 protected:
79  // Message-less exceptions should not be created excepted possibly by
80  // subclasses
82 
83  // format a message from a string and the illegal integer selection.
84  // This class is used as a convenience for the instantiating the
85  // parent class, casacore::AipsError, which can only take a simple String.
86  static casacore::String makeMsg(const casacore::String& msg, casacore::Int selval=0);
87 };
88 
89 //# MiriadFormatError
90 // <summary>
91 // an exception indicating that a non-recoverable format error was detected
92 // in the input Miriad dataset
93 // </summary>
94 //
95 // <use visibility=export>
96 //
97 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
98 // </reviewed>
99 //
100 // <synopsis>
101 // This exception can be thrown when a Miriad dataset contains some unexpected
102 // and/or illegal structures. This may happen if the dataset is corrupted or
103 // otherwise does not conform to the legal format specification.
104 // </synopsis>
105 //
106 // <example>
107 // <srcblock>
108 // uvprobvr_c(mirds_handle, "sfreq", vtype, &vlen, &vupd);
109 // if (vlen != nspect) {
110 // throw MiriadFormatError(casacore::String("Wrong number of values for variable ") +
111 // "sfreq: got " + vlen + "; expected " + nspect);
112 // }
113 // </srcblock>
114 // </example>
115 //
116 // <motivation>
117 // This class handles the possibility that a non-conforming or corrupted
118 // Miriad dataset is encountered.
119 // </motivation>
120 //
122 public:
123  // create the exception with a message describing the format error
125 
126  virtual ~MiriadFormatError() throw();
127 
128 protected:
129  // Message-less exceptions should not be created excepted possibly by
130  // subclasses
132 };
133 
134 
135 //# MiriadUnsupportedFeatureError
136 // <summary>
137 // an exception indicating that further processing is dependent on an
138 // unsupported feature of a Miriad dataset
139 // </summary>
140 
141 // <use visibility=export>
142 
143 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
144 // </reviewed>
145 
146 // <etymology>
147 // Not all features of a Miriad dataset are necessarily supported by the filler
148 // classes.
149 // </etymology>
150 //
151 // <synopsis>
152 // This exception can be thrown during the processing of a Miriad dataset when
153 // an unsupported feature is encountered. For example, early versions of the
154 // Miriad filler do not support multiple polarizations, although future
155 // support is expected. When multiple polarizations are found in the dataset,
156 // this class is thrown as an exception.
157 // </synopsis>
158 //
159 // <example>
160 // <srcblock>
161 // if (! supported(feature)) {
162 // throw MiriadUnsupportedFeatureError(casacore::String("Feature ") + feature.name()
163 // + " not yet supported");
164 // }
165 // </srcblock>
166 // </example>
167 //
168 // <motivation>
169 // This class allows features of a Miriad dataset to be supported incrementally
170 // with new versions of the filler classes.
171 // </motivation>
172 //
174 public:
175 
176  // An exception with a message indicating the unsupported feature
178 
179  virtual ~MiriadUnsupportedFeatureError() throw();
180 
181 protected:
182  // Message-less exceptions should not be created excepted possibly by
183  // subclasses
185 };
186 
187 
188 #endif
189 
190 
int Int
Definition: aipstype.h:50
virtual ~MiriadFormatError()
an exception indicating that further processing is dependent on an unsupported feature of a Miriad da...
MiriadFormatError()
Message-less exceptions should not be created excepted possibly by subclasses.
an exception indicating that a requested data selection from a Miriad dataset is not available...
Definition: MirExceptions.h:66
an exception indicating that a non-recoverable format error was detected in the input Miriad dataset ...
MiriadUnsupportedFeatureError()
Message-less exceptions should not be created excepted possibly by subclasses.
UnavailableMiriadDataSelectionError()
Message-less exceptions should not be created excepted possibly by subclasses.
Base class for all Casacore library errors.
Definition: Error.h:134
static casacore::String makeMsg(const casacore::String &msg, casacore::Int selval=0)
format a message from a string and the illegal integer selection.
String: the storage and methods of handling collections of characters.
Definition: String.h:223