HdfObject.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // Created by patrik on 23.08.17.
  3. //
  4. #ifndef GRASP_SEGMENTER_HDFOBJECT_H
  5. #define GRASP_SEGMENTER_HDFOBJECT_H
  6. #include <hdf4cpp/HdfDefines.h>
  7. #include <hdf4cpp/HdfException.h>
  8. namespace hdf4cpp {
  9. class HdfObject {
  10. public:
  11. virtual Type getType() const { return type; }
  12. virtual ClassType getClassType() const { return classType; }
  13. protected:
  14. HdfObject(const Type& type, const ClassType& classType) : type(type),
  15. classType(classType) {}
  16. HdfObject(const HdfObject *object) : type(object->getType()), classType(object->getClassType()) {}
  17. virtual void setType(const Type& type) { this->type = type; }
  18. virtual void setClassType(const ClassType& classType) { this->classType = classType; }
  19. virtual void raiseException(const ExceptionType& exceptionType) const {
  20. throw HdfException(type, classType, exceptionType);
  21. }
  22. virtual void raiseException(const std::string& message) const {
  23. throw HdfException(type, classType, message);
  24. }
  25. private:
  26. Type type;
  27. ClassType classType;
  28. };
  29. }
  30. #endif //GRASP_SEGMENTER_HDFOBJECT_H