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