HExtern.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*****************************************************************************
  2. * HExtern.h
  3. *****************************************************************************
  4. *
  5. * Project: HALCON/libhalcon
  6. * Description: External variables and some global procedures for
  7. * language interfaces
  8. *
  9. * (c) 1996-2020 by MVTec Software GmbH
  10. * www.mvtec.com
  11. *
  12. *****************************************************************************/
  13. #ifndef HEXTERN_H
  14. #define HEXTERN_H
  15. #if defined(__cplusplus)
  16. extern "C" {
  17. #endif
  18. /* global variables for image processing */
  19. /* procedures description */
  20. extern HLibExport HINT HDoLowError; /* error messages of HALCON */
  21. extern HLibExport INT4 HLowErrorAction[4]; /* action for HALCON low */
  22. /* level error messages */
  23. extern HLibExport HINT HDoLicenseError; /* license msgs of HALCON */
  24. extern HLibExport HINT HUseSpinLock; /* sync initialization of
  25. * Parallel HALCON */
  26. extern HLibExport HINT HStartUpThreadPool; /* start thread pool
  27. * initially? */
  28. extern HLibExport HINT HShutdownThreadPool; /* shutdown thread pool
  29. * on termination? */
  30. extern HLibExport HINT HShuttingDown; /* currently terminating and
  31. * unloading HALCON Library? */
  32. /* Convenience function accessors as some development environments */
  33. /* do not directly support importing variables from C DLLs. */
  34. extern HLibExport void __stdcall HSetDoLicenseError(HINT value);
  35. extern HLibExport void __stdcall HSetUseSpinLock(HINT value);
  36. extern HLibExport void __stdcall HSetStartUpThreadPool(HINT value);
  37. extern HLibExport void __stdcall HSetShutdownThreadPool(HINT value);
  38. extern HLibExport HINT __stdcall HGetDoLicenseError(void);
  39. extern HLibExport HINT __stdcall HGetUseSpinLock(void);
  40. extern HLibExport HINT __stdcall HGetStartUpThreadPool(void);
  41. extern HLibExport HINT __stdcall HGetShutdownThreadPool(void);
  42. extern HLibExport HINT __stdcall HGetShuttingDown(void);
  43. /* remark: the structure above contains global HALCON system variables */
  44. /* which are (in the normal case) exclusively accessible via a valid */
  45. /* procedure handle and by using specific functions of the HALCON-Lib */
  46. /* source code file HInstance.c; those functions contain synchronization */
  47. /* mechanisms to guarantee a correct access to the variables even in case of */
  48. /* a parallel/multithreaded/reentrant HALCON version. */
  49. /* Nevertheless the structure is propagated here so that it also can be used */
  50. /* directly, but this should be done VERY CAREFULLY!! At the moment it is */
  51. /* only used directly within HDevelop, which means no problem, because */
  52. /* HDevelop works strictly sequentially, i.e. it calls all HALCON */
  53. /* operators one after another; */
  54. /* Functions to tell HALCON library the interface from which it gets accessed.
  55. * This enables the library to adapt its default behaviour. */
  56. extern HLibExport void __stdcall HSetHDevelopInt(HINT AccessByHDevelop);
  57. extern HLibExport HINT __stdcall HGetHDevelopInt(void);
  58. extern HLibExport void __stdcall HSetCOMInt(HINT AccessByCOM);
  59. extern HLibExport HINT __stdcall HGetCOMInt(void);
  60. /* Function to tell HALCON library about the console */
  61. #ifdef WIN32
  62. extern HLibExport void __stdcall HSetConsole(HINT ProcessId);
  63. #endif
  64. /* Function to register a license recheck failure callback. */
  65. extern HLibExport void __stdcall
  66. HSetLicenseRecheckFailedCallback(HLicenseRecheckFailedCallback callback,
  67. void *context);
  68. /* FinalizeHALCONLibrary prepares HALCON for finalization. It should be called
  69. * right before unloading the HALCON Library.
  70. * Return Value: H_ERR_FINI_USR_THREAD if there are still user threads running
  71. * that were using HALCON functionality. No resources are freed in this case.
  72. */
  73. extern HLibExport HINT __stdcall FinalizeHALCONLibrary(void);
  74. /* Callback interface for operators to signal their progress and current
  75. * status. External applications can register to receive such updates using
  76. * set_system('add_progress_callback', CallbackFunction).
  77. *
  78. * The registered callback is called by selected operators to signal their
  79. * progress and supply an update in text form. The parameters of the callback
  80. * are:
  81. * - id: Operating system specific thread identifier. Note that with Automatic
  82. * Operator Parallelization (AOP), the callback can be called from a
  83. * different thread than the one used to call the operator. The id is
  84. * thread independent and unique for the current operator call.
  85. * It is the result of GetCurrentThreadId() (Windows) or pthread_self
  86. * (UNIX) of the main thread used to call the operator.
  87. * - operator_name: Name of the operator that is executing
  88. * - progress: >=0: the current progress of the operator between 0 and 1.
  89. * Note that the progress is only an approximation.
  90. * -1: No progress available (only a message)
  91. * -2: the operator has finished execution. The application should
  92. * clean up any resources allocated for the operator.
  93. * Note that this call is done only for operators that
  94. * previously sent a progress update.
  95. * - message: If not NULL, a message about the operator's progress in english.
  96. */
  97. typedef void(__stdcall *HProgressBarCallback)(Hlong id,
  98. const char *operator_name,
  99. double progress,
  100. const char *message);
  101. #if defined(__cplusplus)
  102. }
  103. #endif
  104. #endif