HalconCpp.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*****************************************************************************
  2. * HalconCpp.h
  3. *****************************************************************************
  4. *
  5. * Project: HALCON/C++
  6. * Description: Defines / types / extern declarations for HALCON/C++ interface
  7. *
  8. * (c) 2010-2020 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 __GNUC__ && !defined HC_NO_LEGACY_WARNING
  56. # define GCC_VERSION (__GNUC__ * 10 + __GNUC_MINOR__)
  57. # if defined __INTEL_COMPILER || GCC_VERSION < 45
  58. # define HDEPRECATED( OBJ, MSG) OBJ __attribute__ ((deprecated))
  59. # else
  60. # define HDEPRECATED( OBJ, MSG) OBJ __attribute__ ((deprecated(MSG)))
  61. # endif
  62. #elif defined(_MSC_VER) && !defined HC_NO_LEGACY_WARNING
  63. # define HDEPRECATED( OBJ, MSG) __declspec(deprecated(MSG)) OBJ
  64. #else
  65. // no mechanism implemented for this compiler
  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
  75. #include "halconcpp/HTuple.h"
  76. #include "halconcpp/HVector.h"
  77. #include "halconcpp/HString.h"
  78. #include "halconcpp/HException.h"
  79. #include "halconcpp/HDevWindowStack.h"
  80. #include "halconcpp/HObjectBase.h"
  81. #include "halconcpp/HHandleBase.h"
  82. #include "halconcpp/HHandle.h"
  83. #include "halconcpp/HDataBase.h"
  84. #include "halconcpp/HOperatorOverloads.h"
  85. // Fully generated classes
  86. #include "halconcpp/HalconCppIncludes.h"
  87. // Include inline functions for streaming operations
  88. #include "halconcpp/HIOStream.h"
  89. /*****************************************************************************
  90. ** String Encoding for the HALCON/C++ interface
  91. ** This effects all char* strings used by HTuple, HString and the operators
  92. **---------------------------------------------------------------------------
  93. ** The global functions are for setting and requesting the string encoding
  94. ** used in the HALCON/C++ interface.
  95. *****************************************************************************/
  96. namespace HalconCpp
  97. {
  98. LIntExport void SetHcppInterfaceStringEncodingIsUtf8(bool is_utf8);
  99. LIntExport bool IsHcppInterfaceStringEncodingUtf8();
  100. }
  101. // Defining the following two preprocessor constants
  102. // enables a restricted source code compatibility mode
  103. // for procedural legacy code
  104. // Definining HCPP_LEGACY_API provides declarations for
  105. // Hobject and HTuple members that are
  106. #if defined(HCPP_LEGACY_API)
  107. // Allow to resolve obsolete class Hobject
  108. namespace HalconCpp
  109. {
  110. typedef HalconCpp::HObject Hobject;
  111. }
  112. // Allow to use global operator signatures with Herror return values */
  113. #include "halconcpp/HOperatorSetLegacy.h"
  114. // Defining HCPP_LEGACY_NAMESPACE will textually
  115. // replace all references to the Halcon namespace with
  116. // HalconCpp, with potential for name conflicts.
  117. #if defined(HCPP_LEGACY_NAMESPACE)
  118. // Remap namespace Halcon to HalconCpp
  119. #define Halcon HalconCpp
  120. #endif
  121. #endif // HCPP_LEGACY_API
  122. #endif // HALCON_CPP_H