HdfObject.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. #include <hdf4cpp/HdfDestroyer.h>
  9. namespace hdf4cpp {
  10. class HdfObject {
  11. public:
  12. virtual Type getType() const { return type; }
  13. virtual ClassType getClassType() const { return classType; }
  14. protected:
  15. HdfObject(const Type& type, const ClassType& classType, const HdfDestroyerChain& chain = HdfDestroyerChain()) : type(type),
  16. classType(classType),
  17. chain(chain) {}
  18. HdfObject(const HdfObject *object) : type(object->getType()), classType(object->getClassType()), chain(object->chain) {}
  19. virtual void setType(const Type& type) { this->type = type; }
  20. virtual void setClassType(const ClassType& classType) { this->classType = classType; }
  21. virtual void raiseException(const ExceptionType& exceptionType) const {
  22. throw HdfException(type, classType, exceptionType);
  23. }
  24. virtual void raiseException(const std::string& message) const {
  25. throw HdfException(type, classType, message);
  26. }
  27. private:
  28. Type type;
  29. ClassType classType;
  30. protected:
  31. HdfDestroyerChain chain;
  32. };
  33. }
  34. #endif //GRASP_SEGMENTER_HDFOBJECT_H