/usr/include/ncException.h is in libnetcdf-c++4-dev 4.2.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | #include <exception>
#include <string>
#include <iostream>
#ifndef NcExceptionClasses
#define NcExceptionClasses
namespace netCDF
{
//! Exception classes.
/*!
These exceptions are thrown if the netCDF-4 API encounters an error.
*/
namespace exceptions
{
/*!
Base object is thrown if a netCDF exception is encountered.
An unsatisfactory return from a call to one of the netCDF C-routines
generates an exception using an object inheriting this class. All other netCDF-related
errors including those originating in the C++ binding, generates an NcException.
*/
class NcException : public std::exception {
public:
NcException(const std::string& exceptionName,const std::string& complaint,const char* fileName,int lineNumber);
virtual ~NcException() throw();
const char* what() const throw();
private:
std::string exceptionName, complaint, fileName;
int lineNumber;
};
/*! Thrown if the specified netCDF ID does not refer to an open netCDF dataset. */
class NcBadId : public NcException
{
public:
NcBadId(const std::string& complaint,const char* file,int line);
};
/*! Thrown if too many netcdf files are open. */
class NcNFile : public NcException
{
public:
NcNFile(const std::string& complaint,const char* file,int line);
};
/*! Thrown if, having set NC_NOCLOBBER, the specified dataset already exists. */
class NcExist : public NcException
{
public:
NcExist(const std::string& complaint,const char* file,int line);
};
/*! Thrown if not a netCDF id. */
class NcInvalidArg : public NcException
{
public:
NcInvalidArg(const std::string& complaint,const char* file,int line);
};
/*! Thrown if invalid argument. */
class NcInvalidWrite : public NcException
{
public:
NcInvalidWrite(const std::string& complaint,const char* file,int line);
};
/*! Thrown if operation not allowed in data mode. */
class NcNotInDefineMode : public NcException
{
public:
NcNotInDefineMode(const std::string& complaint,const char* file,int line);
};
/*! Thrown if operation not allowed in defined mode. */
class NcInDefineMode : public NcException
{
public:
NcInDefineMode(const std::string& complaint,const char* file,int line);
};
/*!
Index exceeds dimension bound.
Exception may be generated during operations to get or put netCDF variable data.
The exception is thrown if the specified indices were out of range for the rank of the
specified variable. For example, a negative index or an index that is larger than
the corresponding dimension length will cause an error.
*/
class NcInvalidCoords : public NcException
{
public:
NcInvalidCoords(const std::string& complaint,const char* file,int line);
};
/*! Thrown if NC_MAX_DIMS is exceeded. */
class NcMaxDims : public NcException
{
public:
NcMaxDims(const std::string& complaint,const char* file,int line);
};
/*! Thrown if string match to name is in use. */
class NcNameInUse : public NcException
{
public:
NcNameInUse(const std::string& complaint,const char* file,int line);
};
/*! Thrown if attribute is not found. */
class NcNotAtt : public NcException
{
public:
NcNotAtt(const std::string& complaint,const char* file,int line);
};
/*! Thrown if Nc_MAX_ATTRS is exceeded. */
class NcMaxAtts : public NcException
{
public:
NcMaxAtts(const std::string& complaint,const char* file,int line);
};
/*! Thrown if not a valid netCDF data type. */
class NcBadType : public NcException
{
public:
NcBadType(const std::string& complaint,const char* file,int line);
};
/*! Thrown if an invalid dimension id or name. */
class NcBadDim : public NcException
{
public:
NcBadDim(const std::string& complaint,const char* file,int line);
};
/*! Thrown if Nc_UNLIMITED is in the wrong index. */
class NcUnlimPos : public NcException
{
public:
NcUnlimPos(const std::string& complaint,const char* file,int line);
};
/*! Thrown if NC_MAX_VARS is exceeded. */
class NcMaxVars : public NcException
{
public:
NcMaxVars(const std::string& complaint,const char* file,int line);
};
/*! Thrown if variable is not found. */
class NcNotVar : public NcException
{
public:
NcNotVar(const std::string& complaint,const char* file,int line);
};
/*! Thrown if the action is prohibited on the NC_GLOBAL varid. */
class NcGlobal : public NcException
{
public:
NcGlobal(const std::string& complaint,const char* file,int line);
};
/*! Thrown if not a netCDF file. */
class NcNotNCF : public NcException
{
public:
NcNotNCF(const std::string& complaint,const char* file,int line);
};
/*! Thrown if in FORTRAN, string is too short. */
class NcSts : public NcException
{
public:
NcSts(const std::string& complaint,const char* file,int line);
};
/*! Thrown if NC_MAX_NAME is exceeded. */
class NcMaxName : public NcException
{
public:
NcMaxName(const std::string& complaint,const char* file,int line);
};
/*! Thrown if NC_UNLIMITED size is already in use. */
class NcUnlimit : public NcException
{
public:
NcUnlimit(const std::string& complaint,const char* file,int line);
};
/*! Thrown if nc_rec op when there are no record vars. */
class NcNoRecVars : public NcException
{
public:
NcNoRecVars(const std::string& complaint,const char* file,int line);
};
/*! Thrown if attempt to convert between text and numbers. */
class NcChar : public NcException
{
public:
NcChar(const std::string& complaint,const char* file,int line);
};
/*! Thrown if edge+start exceeds dimension bound. */
class NcEdge : public NcException
{
public:
NcEdge(const std::string& complaint,const char* file,int line);
};
/*! Thrown if illegal stride. */
class NcStride : public NcException
{
public:
NcStride(const std::string& complaint,const char* file,int line);
};
/*! Thrown if attribute or variable name contains illegal characters. */
class NcBadName : public NcException
{
public:
NcBadName(const std::string& complaint,const char* file,int line);
};
/*! Thrown if math result not representable. */
class NcRange : public NcException
{
public:
NcRange(const std::string& complaint,const char* file,int line);
};
/*! Thrown if memory allocation (malloc) failure. */
class NcNoMem : public NcException
{
public:
NcNoMem(const std::string& complaint,const char* file,int line);
};
/*! Thrown if one or more variable sizes violate format constraints */
class NcVarSize : public NcException
{
public:
NcVarSize(const std::string& complaint,const char* file,int line);
};
/*! Thrown if invalid dimension size. */
class NcDimSize : public NcException
{
public:
NcDimSize(const std::string& complaint,const char* file,int line);
};
/*! Thrown if file likely truncated or possibly corrupted. */
class NcTrunc : public NcException
{
public:
NcTrunc(const std::string& complaint,const char* file,int line);
};
/*! Thrown if an error was reported by the HDF5 layer. */
class NcHdfErr : public NcException
{
public:
NcHdfErr(const std::string& complaint,const char* file,int line);
};
/*! Thrown if cannot read. */
class NcCantRead : public NcException
{
public:
NcCantRead(const std::string& complaint,const char* file,int line);
};
/*! Thrown if cannot write. */
class NcCantWrite : public NcException
{
public:
NcCantWrite(const std::string& complaint,const char* file,int line);
};
/*! Thrown if cannot create. */
class NcCantCreate : public NcException
{
public:
NcCantCreate(const std::string& complaint,const char* file,int line);
};
/*! Thrown if file meta. */
class NcFileMeta : public NcException
{
public:
NcFileMeta(const std::string& complaint,const char* file,int line);
};
/*! Thrown if dim meta. */
class NcDimMeta : public NcException
{
public:
NcDimMeta(const std::string& complaint,const char* file,int line);
};
/*! Thrown if attribute meta. */
class NcAttMeta : public NcException
{
public:
NcAttMeta(const std::string& complaint,const char* file,int line);
};
/*! Thrown if variable meta. */
class NcVarMeta : public NcException
{
public:
NcVarMeta(const std::string& complaint,const char* file,int line);
};
/*! Thrown if no compound. */
class NcNoCompound : public NcException
{
public:
NcNoCompound(const std::string& complaint,const char* file,int line);
};
/*! Thrown if attribute exists. */
class NcAttExists : public NcException
{
public:
NcAttExists(const std::string& complaint,const char* file,int line);
};
/*! Thrown if attempting netcdf-4 operation on netcdf-3 file. */
class NcNotNc4 : public NcException
{
public:
NcNotNc4(const std::string& complaint,const char* file,int line);
};
/*! Thrown if attempting netcdf-4 operation on strict nc3 netcdf-4 file. */
class NcStrictNc3 : public NcException
{
public:
NcStrictNc3(const std::string& complaint,const char* file,int line);
};
/*! Thrown if bad group id. */
class NcBadGroupId : public NcException
{
public:
NcBadGroupId(const std::string& complaint,const char* file,int line);
};
/*! Thrown if bad type id. */
class NcBadTypeId : public NcException
{
public:
NcBadTypeId(const std::string& complaint,const char* file,int line);
};
/*! Thrown if bad field id. */
class NcBadFieldId : public NcException
{
public:
NcBadFieldId(const std::string& complaint,const char* file,int line);
};
/*! Thrown if cannot find the field id. */
class NcUnknownName : public NcException
{
public:
NcUnknownName(const std::string& complaint,const char* file,int line);
};
/*! Thrown if cannot return a netCDF group. */
class NcEnoGrp : public NcException
{
public:
NcEnoGrp(const std::string& complaint,const char* file,int line);
};
/*!
Thrown if the requested operation is on a NULL group.
This exception is thrown if an operation on a NcGroup object is requested which is empty. To test if the object is empty used NcGroup::isNull()
*/
class NcNullGrp : public NcException
{
public:
NcNullGrp(const std::string& complaint,const char* file,int line);
};
/*!
Thrown if the requested operation is on a NULL type.
This exception is thrown if an operation on a NcType object is requested which is empty. To test if the object is empty used NcType::isNull()
*/
class NcNullType : public NcException
{
public:
NcNullType(const std::string& complaint,const char* file,int line);
};
/*!
Thrown if the requested operation is on a NULL dimension.
This exception is thrown if an operation on a NcDim object is requested which is empty. To test if the object is empty used NcDim::isNull()
*/
class NcNullDim : public NcException
{
public:
NcNullDim(const std::string& complaint,const char* file,int line);
};
/*!
Thrown if an operation to set the chunking, endianness, fill of a NcVar object is issued after a
call to NcVar::getVar or NcVar::putVar has been made.
*/
class NcElateDef : public NcException
{
public:
NcElateDef(const std::string& complaint,const char* file,int line);
};
}
}
#endif
|