HdfException.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /// \copyright Copyright (c) Catalysts GmbH
  2. /// \author Patrik Kovacs, Catalysts GmbH
  3. #include <hdf4cpp/HdfException.h>
  4. const std::string hdf4cpp::HdfException::exceptionMessagePrefix = "HDF4CPP: ";
  5. const std::map<hdf4cpp::ExceptionType, std::string> hdf4cpp::HdfException::exceptionTypeMap = {
  6. {INVALID_ID, "cannot construct object, the id is invalid"},
  7. {INVALID_OPERATION, "operation not supported for this type"},
  8. {INVALID_NAME, "invalid item name"},
  9. {OUT_OF_RANGE, "out of range, cannot access element (usually thrown when an iterator points to an inaccessible address)"},
  10. {BUFFER_SIZE_NOT_ENOUGH, "not enough buffer size (usually thrown when the type of the vector in which we read the data is too small)"},
  11. {BUFFER_SIZE_NOT_DIVISIBLE, "buffer cannot be splited up (usually thrown when the size of the readable data is not divisible by the type size of the vector"},
  12. {INVALID_RANGES, "the given ranges are invalids (usually thrown when the ranges is negative or it is bigger than the dimension of tha data)"},
  13. {STATUS_RETURN_FAIL, "hdf routine failed"},
  14. {INVALID_DATA_TYPE, "the type of the data in the hdf item is not supported"},
  15. {OTHER, "exception thrown"},
  16. };
  17. hdf4cpp::Type hdf4cpp::HdfException::getType() const noexcept {
  18. return type;
  19. }
  20. hdf4cpp::ClassType hdf4cpp::HdfException::getClassType() const noexcept {
  21. return classType;
  22. }
  23. hdf4cpp::ExceptionType hdf4cpp::HdfException::getExceptionType() const noexcept {
  24. return exceptionType;
  25. }
  26. std::string hdf4cpp::HdfException::getMessage() const noexcept {
  27. return message;
  28. }