HdfException.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // Created by patrik on 22.08.17.
  3. //
  4. #include <hdf4cpp/HdfException.h>
  5. const std::string hdf4cpp::HdfException::exceptionMessagePrefix = "HDF4CPP: ";
  6. const std::map<hdf4cpp::ExceptionType, std::string> hdf4cpp::HdfException::exceptionTypeMap = {
  7. {INVALID_ID, "cannot construct object, the id is invalid"},
  8. {INVALID_OPERATION, "operation not supported for this type"},
  9. {INVALID_NAME, "invalid item name"},
  10. {OUT_OF_RANGE, "out of range, cannot access element (usually thrown when an iterator points to an inaccessible address)"},
  11. {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)"},
  12. {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"},
  13. {INVALID_RANGES, "the given ranges are invalids (usually thrown when the ranges is negative or it is bigger than the dimension of tha data)"},
  14. {STATUS_RETURN_FAIL, "hdf routine failed"},
  15. {INVALID_DATA_TYPE, "the type of the data in the hdf item is not supported"},
  16. {OTHER, "exception thrown"},
  17. };
  18. hdf4cpp::Type hdf4cpp::HdfException::getType() const noexcept {
  19. return type;
  20. }
  21. hdf4cpp::ClassType hdf4cpp::HdfException::getClassType() const noexcept {
  22. return classType;
  23. }
  24. hdf4cpp::ExceptionType hdf4cpp::HdfException::getExceptionType() const noexcept {
  25. return exceptionType;
  26. }
  27. std::string hdf4cpp::HdfException::getMessage() const noexcept {
  28. return message;
  29. }