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