HDataBase.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*****************************************************************************
  2. * HDataBase.h
  3. *****************************************************************************
  4. *
  5. * Project: HALCON/C++
  6. * Description: Base class for all iconic objects
  7. *
  8. * (c) 2010-2020 by MVTec Software GmbH
  9. * www.mvtec.com
  10. *
  11. *****************************************************************************
  12. *
  13. *
  14. *****************************************************************************/
  15. #ifndef HCPP_DATA_BASE_H
  16. #define HCPP_DATA_BASE_H
  17. namespace HalconCpp
  18. {
  19. class LIntExport HDataBase
  20. {
  21. public:
  22. // Create an uninitialized data object
  23. HDataBase();
  24. // Create data object from tuple data
  25. HDataBase(const HTuple& data);
  26. // Copy constructor
  27. HDataBase(const HDataBase& data);
  28. // Assignment
  29. HDataBase& operator = (const HDataBase& data);
  30. HDataBase& operator = (const HTuple& data);
  31. // Cast
  32. operator HTuple() const;
  33. // Set data from tuple
  34. void SetFromTuple(const HTuple& data);
  35. // Get data as tuple
  36. HTuple ConvertToTuple() const;
  37. void Clear();
  38. protected:
  39. HTuple mData;
  40. };
  41. class LIntExport HDataArray
  42. {
  43. public:
  44. // Create empty tool array for use as output parameter
  45. HDataArray();
  46. virtual ~HDataArray();
  47. // Assignment
  48. HDataArray& operator = (const HDataArray& data_array);
  49. HDataBase* Data();
  50. const HDataBase* Data() const;
  51. Hlong Length() const;
  52. void Clear();
  53. // Create data class array from splittable tuple
  54. void SetFromTuple(const HTuple& concatenated);
  55. // Get concatenated data tuple for data array
  56. HTuple ConvertToTuple() const;
  57. protected:
  58. void InitFromArray(HDataBase* data, Hlong length);
  59. virtual void CreateArray(Hlong length) = 0;
  60. virtual int GetFixedSize() const = 0;
  61. HDataBase* mArray;
  62. Hlong mLength;
  63. };
  64. }
  65. #endif