HIODevice.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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_HIODEVICE
  8. #define HCPP_HIODEVICE
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of an I/O device.
  12. class LIntExport HIODevice : public HHandle
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HIODevice():HHandle() {}
  17. // Copy constructor
  18. HIODevice(const HIODevice& source) : HHandle(source) {}
  19. // Copy constructor
  20. HIODevice(const HHandle& handle);
  21. // Create HIODevice from handle, taking ownership
  22. explicit HIODevice(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_device')!
  33. virtual void AssertType(Hphandle handle) const;
  34. public:
  35. /*****************************************************************************
  36. * Operator-based class constructors
  37. *****************************************************************************/
  38. // open_io_device: Open and configure an I/O device.
  39. explicit HIODevice(const HString& IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue);
  40. // open_io_device: Open and configure an I/O device.
  41. explicit HIODevice(const char* IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue);
  42. #ifdef _WIN32
  43. // open_io_device: Open and configure an I/O device.
  44. explicit HIODevice(const wchar_t* IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue);
  45. #endif
  46. /***************************************************************************
  47. * Operators *
  48. ***************************************************************************/
  49. // Open and configure I/O channels.
  50. HIOChannelArray OpenIoChannel(const HTuple& IOChannelName, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  51. // Open and configure I/O channels.
  52. HIOChannel OpenIoChannel(const HString& IOChannelName, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  53. // Open and configure I/O channels.
  54. HIOChannel OpenIoChannel(const char* IOChannelName, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  55. #ifdef _WIN32
  56. // Open and configure I/O channels.
  57. HIOChannel OpenIoChannel(const wchar_t* IOChannelName, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  58. #endif
  59. // Query information about channels of the specified I/O device.
  60. HTuple QueryIoDevice(const HTuple& IOChannelName, const HTuple& Query) const;
  61. // Query information about channels of the specified I/O device.
  62. HTuple QueryIoDevice(const HString& IOChannelName, const HTuple& Query) const;
  63. // Query information about channels of the specified I/O device.
  64. HTuple QueryIoDevice(const char* IOChannelName, const HTuple& Query) const;
  65. #ifdef _WIN32
  66. // Query information about channels of the specified I/O device.
  67. HTuple QueryIoDevice(const wchar_t* IOChannelName, const HTuple& Query) const;
  68. #endif
  69. // Perform an action on the I/O device.
  70. HTuple ControlIoDevice(const HString& Action, const HTuple& Argument) const;
  71. // Perform an action on the I/O device.
  72. HTuple ControlIoDevice(const HString& Action, const HString& Argument) const;
  73. // Perform an action on the I/O device.
  74. HTuple ControlIoDevice(const char* Action, const char* Argument) const;
  75. #ifdef _WIN32
  76. // Perform an action on the I/O device.
  77. HTuple ControlIoDevice(const wchar_t* Action, const wchar_t* Argument) const;
  78. #endif
  79. // Configure a specific I/O device instance.
  80. void SetIoDeviceParam(const HTuple& GenParamName, const HTuple& GenParamValue) const;
  81. // Configure a specific I/O device instance.
  82. void SetIoDeviceParam(const HString& GenParamName, const HString& GenParamValue) const;
  83. // Configure a specific I/O device instance.
  84. void SetIoDeviceParam(const char* GenParamName, const char* GenParamValue) const;
  85. #ifdef _WIN32
  86. // Configure a specific I/O device instance.
  87. void SetIoDeviceParam(const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  88. #endif
  89. // Query settings of an I/O device instance.
  90. HTuple GetIoDeviceParam(const HTuple& GenParamName) const;
  91. // Query settings of an I/O device instance.
  92. HTuple GetIoDeviceParam(const HString& GenParamName) const;
  93. // Query settings of an I/O device instance.
  94. HTuple GetIoDeviceParam(const char* GenParamName) const;
  95. #ifdef _WIN32
  96. // Query settings of an I/O device instance.
  97. HTuple GetIoDeviceParam(const wchar_t* GenParamName) const;
  98. #endif
  99. // Close the specified I/O device.
  100. void CloseIoDevice() const;
  101. // Open and configure an I/O device.
  102. void OpenIoDevice(const HString& IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue);
  103. // Open and configure an I/O device.
  104. void OpenIoDevice(const char* IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue);
  105. #ifdef _WIN32
  106. // Open and configure an I/O device.
  107. void OpenIoDevice(const wchar_t* IOInterfaceName, const HTuple& IODeviceName, const HTuple& GenParamName, const HTuple& GenParamValue);
  108. #endif
  109. // Perform an action on the I/O interface.
  110. static HTuple ControlIoInterface(const HString& IOInterfaceName, const HString& Action, const HTuple& Argument);
  111. // Perform an action on the I/O interface.
  112. static HTuple ControlIoInterface(const HString& IOInterfaceName, const HString& Action, const HString& Argument);
  113. // Perform an action on the I/O interface.
  114. static HTuple ControlIoInterface(const char* IOInterfaceName, const char* Action, const char* Argument);
  115. #ifdef _WIN32
  116. // Perform an action on the I/O interface.
  117. static HTuple ControlIoInterface(const wchar_t* IOInterfaceName, const wchar_t* Action, const wchar_t* Argument);
  118. #endif
  119. // Query information about the specified I/O device interface.
  120. static HTuple QueryIoInterface(const HString& IOInterfaceName, const HTuple& Query);
  121. // Query information about the specified I/O device interface.
  122. static HTuple QueryIoInterface(const HString& IOInterfaceName, const HString& Query);
  123. // Query information about the specified I/O device interface.
  124. static HTuple QueryIoInterface(const char* IOInterfaceName, const char* Query);
  125. #ifdef _WIN32
  126. // Query information about the specified I/O device interface.
  127. static HTuple QueryIoInterface(const wchar_t* IOInterfaceName, const wchar_t* Query);
  128. #endif
  129. };
  130. // forward declarations and types for internal array implementation
  131. template<class T> class HSmartPtr;
  132. template<class T> class HHandleBaseArrayRef;
  133. typedef HHandleBaseArrayRef<HIODevice> HIODeviceArrayRef;
  134. typedef HSmartPtr< HIODeviceArrayRef > HIODeviceArrayPtr;
  135. // Represents multiple tool instances
  136. class LIntExport HIODeviceArray : public HHandleBaseArray
  137. {
  138. public:
  139. // Create empty array
  140. HIODeviceArray();
  141. // Create array from native array of tool instances
  142. HIODeviceArray(HIODevice* classes, Hlong length);
  143. // Copy constructor
  144. HIODeviceArray(const HIODeviceArray &tool_array);
  145. // Destructor
  146. virtual ~HIODeviceArray();
  147. // Assignment operator
  148. HIODeviceArray &operator=(const HIODeviceArray &tool_array);
  149. // Clears array and all tool instances
  150. virtual void Clear();
  151. // Get array of native tool instances
  152. const HIODevice* Tools() const;
  153. // Get number of tools
  154. virtual Hlong Length() const;
  155. // Create tool array from tuple of handles
  156. virtual void SetFromTuple(const HTuple& handles);
  157. // Get tuple of handles for tool array
  158. virtual HTuple ConvertToTuple() const;
  159. protected:
  160. // Smart pointer to internal data container
  161. HIODeviceArrayPtr *mArrayPtr;
  162. };
  163. }
  164. #endif