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