HIOChannel.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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_HIOCHANNEL
  8. #define HCPP_HIOCHANNEL
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of a channel of an I/O device.
  12. class LIntExport HIOChannel : public HHandle
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HIOChannel():HHandle() {}
  17. // Copy constructor
  18. HIOChannel(const HIOChannel& source) : HHandle(source) {}
  19. // Copy constructor
  20. HIOChannel(const HHandle& handle);
  21. // Create HIOChannel from handle, taking ownership
  22. explicit HIOChannel(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 ('io_channel')!
  33. virtual void AssertType(Hphandle handle) const;
  34. public:
  35. /*****************************************************************************
  36. * Operator-based class constructors
  37. *****************************************************************************/
  38. // open_io_channel: Open and configure I/O channels.
  39. explicit HIOChannel(const HIODevice& IODeviceHandle, const HString& IOChannelName, const HTuple& GenParamName, const HTuple& GenParamValue);
  40. // open_io_channel: Open and configure I/O channels.
  41. explicit HIOChannel(const HIODevice& IODeviceHandle, const char* IOChannelName, const HTuple& GenParamName, const HTuple& GenParamValue);
  42. #ifdef _WIN32
  43. // open_io_channel: Open and configure I/O channels.
  44. explicit HIOChannel(const HIODevice& IODeviceHandle, const wchar_t* IOChannelName, const HTuple& GenParamName, const HTuple& GenParamValue);
  45. #endif
  46. /***************************************************************************
  47. * Operators *
  48. ***************************************************************************/
  49. // Perform an action on I/O channels.
  50. static HTuple ControlIoChannel(const HIOChannelArray& IOChannelHandle, const HString& ParamAction, const HTuple& ParamArgument);
  51. // Perform an action on I/O channels.
  52. HTuple ControlIoChannel(const HString& ParamAction, const HTuple& ParamArgument) const;
  53. // Perform an action on I/O channels.
  54. HTuple ControlIoChannel(const char* ParamAction, const HTuple& ParamArgument) const;
  55. #ifdef _WIN32
  56. // Perform an action on I/O channels.
  57. HTuple ControlIoChannel(const wchar_t* ParamAction, const HTuple& ParamArgument) const;
  58. #endif
  59. // Write a value to the specified I/O channels.
  60. static HTuple WriteIoChannel(const HIOChannelArray& IOChannelHandle, const HTuple& Value);
  61. // Write a value to the specified I/O channels.
  62. HTuple WriteIoChannel(const HTuple& Value) const;
  63. // Read a value from the specified I/O channels.
  64. static HTuple ReadIoChannel(const HIOChannelArray& IOChannelHandle, HTuple* Status);
  65. // Read a value from the specified I/O channels.
  66. HTuple ReadIoChannel(HTuple* Status) const;
  67. // Set specific parameters of I/O channels.
  68. static void SetIoChannelParam(const HIOChannelArray& IOChannelHandle, const HTuple& GenParamName, const HTuple& GenParamValue);
  69. // Set specific parameters of I/O channels.
  70. void SetIoChannelParam(const HTuple& GenParamName, const HTuple& GenParamValue) const;
  71. // Query specific parameters of I/O channels.
  72. static HTuple GetIoChannelParam(const HIOChannelArray& IOChannelHandle, const HTuple& GenParamName);
  73. // Query specific parameters of I/O channels.
  74. HTuple GetIoChannelParam(const HString& GenParamName) const;
  75. // Query specific parameters of I/O channels.
  76. HTuple GetIoChannelParam(const char* GenParamName) const;
  77. #ifdef _WIN32
  78. // Query specific parameters of I/O channels.
  79. HTuple GetIoChannelParam(const wchar_t* GenParamName) const;
  80. #endif
  81. // Close I/O channels.
  82. static void CloseIoChannel(const HIOChannelArray& IOChannelHandle);
  83. // Close I/O channels.
  84. void CloseIoChannel() const;
  85. // Open and configure I/O channels.
  86. static HIOChannelArray OpenIoChannel(const HIODevice& IODeviceHandle, const HTuple& IOChannelName, const HTuple& GenParamName, const HTuple& GenParamValue);
  87. // Open and configure I/O channels.
  88. void OpenIoChannel(const HIODevice& IODeviceHandle, const HString& IOChannelName, const HTuple& GenParamName, const HTuple& GenParamValue);
  89. // Open and configure I/O channels.
  90. void OpenIoChannel(const HIODevice& IODeviceHandle, const char* IOChannelName, const HTuple& GenParamName, const HTuple& GenParamValue);
  91. #ifdef _WIN32
  92. // Open and configure I/O channels.
  93. void OpenIoChannel(const HIODevice& IODeviceHandle, const wchar_t* IOChannelName, const HTuple& GenParamName, const HTuple& GenParamValue);
  94. #endif
  95. };
  96. // forward declarations and types for internal array implementation
  97. template<class T> class HSmartPtr;
  98. template<class T> class HHandleBaseArrayRef;
  99. typedef HHandleBaseArrayRef<HIOChannel> HIOChannelArrayRef;
  100. typedef HSmartPtr< HIOChannelArrayRef > HIOChannelArrayPtr;
  101. // Represents multiple tool instances
  102. class LIntExport HIOChannelArray : public HHandleBaseArray
  103. {
  104. public:
  105. // Create empty array
  106. HIOChannelArray();
  107. // Create array from native array of tool instances
  108. HIOChannelArray(HIOChannel* classes, Hlong length);
  109. // Copy constructor
  110. HIOChannelArray(const HIOChannelArray &tool_array);
  111. // Destructor
  112. virtual ~HIOChannelArray();
  113. // Assignment operator
  114. HIOChannelArray &operator=(const HIOChannelArray &tool_array);
  115. // Clears array and all tool instances
  116. virtual void Clear();
  117. // Get array of native tool instances
  118. const HIOChannel* Tools() const;
  119. // Get number of tools
  120. virtual Hlong Length() const;
  121. // Create tool array from tuple of handles
  122. virtual void SetFromTuple(const HTuple& handles);
  123. // Get tuple of handles for tool array
  124. virtual HTuple ConvertToTuple() const;
  125. protected:
  126. // Smart pointer to internal data container
  127. HIOChannelArrayPtr *mArrayPtr;
  128. };
  129. }
  130. #endif