HInstance.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*****************************************************************************
  2. * HInstance.h
  3. *****************************************************************************
  4. *
  5. * Project: HALCON/HLib
  6. * Description: handling of HALCON operator instances and HALCON threads;
  7. * provides procedural access to global context variables;
  8. *
  9. * (c) 1996-2020 by MVTec Software GmbH
  10. * www.mvtec.com
  11. *
  12. *****************************************************************************/
  13. #ifndef HINSTANCE_H
  14. #define HINSTANCE_H
  15. #if defined(__cplusplus)
  16. extern "C" {
  17. #endif
  18. #include "hlib/HInstanceDefines.h"
  19. /* HALCON library already initialized? */
  20. extern HLibExport HBOOL IsInitHlib(void);
  21. /* HAccessGlVar - access to global HALCON context variables */
  22. extern HLibExport Herror HAccessGlVar(Hproc_handle proc_handle, HINT element,
  23. HBYTE to_do, void* r_value,
  24. double w_value, char* w_string,
  25. Hkey w_key, INT4_8 index);
  26. /* HWriteGlUtf8Var - write a string with encoding to the global HALCON
  27. * context and convert it if necessary from hlib encoding to utf-8 */
  28. extern HLibExport Herror HWriteGlUtf8Var(Hproc_handle ph, HINT element,
  29. char const* str_hlib);
  30. /* HReadGlUtf8Var - read a string with encoding from the global HALCON
  31. * context and convert if necessary from utf-8 to hlib encoding
  32. * when do_free is set to true by the called function, the result string was
  33. * allocated in local memory and must be freed by the caller,
  34. * if the caller passes NULL for do_free, it must always be freed */
  35. extern HLibExport Herror HReadGlUtf8Var(Hproc_handle ph, HINT element,
  36. char** str_p, HBOOL* do_free);
  37. /* HCheckInpObjNum - check whether specified object number is in range */
  38. extern HLibExport HBOOL HCheckInpObjNum(Hproc_handle proc_handle, HINT par_num,
  39. INT4_8 obj_num);
  40. extern HLibExport HBOOL HCheckObjNum(Hproc_handle proc_handle, HINT par_num,
  41. INT4_8 obj_num);
  42. extern HLibExport HBOOL HCheckOutpObjNum(Hproc_handle proc_handle,
  43. HINT par_num, INT4_8 obj_num);
  44. extern HLibExport Hproc_handle HTSProcHandle(void);
  45. extern HLibExport Hproc_handle HTSHProcIndepend(HINT op_id);
  46. extern HLibExport void* HCreateTSPSysInfoHandle(void);
  47. extern HLibExport Herror HPushTSPSysInfoHandle(void* handle);
  48. extern HLibExport void* HPopTSPSysInfoHandle(void);
  49. extern HLibExport Herror HClearTSPSysInfoHandle(void* handle);
  50. /* HGetHProc - get a thread specific HALCON operator call instance (no full
  51. * use) */
  52. extern HLibExport Herror HGetHProc(INT4 proc_index, Hproc_handle* ph);
  53. /* HPutHProc - return a thread specific HALCON operator call instance to Core*/
  54. extern HLibExport Herror HPutHProc(Hproc_handle proc_handle);
  55. /* HGetRecHProc - get a thread specific HALCON operator call instance, able
  56. * to handle recursive calls (no full use) */
  57. extern HLibExport Herror HGetRecHProc(INT4 proc_index, Hproc_handle* ph);
  58. /* HPutRecHProc - return a thread specific (recursiveable) HALCON operator
  59. * call instance */
  60. extern HLibExport Herror HPutRecHProc(Hproc_handle proc_handle);
  61. /* HPutRecHProcErr - return a thread specific (recursiveable) HALCON operator
  62. * call instance, where the operator returned with the given error */
  63. extern HLibExport Herror HPutRecHProcErr(Hproc_handle ph, Herror err);
  64. /* HCreateHProc - create a new HALCON operator call instance */
  65. extern HLibExport Herror HCreateHProc(INT4 current_idx,
  66. Hproc_handle* proc_handle);
  67. /* HDeleteHProc - delete a HALCON operator call instance */
  68. extern HLibExport Herror HDeleteHProc(Hproc_handle proc_handle, HBOOL last,
  69. Herror proc_result);
  70. extern HLibExport HBOOL HOpIdIsValid(HINT opid);
  71. extern HLibExport HINT HGVGet_NumSysOp(void); /* number of system operators*/
  72. extern HLibExport HINT HGVGet_NumOp(void); /* total number of operators */
  73. extern HLibExport char const* HGVGet_Language(void);
  74. extern HLibExport HINT HGVGet_locale_filename_encoding(void);
  75. extern HLibExport UINT4 HGVGet_parallel(void);
  76. extern HLibExport HBOOL HGVGet_CPUFeature(HINT feature);
  77. extern HLibExport void HGVSet_CPUFeature(HINT feature, HBOOL value);
  78. extern HLibExport INT4_8 HGVGet_CPUCache(HINT level);
  79. extern HLibExport char const* HOIGet_InpCtrlParType(HINT opid);
  80. extern HLibExport char const* HOIGet_OutpCtrlParType(HINT opid);
  81. extern HLibExport HINT HOIGet_NumInpCtrlPar(HINT opid);
  82. extern HLibExport HINT HOIGet_NumOutpCtrlPar(HINT opid);
  83. extern HLibExport HINT HOIGet_NumInpObjPar(HINT opid);
  84. extern HLibExport HINT HOIGet_NumOutpObjPar(HINT opid);
  85. extern HLibExport char const* HOIGet_LogicalName(HINT opid);
  86. extern HLibExport HINT HPHGet_NumInpCtrlPar(Hproc_handle ph);
  87. extern HLibExport HINT HPHGet_NumOutpCtrlPar(Hproc_handle ph);
  88. extern HLibExport HINT HPHGet_NumInpObjPar(Hproc_handle ph);
  89. extern HLibExport HINT HPHGet_NumOutpObjPar(Hproc_handle ph);
  90. extern HLibExport INT4 HPHGet_proc_index(Hproc_handle ph);
  91. extern HLibExport const char* HPHGet_LogicalName(Hproc_handle ph);
  92. extern HLibExport INT4 HPHGet_check(Hproc_handle ph);
  93. extern HLibExport INT4_8 HPHGet_PreviousMaxAlloc(Hproc_handle ph);
  94. extern HBOOL HGetInstanceMemCacheMode(void);
  95. extern Herror HSetInstanceMemCacheMode(Hproc_handle ph, HBOOL mode);
  96. /* HProcSetStop sets a stop-flag for all running operator instances
  97. * (asynchonously). Opertors supporting this flag will break execution and
  98. * return (without an error) */
  99. extern HLibExport Herror HProcSetStop(HINT mode);
  100. /* HProcBreak sets a beak flag for all running operator instances
  101. * (asynchonously) */
  102. extern HLibExport Herror HProcBreak(void);
  103. #if defined(__cplusplus)
  104. }
  105. #endif
  106. #endif