casacore
Loading...
Searching...
No Matches
TableError.h
Go to the documentation of this file.
1// # TableError.h: Table error classes
2// # Copyright (C) 1994,1995,1996,1997,1999,2000
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: casa-feedback@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#ifndef TABLES_TABLEERROR_H
27#define TABLES_TABLEERROR_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Exceptions/Error.h>
32
33namespace casacore { // # NAMESPACE CASACORE - BEGIN
34
35// # Forward Declarations.
36class IPosition;
37
38// # This header file defines the error classes belonging to the table
39// # descriptor class and its associated classes.
40
41// <summary>
42// Base error class for storage manager
43// </summary>
44// <use visibility=export>
45// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
46// </reviewed>
47
48// <synopsis>
49// This is the generic StMan exception; catching this one means catching
50// all Table* exceptions.
51// Note that you have to catch AipsError to catch all possible exceptions.
52// </synopsis>
53
54class TableError : public AipsError {
55 public:
56 // The default constructor generates the message "Table error".
58 // Construct with given message.
60 ~TableError() noexcept;
61};
62
63// <summary>
64// Internal table error
65// </summary>
66// <use visibility=export>
67// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
68// </reviewed>
69
70// <synopsis>
71// Internal table error (should never be thrown).
72// If this is thrown, something is terribly wrong.
73// </synopsis>
74
76 public:
77 // Add given message to string "Internal Table error: ".
80};
81
82// <summary>
83// Table error; table (description) already exists
84// </summary>
85// <use visibility=export>
86// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
87// </reviewed>
88
89// <synopsis>
90// Table (description) with this name already exists.
91// </synopsis>
92
93class TableDuplFile : public TableError {
94 public:
95 // This constructor generates a message telling that the a table
96 // or description with the given name already exists.
98 // This constructor generates a message telling that the a table
99 // or description with the given name already exists.
100 // The given message is appended to it.
102 ~TableDuplFile() noexcept;
103};
104
105// <summary>
106// Table error; table (description) not found
107// </summary>
108// <use visibility=export>
109// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
110// </reviewed>
111
112// <synopsis>
113// Table (description) with this name could not be found.
114// </synopsis>
115
116class TableNoFile : public TableError {
117 public:
118 // This constructor generates a message telling that the a table
119 // or description with the given name does not exist.
121 ~TableNoFile() noexcept;
122};
123
124// <summary>
125// Table error; no name given to table description
126// </summary>
127// <use visibility=export>
128// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
129// </reviewed>
130
131// <synopsis>
132// No name given for the table description.
133// Only scratch descriptions can have no name (i.e. a blank name).
134// </synopsis>
135
137 public:
138 // The default constructor generates the message.
141};
142
143// <summary>
144// Table error; invalid table (description) option
145// </summary>
146// <use visibility=export>
147// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
148// </reviewed>
149
150// <synopsis>
151// Invalid Table(Desc) option given for the table (description).
152// </synopsis>
153
154class TableInvOpt : public TableError {
155 public:
156 // This constructor generates a message that an invalid option
157 // has been given. The class name is either Table or TableDesc.
158 // The given message will be appended to the total message.
160 ~TableInvOpt() noexcept;
161};
162
163// Table error; path is not a directory
164// </summary>
165// <use visibility=export>
166// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
167// </reviewed>
168
169// <synopsis>
170// Table directory with this name could not be found.
171// </synopsis>
172
173class TableNoDir : public TableError {
174 public:
175 // This constructor generates a message telling that the
176 // table directory with the given name does not exist.
178 ~TableNoDir() noexcept;
179};
180
181// <summary>
182// Table error; table.dat file not found
183// </summary>
184// <use visibility=export>
185// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
186// </reviewed>
187
188// <synopsis>
189// The table.dat file for this table could not be found.
190// </synopsis>
191
193 public:
194 // This constructor generates a message telling that the a table
195 // or datription file does not exist.
197 ~TableNoDatFile() noexcept;
198};
199
200// <summary>
201// Table error; table type mismatch
202// </summary>
203// <use visibility=export>
204// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
205// </reviewed>
206
207// <synopsis>
208// The given table type (i.e. name of the table description) does
209// not match the type as stored in the table file.
210// </synopsis>
211
212class TableInvType : public TableError {
213 public:
214 // This constructor generates a message that the in table type
215 // mismatches the table type in the file.
216 TableInvType(const String& tablename, const String& typeIn, const String& typeFile,
218 ~TableInvType() noexcept;
219};
220
221// <summary>
222// Table error; invalid column description
223// </summary>
224// <use visibility=export>
225// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
226// </reviewed>
227
228// <synopsis>
229// The description of a column is invalid.
230// The given default manager is unknown
231// (i.e. not registered in DataManReg.cc).
232// </synopsis>
233
235 public:
236 // This constructor generates a message that the column
237 // with the given name has an invalid description.
238 TableInvColumnDesc(const String& columnName, const String& message,
241};
242
243// <summary>
244// Table error; invalid hypercolumn description
245// </summary>
246// <use visibility=export>
247// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
248// </reviewed>
249
250// <synopsis>
251// The description of a hypercolumn is invalid.
252// The referenced columns are unknown or invalid.
253// The message explains the reason.
254// </synopsis>
255
257 public:
258 // This constructor generates a message that the hypercolumn
259 // with the given name has an invalid description.
260 TableInvHyperDesc(const String& hypercolumnName, const String& message,
263};
264
265// <summary>
266// Table error; unknown column description
267// </summary>
268// <use visibility=export>
269// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
270// </reviewed>
271
272// <synopsis>
273// To be able to reconstruct the correct column description object
274// from a stored table description, each column description type
275// must register itself (see ColumnDesc.h and ColumnReg.cc).
276// </synopsis>
277
279 public:
280 // This constructor generates a message that the class with the
281 // given name is unknown (not registered).
284};
285
286// <summary>
287// Table error; invalid data type
288// </summary>
289// <use visibility=export>
290// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
291// </reviewed>
292
293// <synopsis>
294// Checking of the data type of a column is done at runtime.
295// This error results from non-matching data types when constructing
296// a ScalarColumn or ArrayColumn or from invalid data type promotions
297// when doing a get or put.
298// </synopsis>
299
300class TableInvDT : public TableError {
301 public:
302 // The default constructor generates a generic "invalid data type" message.
304 // Put the name of the offending column in the "invalid data type" message.
305 TableInvDT(const String& columName, Category c = CONFORMANCE);
306 ~TableInvDT() noexcept;
307};
308
309// <summary>
310// Table error; invalid operation
311// </summary>
312// <use visibility=export>
313// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
314// </reviewed>
315
316// <synopsis>
317// Invalid operation on a table.
318// A request was done that could not be handled by the table system
319// (e.g. sorting on a column containing arrays).
320// The message tells what is wrong.
321// </synopsis>
322
323// Invalid operation on a table.
324class TableInvOper : public TableError {
325 public:
326 // The default constructor generates a generic "invalid operation" message.
328 // Add given message to string "Invalid Table operation: ".
330 ~TableInvOper() noexcept;
331};
332
333// <summary>
334// Table error; non-conformant array
335// </summary>
336// <use visibility=export>
337// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
338// </reviewed>
339
340// <synopsis>
341// When putting a direct array, the shape of the array must conform
342// the shape as defined for the table array.
343// When getting an array, the receiving array must be zero-length
344// or it must conform the shape of the table array.
345// </synopsis>
346
348 public:
349 // This constructor appends ": Table array conformance error"
350 // to the given message.
352 // This constructor appends ": Table array conformance error"
353 // to the given message with the given and expected shape.
355 const IPosition& expectedShape, Category c = CONFORMANCE);
357};
358
359// <summary>
360// Table error; table length conformance error
361// </summary>
362// <use visibility=export>
363// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
364// </reviewed>
365
366// <synopsis>
367// When putting a column, the length of the vector must match the
368// length of the table (i.e. its number of rows).
369// When getting a column, the length of the vector must be zero or
370// it must match the length of the table.
371// </synopsis>
372
374 public:
375 // This constructor appends ": Table conformance error (#rows mismatch)"
376 // to the given message.
379};
380
381// <summary>
382// Table error; invalid sort
383// </summary>
384// <use visibility=export>
385// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
386// </reviewed>
387
388// <synopsis>
389// Invalid sort operation on a table.
390// A sort can only be done on a scalar column.
391// </synopsis>
392
393class TableInvSort : public TableError {
394 public:
395 // The default constructor generates a generic "invalid sort" message.
397 // This constructor appends the given message to the "invalid sort"
398 // message.
400 ~TableInvSort() noexcept;
401};
402
403// <summary>
404// Table error; invalid logical operation
405// </summary>
406// <use visibility=export>
407// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
408// </reviewed>
409
410// <synopsis>
411// Invalid logical table operation.
412// When combining tables using a union, difference, etc., the
413// tables involved have to stem from the same root. I.e. they
414// should all refer to the same underlying table.
415// </synopsis>
416
417class TableInvLogic : public TableError {
418 public:
419 // The default constructor generates the message.
421 ~TableInvLogic() noexcept;
422};
423
424// <summary>
425// Table error; invalid select expression
426// </summary>
427// <use visibility=export>
428// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
429// </reviewed>
430
431// <synopsis>
432// Invalid table select expression.
433// A column is not a scalar or belongs to another table than
434// the table on which the selection will be done.
435// </synopsis>
436
437class TableInvExpr : public TableError {
438 public:
440 // This constructor generates a message containing the name of
441 // the offending column. It appends the given message.
443 ~TableInvExpr() noexcept;
444};
445
446// <summary>
447// Table error; non-conformant table vectors
448// </summary>
449// <use visibility=export>
450// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
451// </reviewed>
452
453// <synopsis>
454// Table vectors are not conformant (have different lengths)
455// </synopsis>
456
458 public:
459 // The default constructor generates the message.
462};
463
464// <summary>
465// Table error; invalid table command
466// </summary>
467// <use visibility=export>
468// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
469// </reviewed>
470
471// <synopsis>
472// The parser in TableGram/TableParse found an error in
473// the given table command.
474// </synopsis>
475
477 public:
478 // This constructor generates a message containing the table command.
479 TableParseError(const String& commandString, int pos = -1, const String& token = String(),
482 // Get error position or token.
483 int pos() const { return itsPos; }
484 const String& token() const { return itsToken; }
485
486 private:
489};
490
491// <summary>
492// Table grammar error; invalid table command
493// </summary>
494// <use visibility=export>
495// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
496// </reviewed>
497
498// <synopsis>
499// The parser in TableGram/TableParse found an error in
500// the given table command.
501// </synopsis>
502
504 public:
505 // This constructor generates a message containing the table command.
507 ~TableGramError() noexcept;
508 // Get error position or token.
509 int pos() const { return itsPos; }
510 const String& token() const { return itsToken; }
511
512 private:
515};
516
517} // namespace casacore
518
519#endif
AipsError(const Char *str, Category c=GENERAL)
Creates an AipsError and initializes the error message from the parameter.
String: the storage and methods of handling collections of characters.
Definition String.h:355
TableArrayConformanceError(const String &message, const IPosition &shape, const IPosition &expectedShape, Category c=CONFORMANCE)
This constructor appends ": Table array conformance error" to the given message with the given and ex...
TableArrayConformanceError(const String &message, Category c=CONFORMANCE)
This constructor appends ": Table array conformance error" to the given message.
TableConformanceError(const String &message, Category c=CONFORMANCE)
This constructor appends ": Table conformance error (\#rows mismatch)" to the given message.
TableDescNoName(Category c=INITIALIZATION)
The default constructor generates the message.
TableDuplFile(const String &name, Category c=INVALID_ARGUMENT)
This constructor generates a message telling that the a table or description with the given name alre...
TableDuplFile(const String &name, const String &message, Category c=INVALID_ARGUMENT)
This constructor generates a message telling that the a table or description with the given name alre...
TableError(const String &message, Category c=GENERAL)
Construct with given message.
TableError(Category c=GENERAL)
The default constructor generates the message "Table error".
~TableError() noexcept
int pos() const
Get error position or token.
Definition TableError.h:509
TableGramError(int pos, const String &token, Category c=INVALID_ARGUMENT)
This constructor generates a message containing the table command.
const String & token() const
Definition TableError.h:510
TableInternalError(const String &message, Category c=GENERAL)
Add given message to string "Internal Table error: ".
TableInvColumnDesc(const String &columnName, const String &message, Category c=INVALID_ARGUMENT)
This constructor generates a message that the column with the given name has an invalid description.
~TableInvDT() noexcept
TableInvDT(Category c=CONFORMANCE)
The default constructor generates a generic "invalid data type" message.
TableInvDT(const String &columName, Category c=CONFORMANCE)
Put the name of the offending column in the "invalid data type" message.
TableInvExpr(const String &message, Category c=INVALID_ARGUMENT)
TableInvExpr(const String &columnName, const String &message, Category c=INVALID_ARGUMENT)
This constructor generates a message containing the name of the offending column.
TableInvHyperDesc(const String &hypercolumnName, const String &message, Category c=INVALID_ARGUMENT)
This constructor generates a message that the hypercolumn with the given name has an invalid descript...
TableInvLogic(Category c=INVALID_ARGUMENT)
The default constructor generates the message.
TableInvOper(Category c=INVALID_ARGUMENT)
The default constructor generates a generic "invalid operation" message.
TableInvOper(const String &message, Category c=INVALID_ARGUMENT)
Add given message to string "Invalid Table operation: ".
TableInvOpt(const String &className, const String &message, Category c=INVALID_ARGUMENT)
This constructor generates a message that an invalid option has been given.
TableInvSort(Category c=INVALID_ARGUMENT)
The default constructor generates a generic "invalid sort" message.
TableInvSort(const String &message, Category c=INVALID_ARGUMENT)
This constructor appends the given message to the "invalid sort" message.
TableInvType(const String &tablename, const String &typeIn, const String &typeFile, Category c=CONFORMANCE)
This constructor generates a message that the in table type mismatches the table type in the file.
TableNoDatFile(const String &filename, Category c=INVALID_ARGUMENT)
This constructor generates a message telling that the a table or datription file does not exist.
~TableNoDir() noexcept
TableNoDir(const String &name, Category c=INVALID_ARGUMENT)
This constructor generates a message telling that the table directory with the given name does not ex...
TableNoFile(const String &name, Category c=INVALID_ARGUMENT)
This constructor generates a message telling that the a table or description with the given name does...
const String & token() const
Definition TableError.h:484
int pos() const
Get error position or token.
Definition TableError.h:483
TableParseError(const String &commandString, int pos=-1, const String &token=String(), Category c=INVALID_ARGUMENT)
This constructor generates a message containing the table command.
TableUnknownDesc(const String &name, Category c=INITIALIZATION)
This constructor generates a message that the class with the given name is unknown (not registered).
TableVectorNonConform(Category c=CONFORMANCE)
The default constructor generates the message.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
IPosition shape(const RecordFieldId &) const
Get the actual shape of this field.
String name() const
Return the name of the field.