HHandle.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /***********************************************************
  2. * File generated by the HALCON-Compiler hcomp version 20.11
  3. * Usage: Interface to C++
  4. *
  5. * Software by: MVTec Software GmbH, www.mvtec.com
  6. ***********************************************************/
  7. #ifndef HCPP_HHANDLE
  8. #define HCPP_HHANDLE
  9. namespace HalconCpp
  10. {
  11. // Represents a generic instance of a handle.
  12. class LIntExport HHandle : public HHandleBase
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HHandle():HHandleBase() {}
  17. // Copy constructor
  18. HHandle(const HHandle& source) : HHandleBase(source) {}
  19. friend class HTupleElement;
  20. // Create HHandle from handle, taking ownership
  21. explicit HHandle(Hlong handle);
  22. bool operator==(const HHandle& obj) const
  23. {
  24. return HHandleBase::operator==(obj);
  25. }
  26. bool operator!=(const HHandle& obj) const
  27. {
  28. return HHandleBase::operator!=(obj);
  29. }
  30. protected:
  31. // Internal Hphandle constructor
  32. HHandle(const Hphandle handle, bool copy): HHandleBase(handle,copy) {}
  33. // Verify matching semantic type ('handle')!
  34. virtual void AssertType(Hphandle handle) const;
  35. public:
  36. // Deep copy of all data represented by this object instance
  37. HHandle Clone() const;
  38. /***************************************************************************
  39. * Operators *
  40. ***************************************************************************/
  41. // Clear the content of a handle.
  42. void ClearHandle() const;
  43. // Deserialize a serialized item.
  44. void DeserializeHandle(const HSerializedItem& SerializedItem);
  45. // Serialize the content of a handle.
  46. HSerializedItem SerializeHandle() const;
  47. // Test if a tuple is serializable.
  48. Hlong TupleIsSerializable() const;
  49. // Check if a handle is valid.
  50. HTuple TupleIsValidHandle() const;
  51. // Return the semantic type of a tuple.
  52. HString TupleSemType() const;
  53. };
  54. #if defined(HCPP_LEGACY_HANDLE_API)
  55. typedef HHandle HToolBase;
  56. #endif
  57. // forward declarations and types for internal array implementation
  58. template<class T> class HSmartPtr;
  59. template<class T> class HHandleBaseArrayRef;
  60. typedef HHandleBaseArrayRef<HHandle> HHandleArrayRef;
  61. typedef HSmartPtr< HHandleArrayRef > HHandleArrayPtr;
  62. // Represents multiple tool instances
  63. class LIntExport HHandleArray : public HHandleBaseArray
  64. {
  65. public:
  66. // Create empty array
  67. HHandleArray();
  68. // Create array from native array of tool instances
  69. HHandleArray(HHandle* classes, Hlong length);
  70. // Copy constructor
  71. HHandleArray(const HHandleArray &tool_array);
  72. // Destructor
  73. virtual ~HHandleArray();
  74. // Assignment operator
  75. HHandleArray &operator=(const HHandleArray &tool_array);
  76. // Clears array and all tool instances
  77. virtual void Clear();
  78. // Get array of native tool instances
  79. const HHandle* Tools() const;
  80. // Get number of tools
  81. virtual Hlong Length() const;
  82. // Create tool array from tuple of handles
  83. virtual void SetFromTuple(const HTuple& handles);
  84. // Get tuple of handles for tool array
  85. virtual HTuple ConvertToTuple() const;
  86. protected:
  87. // Smart pointer to internal data container
  88. HHandleArrayPtr *mArrayPtr;
  89. };
  90. }
  91. #endif