casa
$Rev:20696$
|
00001 //# TableError.h: Table error classes 00002 //# Copyright (C) 1994,1995,1996,1997,1999,2000 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id: TableError.h 21051 2011-04-20 11:46:29Z gervandiepen $ 00027 00028 #ifndef TABLES_TABLEERROR_H 00029 #define TABLES_TABLEERROR_H 00030 00031 //# Includes 00032 #include <casa/aips.h> 00033 #include <casa/Exceptions/Error.h> 00034 00035 00036 namespace casa { //# NAMESPACE CASA - BEGIN 00037 00038 //# This header file defines the error classes belonging to the table 00039 //# descriptor class and its associated classes. 00040 00041 00042 // <summary> 00043 // Base error class for storage manager 00044 // </summary> 00045 // <use visibility=export> 00046 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00047 // </reviewed> 00048 00049 // <synopsis> 00050 // This is the generic StMan exception; catching this one means catching 00051 // all Table* exceptions. 00052 // Note that you have to catch AipsError to catch all possible exceptions. 00053 // </synopsis> 00054 00055 class TableError : public AipsError { 00056 public: 00057 // The default constructor generates the message "Table error". 00058 TableError (Category c=GENERAL); 00059 // Construct with given message. 00060 TableError (const String& message,Category c=GENERAL); 00061 ~TableError () throw(); 00062 }; 00063 00064 00065 // <summary> 00066 // Internal table error 00067 // </summary> 00068 // <use visibility=export> 00069 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00070 // </reviewed> 00071 00072 // <synopsis> 00073 // Internal table error (should never be thrown). 00074 // If this is thrown, something is terribly wrong. 00075 // </synopsis> 00076 00077 class TableInternalError : public TableError { 00078 public: 00079 // Add given message to string "Internal Table error: ". 00080 TableInternalError (const String& message,Category c=GENERAL); 00081 ~TableInternalError () throw(); 00082 }; 00083 00084 00085 // <summary> 00086 // Table error; table (description) already exists 00087 // </summary> 00088 // <use visibility=export> 00089 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00090 // </reviewed> 00091 00092 // <synopsis> 00093 // Table (description) with this name already exists. 00094 // </synopsis> 00095 00096 class TableDuplFile : public TableError { 00097 public: 00098 // This constructor generates a message telling that the a table 00099 // or description with the given name already exists. 00100 TableDuplFile (const String& name, Category c=INVALID_ARGUMENT); 00101 // This constructor generates a message telling that the a table 00102 // or description with the given name already exists. 00103 // The given message is appended to it. 00104 TableDuplFile (const String& name, const String& message,Category c=INVALID_ARGUMENT); 00105 ~TableDuplFile () throw(); 00106 }; 00107 00108 00109 // <summary> 00110 // Table error; table (description) not found 00111 // </summary> 00112 // <use visibility=export> 00113 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00114 // </reviewed> 00115 00116 // <synopsis> 00117 // Table (description) with this name could not be found. 00118 // </synopsis> 00119 00120 class TableNoFile : public TableError { 00121 public: 00122 // This constructor generates a message telling that the a table 00123 // or description with the given name does not exist. 00124 TableNoFile (const String& name,Category c=INVALID_ARGUMENT); 00125 ~TableNoFile () throw(); 00126 }; 00127 00128 00129 // <summary> 00130 // Table error; no name given to table description 00131 // </summary> 00132 // <use visibility=export> 00133 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00134 // </reviewed> 00135 00136 // <synopsis> 00137 // No name given for the table description. 00138 // Only scratch descriptions can have no name (i.e. a blank name). 00139 // </synopsis> 00140 00141 class TableDescNoName : public TableError { 00142 public: 00143 // The default constructor generates the message. 00144 TableDescNoName (Category c=INITIALIZATION); 00145 ~TableDescNoName () throw(); 00146 }; 00147 00148 00149 // <summary> 00150 // Table error; invalid table (description) option 00151 // </summary> 00152 // <use visibility=export> 00153 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00154 // </reviewed> 00155 00156 // <synopsis> 00157 // Invalid Table(Desc) option given for the table (description). 00158 // </synopsis> 00159 00160 class TableInvOpt : public TableError { 00161 public: 00162 // This constructor generates a message that an invalid option 00163 // has been given. The class name is either Table or TableDesc. 00164 // The given message will be appended to the total message. 00165 TableInvOpt (const String& className, const String& message,Category c=INVALID_ARGUMENT); 00166 ~TableInvOpt () throw(); 00167 }; 00168 00169 00170 // Table error; path is not a directory 00171 // </summary> 00172 // <use visibility=export> 00173 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00174 // </reviewed> 00175 00176 // <synopsis> 00177 // Table directory with this name could not be found. 00178 // </synopsis> 00179 00180 class TableNoDir : public TableError { 00181 public: 00182 // This constructor generates a message telling that the 00183 // table directory with the given name does not exist. 00184 TableNoDir (const String& name,Category c=INVALID_ARGUMENT); 00185 ~TableNoDir () throw(); 00186 }; 00187 00188 // <summary> 00189 // Table error; table.dat file not found 00190 // </summary> 00191 // <use visibility=export> 00192 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00193 // </reviewed> 00194 00195 // <synopsis> 00196 // The table.dat file for this table could not be found. 00197 // </synopsis> 00198 00199 class TableNoDatFile : public TableError { 00200 public: 00201 // This constructor generates a message telling that the a table 00202 // or datription file does not exist. 00203 TableNoDatFile (const String& filename,Category c=INVALID_ARGUMENT); 00204 ~TableNoDatFile () throw(); 00205 }; 00206 00207 00208 // <summary> 00209 // Table error; table type mismatch 00210 // </summary> 00211 // <use visibility=export> 00212 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00213 // </reviewed> 00214 00215 // <synopsis> 00216 // The given table type (i.e. name of the table description) does 00217 // not match the type as stored in the table file. 00218 // </synopsis> 00219 00220 class TableInvType : public TableError { 00221 public: 00222 // This constructor generates a message that the in table type 00223 // mismatches the table type in the file. 00224 TableInvType (const String& tablename, 00225 const String& typeIn, const String& typeFile, 00226 Category c=CONFORMANCE); 00227 ~TableInvType () throw(); 00228 }; 00229 00230 00231 // <summary> 00232 // Table error; invalid column description 00233 // </summary> 00234 // <use visibility=export> 00235 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00236 // </reviewed> 00237 00238 // <synopsis> 00239 // The description of a column is invalid. 00240 // The given default manager is unknown 00241 // (i.e. not registered in DataManReg.cc). 00242 // </synopsis> 00243 00244 class TableInvColumnDesc : public TableError { 00245 public: 00246 // This constructor generates a message that the column 00247 // with the given name has an invalid description. 00248 TableInvColumnDesc (const String& columnName, const String& message,Category c=INVALID_ARGUMENT); 00249 ~TableInvColumnDesc () throw(); 00250 }; 00251 00252 00253 // <summary> 00254 // Table error; invalid hypercolumn description 00255 // </summary> 00256 // <use visibility=export> 00257 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00258 // </reviewed> 00259 00260 // <synopsis> 00261 // The description of a hypercolumn is invalid. 00262 // The referenced columns are unknown or invalid. 00263 // The message explains the reason. 00264 // </synopsis> 00265 00266 class TableInvHyperDesc : public TableError { 00267 public: 00268 // This constructor generates a message that the hypercolumn 00269 // with the given name has an invalid description. 00270 TableInvHyperDesc (const String& hypercolumnName, const String& message,Category c=INVALID_ARGUMENT); 00271 ~TableInvHyperDesc () throw(); 00272 }; 00273 00274 00275 // <summary> 00276 // Table error; unknown column description 00277 // </summary> 00278 // <use visibility=export> 00279 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00280 // </reviewed> 00281 00282 // <synopsis> 00283 // To be able to reconstruct the correct column description object 00284 // from a stored table description, each column description type 00285 // must register itself (see ColumnDesc.h and ColumnReg.cc). 00286 // </synopsis> 00287 00288 class TableUnknownDesc : public TableError { 00289 public: 00290 // This constructor generates a message that the class with the 00291 // given name is unknown (not registered). 00292 TableUnknownDesc (const String& name,Category c=INITIALIZATION); 00293 ~TableUnknownDesc () throw(); 00294 }; 00295 00296 00297 // <summary> 00298 // Table error; invalid data type 00299 // </summary> 00300 // <use visibility=export> 00301 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00302 // </reviewed> 00303 00304 // <synopsis> 00305 // Checking of the data type of a column is done at runtime. 00306 // This error results from non-matching data types when constructing 00307 // a ScalarColumn or ArrayColumn or from invalid data type promotions 00308 // when doing a get or put. 00309 // </synopsis> 00310 00311 class TableInvDT : public TableError { 00312 public: 00313 // The default constructor generates a generic "invalid data type" message. 00314 TableInvDT (Category c=CONFORMANCE); 00315 // Put the name of the offending column in the "invalid data type" message. 00316 TableInvDT (const String& columName,Category c=CONFORMANCE); 00317 ~TableInvDT () throw(); 00318 }; 00319 00320 00321 // <summary> 00322 // Table error; invalid operation 00323 // </summary> 00324 // <use visibility=export> 00325 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00326 // </reviewed> 00327 00328 // <synopsis> 00329 // Invalid operation on a table. 00330 // A request was done that could not be handled by the table system 00331 // (e.g. sorting on a column containing arrays). 00332 // The message tells what is wrong. 00333 // </synopsis> 00334 00335 // Invalid operation on a table. 00336 class TableInvOper : public TableError { 00337 public: 00338 // The default constructor generates a generic "invalid operation" message. 00339 TableInvOper (Category c=INVALID_ARGUMENT); 00340 // Add given message to string "Invalid Table operation: ". 00341 TableInvOper (const String& message,Category c=INVALID_ARGUMENT); 00342 ~TableInvOper () throw(); 00343 }; 00344 00345 00346 // <summary> 00347 // Table error; non-conformant array 00348 // </summary> 00349 // <use visibility=export> 00350 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00351 // </reviewed> 00352 00353 // <synopsis> 00354 // When putting a direct array, the shape of the array must conform 00355 // the shape as defined for the table array. 00356 // When getting an array, the receiving array must be zero-length 00357 // or it must conform the shape of the table array. 00358 // </synopsis> 00359 00360 class TableArrayConformanceError : public TableError { 00361 public: 00362 // This constructor appends ": Table array conformance error" 00363 // to the given message. 00364 TableArrayConformanceError (const String& message,Category c=CONFORMANCE); 00365 ~TableArrayConformanceError () throw(); 00366 }; 00367 00368 00369 // <summary> 00370 // Table error; table length conformance error 00371 // </summary> 00372 // <use visibility=export> 00373 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00374 // </reviewed> 00375 00376 // <synopsis> 00377 // When putting a column, the length of the vector must match the 00378 // length of the table (i.e. its number of rows). 00379 // When getting a column, the length of the vector must be zero or 00380 // it must match the length of the table. 00381 // </synopsis> 00382 00383 class TableConformanceError : public TableError { 00384 public: 00385 // This constructor appends ": Table conformance error (#rows mismatch)" 00386 // to the given message. 00387 TableConformanceError (const String& message,Category c=CONFORMANCE); 00388 ~TableConformanceError () throw(); 00389 }; 00390 00391 00392 // <summary> 00393 // Table error; invalid sort 00394 // </summary> 00395 // <use visibility=export> 00396 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00397 // </reviewed> 00398 00399 // <synopsis> 00400 // Invalid sort operation on a table. 00401 // A sort can only be done on a scalar column. 00402 // </synopsis> 00403 00404 class TableInvSort : public TableError { 00405 public: 00406 // The default constructor generates a generic "invalid sort" message. 00407 TableInvSort (Category c=INVALID_ARGUMENT); 00408 // This constructor appends the given message to the "invalid sort" 00409 // message. 00410 TableInvSort (const String& message,Category c=INVALID_ARGUMENT); 00411 ~TableInvSort () throw(); 00412 }; 00413 00414 00415 // <summary> 00416 // Table error; invalid logical operation 00417 // </summary> 00418 // <use visibility=export> 00419 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00420 // </reviewed> 00421 00422 // <synopsis> 00423 // Invalid logical table operation. 00424 // When combining tables using a union, difference, etc., the 00425 // tables involved have to stem from the same root. I.e. they 00426 // should all refer to the same underlying table. 00427 // </synopsis> 00428 00429 class TableInvLogic : public TableError { 00430 public: 00431 // The default constructor generates the message. 00432 TableInvLogic (Category c=INVALID_ARGUMENT); 00433 ~TableInvLogic () throw(); 00434 }; 00435 00436 00437 // <summary> 00438 // Table error; invalid select expression 00439 // </summary> 00440 // <use visibility=export> 00441 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00442 // </reviewed> 00443 00444 // <synopsis> 00445 // Invalid table select expression. 00446 // A column is not a scalar or belongs to another table than 00447 // the table on which the selection will be done. 00448 // </synopsis> 00449 00450 class TableInvExpr : public TableError { 00451 public: 00452 TableInvExpr (const String& message,Category c=INVALID_ARGUMENT); 00453 // This constructor generates a message containing the name of 00454 // the offending column. It appends the given message. 00455 TableInvExpr (const String& columnName, const String& message,Category c=INVALID_ARGUMENT); 00456 ~TableInvExpr () throw(); 00457 }; 00458 00459 00460 // <summary> 00461 // Table error; non-conformant table vectors 00462 // </summary> 00463 // <use visibility=export> 00464 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00465 // </reviewed> 00466 00467 // <synopsis> 00468 // Table vectors are not conformant (have different lengths) 00469 // </synopsis> 00470 00471 class TableVectorNonConform : public TableError { 00472 public: 00473 // The default constructor generates the message. 00474 TableVectorNonConform (Category c=CONFORMANCE); 00475 ~TableVectorNonConform () throw(); 00476 }; 00477 00478 00479 // <summary> 00480 // Table error; invalid table command 00481 // </summary> 00482 // <use visibility=export> 00483 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests=""> 00484 // </reviewed> 00485 00486 // <synopsis> 00487 // The parser in TableGram/TableParse found an error in 00488 // the given table command. 00489 // </synopsis> 00490 00491 class TableParseError : public TableError { 00492 public: 00493 // This constructor generates a message containing the table command. 00494 TableParseError (const String& commandString,Category c=INVALID_ARGUMENT); 00495 ~TableParseError () throw(); 00496 }; 00497 00498 00499 00500 } //# NAMESPACE CASA - END 00501 00502 #endif