HalconCpp.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*****************************************************************************
  2. * HalconCpp.h
  3. *****************************************************************************
  4. *
  5. * Project: HALCON/C++
  6. * Description: Defines / types / extern declarations for HALCON/C++ interface
  7. *
  8. * (c) 2010-2022 by MVTec Software GmbH
  9. * www.mvtec.com
  10. *
  11. *****************************************************************************
  12. *
  13. *
  14. *****************************************************************************/
  15. #ifndef HALCON_CPP_H
  16. #define HALCON_CPP_H
  17. // Architecture limitations
  18. #if !defined(HCPP_NO_INT_OVERLOADS)
  19. # define HCPP_INT_OVERLOADS
  20. #endif
  21. #if !defined(HCPP_NO_USE_IOSTREAM)
  22. # define HCPP_USE_IOSTREAM
  23. #endif
  24. // HALCON library includes
  25. #include "Halcon.h"
  26. // interface version
  27. // do not define a number because it can be loaded in parallel to version 10
  28. #define HCPP_INTERFACE_VERSION_11
  29. // Standard C++ library includes
  30. #ifdef HCPP_USE_IOSTREAM
  31. # include <iostream>
  32. #endif
  33. // Resolve known macro name collisions
  34. #if defined(_WIN32)
  35. /* include windows.h here, as Halcon.h does not include it anymore */
  36. # define _WINSOCKAPI_ /* use winsock2 */
  37. # include <Windows.h>
  38. //
  39. // FindText, CopyFile, CreateMutex, CreateEvent, and DeleteFile are also
  40. // functions of the Windows API. There are defines on FindTextW, CopyFileW,
  41. // CreateMutexW, CreateEventW, and DeleteFileW if UNICODE is defined,
  42. // otherwise there are defines on FindTextA, CopyFileA, CreateMutexA,
  43. // CreateMutexA, and DeleteFileA. These defines are undefined here. If you
  44. // want to use the corresponding Windows API calls, you must use FindTextA,
  45. // FindTextW, CopyFileA, CopyFileW, CreateMutexA, CreateMutexW, CreateEventA,
  46. // CreateEventW, DeleteFileA, or DeleteFileW directly.
  47. //
  48. # undef CopyFile
  49. # undef CreateMutex
  50. # undef CreateEvent
  51. # undef DeleteFile
  52. # undef FindText
  53. #endif
  54. // Macro to deprecate a method
  55. #if !defined(HC_NO_LEGACY_WARNING)
  56. # if defined(__GNUC__) && (((__GNUC__ * 100 + __GNUC_MINOR__) < 405) || \
  57. defined(__INTEL_COMPILER))
  58. # define HDEPRECATED(OBJ, MSG) OBJ __attribute__((deprecated))
  59. # elif defined(__GNUC__) || defined(__clang__)
  60. # define HDEPRECATED(OBJ, MSG) OBJ __attribute__((deprecated(MSG)))
  61. # elif defined(_MSC_VER)
  62. # define HDEPRECATED(OBJ, MSG) __declspec(deprecated(MSG)) OBJ
  63. # endif
  64. #endif
  65. #if !defined(HDEPRECATED)
  66. # define HDEPRECATED(OBJ, MSG) OBJ
  67. #endif
  68. #if defined(HCPP_LEGACY_API)
  69. // Allow usage of legacy exception handler
  70. # define HCPP_LEGACY_EXCEPTION
  71. #endif
  72. // HALCON/C++ types
  73. #include "halconcpp/HalconCppForwards.h"
  74. // HALCON/C++ includes (don't reorder these !)
  75. // clang-format off
  76. #include "halconcpp/HTuple.h"
  77. #include "halconcpp/HVector.h"
  78. #include "halconcpp/HString.h"
  79. #include "halconcpp/HException.h"
  80. #include "halconcpp/HDevWindowStack.h"
  81. #include "halconcpp/HObjectBase.h"
  82. #include "halconcpp/HHandleBase.h"
  83. #include "halconcpp/HHandle.h"
  84. #include "halconcpp/HDataBase.h"
  85. #include "halconcpp/HOperatorOverloads.h"
  86. // clang-format on
  87. // Fully generated classes
  88. #include "halconcpp/HalconCppIncludes.h"
  89. // Include inline functions for streaming operations
  90. #include "halconcpp/HIOStream.h"
  91. /*****************************************************************************
  92. ** String Encoding for the HALCON/C++ interface
  93. ** This effects all char* strings used by HTuple, HString and the operators
  94. **---------------------------------------------------------------------------
  95. ** The global functions are for setting and requesting the string encoding
  96. ** used in the HALCON/C++ interface.
  97. *****************************************************************************/
  98. namespace HalconCpp
  99. {
  100. LIntExport void SetHcppInterfaceStringEncodingIsUtf8(bool is_utf8);
  101. LIntExport bool IsHcppInterfaceStringEncodingUtf8();
  102. }
  103. // Defining the following two preprocessor constants
  104. // enables a restricted source code compatibility mode
  105. // for procedural legacy code
  106. // Definining HCPP_LEGACY_API provides declarations for
  107. // Hobject and HTuple members that are
  108. #if defined(HCPP_LEGACY_API)
  109. // Allow to resolve obsolete class Hobject
  110. namespace HalconCpp
  111. {
  112. typedef HalconCpp::HObject Hobject;
  113. }
  114. // Allow to use global operator signatures with Herror return values */
  115. # include "halconcpp/HOperatorSetLegacy.h"
  116. // Defining HCPP_LEGACY_NAMESPACE will textually
  117. // replace all references to the Halcon namespace with
  118. // HalconCpp, with potential for name conflicts.
  119. # if defined(HCPP_LEGACY_NAMESPACE)
  120. // Remap namespace Halcon to HalconCpp
  121. # define Halcon HalconCpp
  122. # endif
  123. #endif // HCPP_LEGACY_API
  124. #endif // HALCON_CPP_H