HCtype.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /*****************************************************************************
  2. * HCtype.h
  3. *****************************************************************************
  4. *
  5. * Project: HALCON/libhalcon
  6. * Description: (Global) data structures defining the processing context
  7. * for HALCON operator instances and HALCON operator threads
  8. *
  9. * (c) 1996-2020 by MVTec Software GmbH
  10. * www.mvtec.com
  11. *
  12. *****************************************************************************/
  13. #ifndef HCTYPE_H
  14. #define HCTYPE_H
  15. #include "HErrorDef.h"
  16. #include "IPType.h"
  17. #if defined(__cplusplus)
  18. extern "C" {
  19. #endif
  20. #ifndef HC_NO_STRUCT_MEMBER_ALIGNMENT
  21. /* sets the struct member alignment to avoid problems if
  22. * the settings of the user differ to those of the HALCON
  23. * version. (8 is the default alignment, generally) */
  24. # pragma pack(push, 8)
  25. #endif
  26. /*---------------------------------------------------------------------------
  27. * aop_split_t defines CORE-AOP levels
  28. *---------------------------------------------------------------------------*/
  29. typedef enum
  30. {
  31. split_tuple = 0,
  32. split_channel,
  33. split_domain,
  34. split_num
  35. } aop_split_t;
  36. /*---------------------------------------------------------------------------*/
  37. /* ATTENTION! Increase H_OPERATOR_INFO_VERSION/DERIVATE whenever you change
  38. * or add operator info identifyers
  39. * The version number is composed as follows:
  40. * Version#32 := [Major#8 Minor#8 OptionalInfo16]
  41. * whereas major#8 denotes a 1 byte coded mojor version number,
  42. * Minor#8 denotes a 1 byte coded minor version number,
  43. * OptionalInfo16 denotes a 16 bit coded bitfield of optional coded
  44. * operator information
  45. *---------------------------------------------------------------------------*/
  46. #define H_OPERATOR_INFO_VERSION 0x0400 /* 4.0 */
  47. #ifndef HC_NO_COMPUTE_DEVICES
  48. # define HOI_COMPUTE_DEVICES \
  49. (1 << 0) /* Bit0: information for compute device \
  50. * support available */
  51. #else
  52. # define HOI_COMPUTE_DEVICES 0
  53. #endif
  54. #define H_OPERATOR_INFO_DERIVATE \
  55. ((H_OPERATOR_INFO_VERSION << 16) | HOI_COMPUTE_DEVICES)
  56. /* HALCON operator info identifyers: */
  57. #define HOIID_NumInpObjPar 0
  58. #define HOIID_NumOutpObjPar 1
  59. #define HOIID_NumInpCtrlPar 2
  60. #define HOIID_NumOutpCtrlPar 3
  61. #define HOIID_LogicalName 4
  62. #define HOIID_PhysicalName 5
  63. #define HOIID_ParameterName 6
  64. #define HOIID_ParameterType 7 /* [2] */
  65. #define HOIID_process_excl_local 8
  66. #define HOIID_parallelization 9
  67. #define HOIID_splitIOPmask 10 /*[split_num]*/
  68. #define HOIID_tupleIOPmask 11 /*[split_num]*/
  69. #define HOIID_splitIOPref 12 /*[split_num]*/
  70. #define HOIID_RegionPost 13
  71. #define HOIID_ParameterCosts 14 /*[MAX_INP_CTRL_PAR]*/
  72. #define HOIID_ParameterPost 15 /*[MAX_OUTP_CTRL_PAR]*/
  73. #define HOIID_aopCost 16
  74. #define HOIID_numCost 17
  75. #define HOIID_parallelMinCosts 18
  76. #define HOIID_parallelRegionsplit 19
  77. #define HOIID_HelpIndex 20
  78. #define HOIID_InfoLength 21
  79. #define HOIID_Class 22 /*[MAX_CHAPTER]*/
  80. #define HOIID_ClassName 23 /*[MAX_CHAPTER]*/
  81. #define HOIID_package_id 24
  82. /* --- compute devices: */
  83. #define HOIID_compute_device 25
  84. #define HOIID_cd_supported_image_kinds 26
  85. #define HOIID_cd_supported_values 27
  86. #define HOIID_cd_supported_values_num 28
  87. #define HOIID_procedure 50
  88. #define HOIID_module 51
  89. /*---------------------------------------------------------------------------
  90. * HXPkgOpenId initializes extension package structures and checks
  91. * compatibility.
  92. *---------------------------------------------------------------------------*/
  93. extern HLibExport Herror HXPkgOpenId(int32_t xpkg_id, uint32_t halcon_version,
  94. uint32_t opinfo_version, int op_num,
  95. int* osid);
  96. /*---------------------------------------------------------------------------
  97. * HXPkgSetOpInfo sets operator information of a specific extension package
  98. * operator.
  99. *---------------------------------------------------------------------------*/
  100. extern HLibExport Herror HXPkgSetOpInfo(int32_t xpkg_id, int32_t op_id,
  101. int32_t oi_id, ...);
  102. /*---------------------------------------------------------------------------*/
  103. /* H_OPERATOR_PARAMETERS - data structure that contains the operator
  104. * parameters passed to the language interface. This information is only valid
  105. * for the processing time of the associated instance/HALCON thread.
  106. * All read/write accesses to the information are done exclusively
  107. * (thus different HALCON threads of the same instance differ in the
  108. * content of this structure).
  109. *---------------------------------------------------------------------------*/
  110. typedef struct
  111. {
  112. /*-------------------------------- operator parameters --------------------*/
  113. /*______________________________________________input object parameters:___*/
  114. Hkey* InpObjList[MAX_INP_OBJ_PAR + 1]; /* for every input object par *
  115. * an array of object keys */
  116. Hkey InpObjSingle[MAX_INP_OBJ_PAR + 1]; /* used, when the array of obj
  117. * keys has size 1 */
  118. INT4_8 InpObjNum[MAX_INP_OBJ_PAR + 1]; /* number of objects per input obj. *
  119. * parameter; index: 1..inp_obj */
  120. int8_t freeIOP[MAX_INP_OBJ_PAR + 1];
  121. /*_____________________________________________input control parameters:___*/
  122. Hctuple** InpCtrlList; /* used to access inp. ctrl handles */
  123. Hctuple*
  124. InpCtrlStack[MAX_INP_CTRL_PAR]; /* stores interf./Single references*/
  125. Hctuple InpCtrlNested[MAX_INP_CTRL_PAR]; /* holds tuple trunks, eg for pure
  126. * type input ctrls(single values)*/
  127. bool ctrl_inherited; /* true, if all ctrl. values are inherited from
  128. * a father instance (only important for
  129. * correctly freeing the InpCtrlList). */
  130. /*_____________________________________________output object parameters:___*/
  131. Hkey* OutpObjList[MAX_OUTP_OBJ_PAR + 1]; /* for every output object par. *
  132. * an array of objects keys */
  133. INT4_8 OutpObjNum[MAX_OUTP_OBJ_PAR + 1]; /* number of objects per output *
  134. * object par.; index: 1.. */
  135. INT4_8 OutpObjLen[MAX_OUTP_OBJ_PAR + 1]; /* length of OutpObjList per *
  136. * output object par.; index: 1.. */
  137. /*____________________________________________output control parameters:___*/
  138. Hctuple** OutpCtrlList; /* used to access outp. ctrl parameters */
  139. Hctuple* OutpCtrlStack[MAX_OUTP_CTRL_PAR]; /* stores interface/Nested ref. */
  140. Hctuple OutpCtrlNested[MAX_OUTP_CTRL_PAR]; /* holds tuple trunks for output
  141. * ctrl values (eg, pure type
  142. * operators) */
  143. uint32_t
  144. freeOCP; /* bitcoded free flag: 8*sizeof(freeOCP)>=MAX_OUTP_CTRL_PAR*/
  145. } H_OPERATOR_PARAMETERS;
  146. /*---------------------------------------------------------------------------*/
  147. /* H_OPERATOR_SHARED - data structure that is shared among internal threads.
  148. *---------------------------------------------------------------------------*/
  149. typedef struct
  150. {
  151. int32_t run_state;
  152. } H_OPERATOR_SHARED;
  153. typedef enum
  154. {
  155. ph_ready = 0,
  156. ph_running = H_MSG_OK,
  157. ph_break = H_ERR_BREAK,
  158. ph_hen_canceled = H_ERR_HEN_CANCEL,
  159. ph_canceled = H_ERR_CANCEL
  160. } HRunState;
  161. typedef struct HLISTEL
  162. { /* placeholder for internal double linked list element type */
  163. struct HLISTEL* prev;
  164. struct HLISTEL* next;
  165. } H_LIST_EL;
  166. typedef struct HALCON_OPERATOR_HANDLE
  167. {
  168. H_LIST_EL list_el; /*list_el must be defined in the first place*/
  169. void* generator;
  170. int32_t proc_index; /* Index of HALCON operator */
  171. H_OPERATOR_PARAMETERS* param; /* operator parameters (thread-specific) */
  172. H_OPERATOR_SHARED* shared_data; /*shared operator data*/
  173. } H_OPHANDLE;
  174. typedef H_OPHANDLE* Hophandle_;
  175. #ifndef HC_NO_STRUCT_MEMBER_ALIGNMENT
  176. # pragma pack(pop)
  177. #endif
  178. #if defined(__cplusplus)
  179. }
  180. #endif
  181. #endif