HMutex.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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_HMUTEX
  8. #define HCPP_HMUTEX
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of a mutex synchronization object.
  12. class LIntExport HMutex : public HHandle
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HMutex():HHandle() {}
  17. // Copy constructor
  18. HMutex(const HMutex& source) : HHandle(source) {}
  19. // Copy constructor
  20. HMutex(const HHandle& handle);
  21. // Create HMutex from handle, taking ownership
  22. explicit HMutex(Hlong handle);
  23. bool operator==(const HHandle& obj) const
  24. {
  25. return HHandleBase::operator==(obj);
  26. }
  27. bool operator!=(const HHandle& obj) const
  28. {
  29. return HHandleBase::operator!=(obj);
  30. }
  31. protected:
  32. // Verify matching semantic type ('mutex')!
  33. virtual void AssertType(Hphandle handle) const;
  34. public:
  35. /*****************************************************************************
  36. * Operator-based class constructors
  37. *****************************************************************************/
  38. // create_mutex: Create a mutual exclusion synchronization object.
  39. explicit HMutex(const HTuple& AttribName, const HTuple& AttribValue);
  40. // create_mutex: Create a mutual exclusion synchronization object.
  41. explicit HMutex(const HString& AttribName, const HString& AttribValue);
  42. // create_mutex: Create a mutual exclusion synchronization object.
  43. explicit HMutex(const char* AttribName, const char* AttribValue);
  44. #ifdef _WIN32
  45. // create_mutex: Create a mutual exclusion synchronization object.
  46. explicit HMutex(const wchar_t* AttribName, const wchar_t* AttribValue);
  47. #endif
  48. /***************************************************************************
  49. * Operators *
  50. ***************************************************************************/
  51. // Clear the mutex synchronization object.
  52. void ClearMutex() const;
  53. // Unlock a mutex synchronization object.
  54. void UnlockMutex() const;
  55. // Lock a mutex synchronization object.
  56. Hlong TryLockMutex() const;
  57. // Lock a mutex synchronization object.
  58. void LockMutex() const;
  59. // Create a mutual exclusion synchronization object.
  60. void CreateMutex(const HTuple& AttribName, const HTuple& AttribValue);
  61. // Create a mutual exclusion synchronization object.
  62. void CreateMutex(const HString& AttribName, const HString& AttribValue);
  63. // Create a mutual exclusion synchronization object.
  64. void CreateMutex(const char* AttribName, const char* AttribValue);
  65. #ifdef _WIN32
  66. // Create a mutual exclusion synchronization object.
  67. void CreateMutex(const wchar_t* AttribName, const wchar_t* AttribValue);
  68. #endif
  69. };
  70. // forward declarations and types for internal array implementation
  71. template<class T> class HSmartPtr;
  72. template<class T> class HHandleBaseArrayRef;
  73. typedef HHandleBaseArrayRef<HMutex> HMutexArrayRef;
  74. typedef HSmartPtr< HMutexArrayRef > HMutexArrayPtr;
  75. // Represents multiple tool instances
  76. class LIntExport HMutexArray : public HHandleBaseArray
  77. {
  78. public:
  79. // Create empty array
  80. HMutexArray();
  81. // Create array from native array of tool instances
  82. HMutexArray(HMutex* classes, Hlong length);
  83. // Copy constructor
  84. HMutexArray(const HMutexArray &tool_array);
  85. // Destructor
  86. virtual ~HMutexArray();
  87. // Assignment operator
  88. HMutexArray &operator=(const HMutexArray &tool_array);
  89. // Clears array and all tool instances
  90. virtual void Clear();
  91. // Get array of native tool instances
  92. const HMutex* Tools() const;
  93. // Get number of tools
  94. virtual Hlong Length() const;
  95. // Create tool array from tuple of handles
  96. virtual void SetFromTuple(const HTuple& handles);
  97. // Get tuple of handles for tool array
  98. virtual HTuple ConvertToTuple() const;
  99. protected:
  100. // Smart pointer to internal data container
  101. HMutexArrayPtr *mArrayPtr;
  102. };
  103. }
  104. #endif