ctpbee-opt-api 0.1.0__cp310-cp310-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (414) hide show
  1. ctpbee_api/__init__.py +17 -0
  2. ctpbee_api/ctp/__init__.py +3 -0
  3. ctpbee_api/ctp/ctp_constant.py +1253 -0
  4. ctpbee_api/ctp/generator/concat.py +93 -0
  5. ctpbee_api/ctp/generator/const.py +325 -0
  6. ctpbee_api/ctp/generator/ctp_constant.py +1274 -0
  7. ctpbee_api/ctp/generator/ctp_md_header_define.h +13 -0
  8. ctpbee_api/ctp/generator/ctp_md_header_function.h +6 -0
  9. ctpbee_api/ctp/generator/ctp_md_header_on.h +26 -0
  10. ctpbee_api/ctp/generator/ctp_md_header_process.h +26 -0
  11. ctpbee_api/ctp/generator/ctp_md_source_function.cpp +42 -0
  12. ctpbee_api/ctp/generator/ctp_md_source_module.cpp +18 -0
  13. ctpbee_api/ctp/generator/ctp_md_source_on.cpp +156 -0
  14. ctpbee_api/ctp/generator/ctp_md_source_process.cpp +282 -0
  15. ctpbee_api/ctp/generator/ctp_md_source_switch.cpp +78 -0
  16. ctpbee_api/ctp/generator/ctp_md_source_task.cpp +211 -0
  17. ctpbee_api/ctp/generator/ctp_struct.py +5640 -0
  18. ctpbee_api/ctp/generator/ctp_td_header_define.h +130 -0
  19. ctpbee_api/ctp/generator/ctp_td_header_function.h +174 -0
  20. ctpbee_api/ctp/generator/ctp_td_header_on.h +260 -0
  21. ctpbee_api/ctp/generator/ctp_td_header_process.h +260 -0
  22. ctpbee_api/ctp/generator/ctp_td_source_function.cpp +1456 -0
  23. ctpbee_api/ctp/generator/ctp_td_source_module.cpp +222 -0
  24. ctpbee_api/ctp/generator/ctp_td_source_on.cpp +1572 -0
  25. ctpbee_api/ctp/generator/ctp_td_source_process.cpp +5472 -0
  26. ctpbee_api/ctp/generator/ctp_td_source_switch.cpp +780 -0
  27. ctpbee_api/ctp/generator/ctp_td_source_task.cpp +2444 -0
  28. ctpbee_api/ctp/generator/ctp_typedef.py +800 -0
  29. ctpbee_api/ctp/generator/generate_api_functions.py +345 -0
  30. ctpbee_api/ctp/generator/generate_data_type.py +76 -0
  31. ctpbee_api/ctp/generator/generate_struct.py +84 -0
  32. ctpbee_api/ctp/include/mac/ctp/ThostFtdcMdApi.h +168 -0
  33. ctpbee_api/ctp/include/mac/ctp/ThostFtdcTraderApi.h +770 -0
  34. ctpbee_api/ctp/include/mac/ctp/ThostFtdcUserApiDataType.h +6878 -0
  35. ctpbee_api/ctp/include/mac/ctp/ThostFtdcUserApiStruct.h +10915 -0
  36. ctpbee_api/ctp/include/mac/pybind11/attr.h +690 -0
  37. ctpbee_api/ctp/include/mac/pybind11/buffer_info.h +208 -0
  38. ctpbee_api/ctp/include/mac/pybind11/cast.h +1704 -0
  39. ctpbee_api/ctp/include/mac/pybind11/chrono.h +225 -0
  40. ctpbee_api/ctp/include/mac/pybind11/common.h +2 -0
  41. ctpbee_api/ctp/include/mac/pybind11/complex.h +74 -0
  42. ctpbee_api/ctp/include/mac/pybind11/detail/class.h +743 -0
  43. ctpbee_api/ctp/include/mac/pybind11/detail/common.h +1255 -0
  44. ctpbee_api/ctp/include/mac/pybind11/detail/descr.h +171 -0
  45. ctpbee_api/ctp/include/mac/pybind11/detail/init.h +434 -0
  46. ctpbee_api/ctp/include/mac/pybind11/detail/internals.h +656 -0
  47. ctpbee_api/ctp/include/mac/pybind11/detail/type_caster_base.h +1177 -0
  48. ctpbee_api/ctp/include/mac/pybind11/detail/typeid.h +65 -0
  49. ctpbee_api/ctp/include/mac/pybind11/eigen/common.h +9 -0
  50. ctpbee_api/ctp/include/mac/pybind11/eigen/matrix.h +714 -0
  51. ctpbee_api/ctp/include/mac/pybind11/eigen/tensor.h +516 -0
  52. ctpbee_api/ctp/include/mac/pybind11/eigen.h +12 -0
  53. ctpbee_api/ctp/include/mac/pybind11/embed.h +316 -0
  54. ctpbee_api/ctp/include/mac/pybind11/eval.h +156 -0
  55. ctpbee_api/ctp/include/mac/pybind11/functional.h +137 -0
  56. ctpbee_api/ctp/include/mac/pybind11/gil.h +239 -0
  57. ctpbee_api/ctp/include/mac/pybind11/iostream.h +265 -0
  58. ctpbee_api/ctp/include/mac/pybind11/numpy.h +1998 -0
  59. ctpbee_api/ctp/include/mac/pybind11/operators.h +202 -0
  60. ctpbee_api/ctp/include/mac/pybind11/options.h +92 -0
  61. ctpbee_api/ctp/include/mac/pybind11/pybind11.h +2890 -0
  62. ctpbee_api/ctp/include/mac/pybind11/pytypes.h +2557 -0
  63. ctpbee_api/ctp/include/mac/pybind11/stl/filesystem.h +116 -0
  64. ctpbee_api/ctp/include/mac/pybind11/stl.h +447 -0
  65. ctpbee_api/ctp/include/mac/pybind11/stl_bind.h +851 -0
  66. ctpbee_api/ctp/include/mac/pybind11/type_caster_pyobject_ptr.h +61 -0
  67. ctpbee_api/ctp/include/new/ctp/ThostFtdcMdApi.h +168 -0
  68. ctpbee_api/ctp/include/new/ctp/ThostFtdcTraderApi.h +770 -0
  69. ctpbee_api/ctp/include/new/ctp/ThostFtdcUserApiDataType.h +6878 -0
  70. ctpbee_api/ctp/include/new/ctp/ThostFtdcUserApiStruct.h +10915 -0
  71. ctpbee_api/ctp/include/new/pybind11/attr.h +690 -0
  72. ctpbee_api/ctp/include/new/pybind11/buffer_info.h +208 -0
  73. ctpbee_api/ctp/include/new/pybind11/cast.h +1704 -0
  74. ctpbee_api/ctp/include/new/pybind11/chrono.h +225 -0
  75. ctpbee_api/ctp/include/new/pybind11/common.h +2 -0
  76. ctpbee_api/ctp/include/new/pybind11/complex.h +74 -0
  77. ctpbee_api/ctp/include/new/pybind11/detail/class.h +743 -0
  78. ctpbee_api/ctp/include/new/pybind11/detail/common.h +1255 -0
  79. ctpbee_api/ctp/include/new/pybind11/detail/descr.h +171 -0
  80. ctpbee_api/ctp/include/new/pybind11/detail/init.h +434 -0
  81. ctpbee_api/ctp/include/new/pybind11/detail/internals.h +656 -0
  82. ctpbee_api/ctp/include/new/pybind11/detail/type_caster_base.h +1177 -0
  83. ctpbee_api/ctp/include/new/pybind11/detail/typeid.h +65 -0
  84. ctpbee_api/ctp/include/new/pybind11/eigen/common.h +9 -0
  85. ctpbee_api/ctp/include/new/pybind11/eigen/matrix.h +714 -0
  86. ctpbee_api/ctp/include/new/pybind11/eigen/tensor.h +516 -0
  87. ctpbee_api/ctp/include/new/pybind11/eigen.h +12 -0
  88. ctpbee_api/ctp/include/new/pybind11/embed.h +316 -0
  89. ctpbee_api/ctp/include/new/pybind11/eval.h +156 -0
  90. ctpbee_api/ctp/include/new/pybind11/functional.h +137 -0
  91. ctpbee_api/ctp/include/new/pybind11/gil.h +239 -0
  92. ctpbee_api/ctp/include/new/pybind11/iostream.h +265 -0
  93. ctpbee_api/ctp/include/new/pybind11/numpy.h +1998 -0
  94. ctpbee_api/ctp/include/new/pybind11/operators.h +202 -0
  95. ctpbee_api/ctp/include/new/pybind11/options.h +92 -0
  96. ctpbee_api/ctp/include/new/pybind11/pybind11.h +2890 -0
  97. ctpbee_api/ctp/include/new/pybind11/pytypes.h +2557 -0
  98. ctpbee_api/ctp/include/new/pybind11/stl/filesystem.h +116 -0
  99. ctpbee_api/ctp/include/new/pybind11/stl.h +447 -0
  100. ctpbee_api/ctp/include/new/pybind11/stl_bind.h +851 -0
  101. ctpbee_api/ctp/include/new/pybind11/type_caster_pyobject_ptr.h +61 -0
  102. ctpbee_api/ctp/include/previous/ctp/ThostFtdcMdApi.h +168 -0
  103. ctpbee_api/ctp/include/previous/ctp/ThostFtdcTraderApi.h +770 -0
  104. ctpbee_api/ctp/include/previous/ctp/ThostFtdcUserApiDataType.h +6878 -0
  105. ctpbee_api/ctp/include/previous/ctp/ThostFtdcUserApiStruct.h +10915 -0
  106. ctpbee_api/ctp/include/previous/pybind11/attr.h +489 -0
  107. ctpbee_api/ctp/include/previous/pybind11/buffer_info.h +108 -0
  108. ctpbee_api/ctp/include/previous/pybind11/cast.h +2067 -0
  109. ctpbee_api/ctp/include/previous/pybind11/chrono.h +162 -0
  110. ctpbee_api/ctp/include/previous/pybind11/common.h +2 -0
  111. ctpbee_api/ctp/include/previous/pybind11/complex.h +61 -0
  112. ctpbee_api/ctp/include/previous/pybind11/detail/class.h +626 -0
  113. ctpbee_api/ctp/include/previous/pybind11/detail/common.h +803 -0
  114. ctpbee_api/ctp/include/previous/pybind11/detail/descr.h +185 -0
  115. ctpbee_api/ctp/include/previous/pybind11/detail/init.h +335 -0
  116. ctpbee_api/ctp/include/previous/pybind11/detail/internals.h +285 -0
  117. ctpbee_api/ctp/include/previous/pybind11/detail/typeid.h +53 -0
  118. ctpbee_api/ctp/include/previous/pybind11/eigen.h +604 -0
  119. ctpbee_api/ctp/include/previous/pybind11/embed.h +194 -0
  120. ctpbee_api/ctp/include/previous/pybind11/eval.h +117 -0
  121. ctpbee_api/ctp/include/previous/pybind11/functional.h +85 -0
  122. ctpbee_api/ctp/include/previous/pybind11/iostream.h +200 -0
  123. ctpbee_api/ctp/include/previous/pybind11/numpy.h +1601 -0
  124. ctpbee_api/ctp/include/previous/pybind11/operators.h +168 -0
  125. ctpbee_api/ctp/include/previous/pybind11/options.h +65 -0
  126. ctpbee_api/ctp/include/previous/pybind11/pybind11.h +1965 -0
  127. ctpbee_api/ctp/include/previous/pybind11/pytypes.h +1332 -0
  128. ctpbee_api/ctp/include/previous/pybind11/stl.h +376 -0
  129. ctpbee_api/ctp/include/previous/pybind11/stl_bind.h +599 -0
  130. ctpbee_api/ctp/libs/libcomunicationkey.a +0 -0
  131. ctpbee_api/ctp/libs/libcrypto.a +0 -0
  132. ctpbee_api/ctp/libs/libssl.a +0 -0
  133. ctpbee_api/ctp/libs/thostmduserapi_se.lib +0 -0
  134. ctpbee_api/ctp/libs/thosttraderapi_se.lib +0 -0
  135. ctpbee_api/ctp/libthostmduserapi_se.so +0 -0
  136. ctpbee_api/ctp/libthosttraderapi_se.so +0 -0
  137. ctpbee_api/ctp/thostmduserapi_se.dll +0 -0
  138. ctpbee_api/ctp/thosttraderapi_se.dll +0 -0
  139. ctpbee_api/ctp/vnctp/vnctp.h +189 -0
  140. ctpbee_api/ctp/vnctp/vnctp.sln +41 -0
  141. ctpbee_api/ctp/vnctp/vnctpmd/dllmain.cpp +19 -0
  142. ctpbee_api/ctp/vnctp/vnctpmd/stdafx.cpp +1 -0
  143. ctpbee_api/ctp/vnctp/vnctpmd/stdafx.h +17 -0
  144. ctpbee_api/ctp/vnctp/vnctpmd/targetver.h +8 -0
  145. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.cpp +953 -0
  146. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.h +209 -0
  147. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj +200 -0
  148. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj.filters +54 -0
  149. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj.user +4 -0
  150. ctpbee_api/ctp/vnctp/vnctptd/dllmain.cpp +19 -0
  151. ctpbee_api/ctp/vnctp/vnctptd/stdafx.cpp +1 -0
  152. ctpbee_api/ctp/vnctp/vnctptd/stdafx.h +16 -0
  153. ctpbee_api/ctp/vnctp/vnctptd/targetver.h +8 -0
  154. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.cpp +12148 -0
  155. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.h +1329 -0
  156. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.vcxproj +198 -0
  157. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.vcxproj.filters +54 -0
  158. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.vcxproj.user +4 -0
  159. ctpbee_api/ctp/vnctpmd.cp310-win_amd64.pyd +0 -0
  160. ctpbee_api/ctp/vnctptd.cp310-win_amd64.pyd +0 -0
  161. ctpbee_api/ctp_mini/__init__.py +3 -0
  162. ctpbee_api/ctp_mini/generator/generate_api_functions.py +343 -0
  163. ctpbee_api/ctp_mini/generator/generate_data_type.py +76 -0
  164. ctpbee_api/ctp_mini/generator/generate_struct.py +85 -0
  165. ctpbee_api/ctp_mini/generator/mini_constant.py +1186 -0
  166. ctpbee_api/ctp_mini/generator/mini_md_header_define.h +13 -0
  167. ctpbee_api/ctp_mini/generator/mini_md_header_function.h +4 -0
  168. ctpbee_api/ctp_mini/generator/mini_md_header_on.h +26 -0
  169. ctpbee_api/ctp_mini/generator/mini_md_header_process.h +26 -0
  170. ctpbee_api/ctp_mini/generator/mini_md_source_function.cpp +29 -0
  171. ctpbee_api/ctp_mini/generator/mini_md_source_module.cpp +17 -0
  172. ctpbee_api/ctp_mini/generator/mini_md_source_on.cpp +156 -0
  173. ctpbee_api/ctp_mini/generator/mini_md_source_process.cpp +264 -0
  174. ctpbee_api/ctp_mini/generator/mini_md_source_switch.cpp +78 -0
  175. ctpbee_api/ctp_mini/generator/mini_md_source_task.cpp +203 -0
  176. ctpbee_api/ctp_mini/generator/mini_struct.py +4599 -0
  177. ctpbee_api/ctp_mini/generator/mini_td_header_define.h +63 -0
  178. ctpbee_api/ctp_mini/generator/mini_td_header_function.h +84 -0
  179. ctpbee_api/ctp_mini/generator/mini_td_header_on.h +126 -0
  180. ctpbee_api/ctp_mini/generator/mini_td_header_process.h +126 -0
  181. ctpbee_api/ctp_mini/generator/mini_td_source_function.cpp +663 -0
  182. ctpbee_api/ctp_mini/generator/mini_td_source_module.cpp +107 -0
  183. ctpbee_api/ctp_mini/generator/mini_td_source_on.cpp +756 -0
  184. ctpbee_api/ctp_mini/generator/mini_td_source_process.cpp +2492 -0
  185. ctpbee_api/ctp_mini/generator/mini_td_source_switch.cpp +378 -0
  186. ctpbee_api/ctp_mini/generator/mini_td_source_task.cpp +1193 -0
  187. ctpbee_api/ctp_mini/generator/mini_typedef.py +755 -0
  188. ctpbee_api/ctp_mini/generator/package/vnminimd.cpp +886 -0
  189. ctpbee_api/ctp_mini/generator/package/vnminimd.h +205 -0
  190. ctpbee_api/ctp_mini/include/new/mini/ThostFtdcMdApi.h +148 -0
  191. ctpbee_api/ctp_mini/include/new/mini/ThostFtdcTraderApi.h +419 -0
  192. ctpbee_api/ctp_mini/include/new/mini/ThostFtdcUserApiDataType.h +6458 -0
  193. ctpbee_api/ctp_mini/include/new/mini/ThostFtdcUserApiStruct.h +8890 -0
  194. ctpbee_api/ctp_mini/include/new/pybind11/attr.h +690 -0
  195. ctpbee_api/ctp_mini/include/new/pybind11/buffer_info.h +208 -0
  196. ctpbee_api/ctp_mini/include/new/pybind11/cast.h +1704 -0
  197. ctpbee_api/ctp_mini/include/new/pybind11/chrono.h +225 -0
  198. ctpbee_api/ctp_mini/include/new/pybind11/common.h +2 -0
  199. ctpbee_api/ctp_mini/include/new/pybind11/complex.h +74 -0
  200. ctpbee_api/ctp_mini/include/new/pybind11/detail/class.h +743 -0
  201. ctpbee_api/ctp_mini/include/new/pybind11/detail/common.h +1255 -0
  202. ctpbee_api/ctp_mini/include/new/pybind11/detail/descr.h +171 -0
  203. ctpbee_api/ctp_mini/include/new/pybind11/detail/init.h +434 -0
  204. ctpbee_api/ctp_mini/include/new/pybind11/detail/internals.h +656 -0
  205. ctpbee_api/ctp_mini/include/new/pybind11/detail/type_caster_base.h +1177 -0
  206. ctpbee_api/ctp_mini/include/new/pybind11/detail/typeid.h +65 -0
  207. ctpbee_api/ctp_mini/include/new/pybind11/eigen/common.h +9 -0
  208. ctpbee_api/ctp_mini/include/new/pybind11/eigen/matrix.h +714 -0
  209. ctpbee_api/ctp_mini/include/new/pybind11/eigen/tensor.h +516 -0
  210. ctpbee_api/ctp_mini/include/new/pybind11/eigen.h +12 -0
  211. ctpbee_api/ctp_mini/include/new/pybind11/embed.h +316 -0
  212. ctpbee_api/ctp_mini/include/new/pybind11/eval.h +156 -0
  213. ctpbee_api/ctp_mini/include/new/pybind11/functional.h +137 -0
  214. ctpbee_api/ctp_mini/include/new/pybind11/gil.h +239 -0
  215. ctpbee_api/ctp_mini/include/new/pybind11/iostream.h +265 -0
  216. ctpbee_api/ctp_mini/include/new/pybind11/numpy.h +1998 -0
  217. ctpbee_api/ctp_mini/include/new/pybind11/operators.h +202 -0
  218. ctpbee_api/ctp_mini/include/new/pybind11/options.h +92 -0
  219. ctpbee_api/ctp_mini/include/new/pybind11/pybind11.h +2890 -0
  220. ctpbee_api/ctp_mini/include/new/pybind11/pytypes.h +2557 -0
  221. ctpbee_api/ctp_mini/include/new/pybind11/stl/filesystem.h +116 -0
  222. ctpbee_api/ctp_mini/include/new/pybind11/stl.h +447 -0
  223. ctpbee_api/ctp_mini/include/new/pybind11/stl_bind.h +851 -0
  224. ctpbee_api/ctp_mini/include/new/pybind11/type_caster_pyobject_ptr.h +61 -0
  225. ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcMdApi.h +148 -0
  226. ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcTraderApi.h +419 -0
  227. ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcUserApiDataType.h +6458 -0
  228. ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcUserApiStruct.h +8890 -0
  229. ctpbee_api/ctp_mini/include/previous/pybind11/attr.h +489 -0
  230. ctpbee_api/ctp_mini/include/previous/pybind11/buffer_info.h +108 -0
  231. ctpbee_api/ctp_mini/include/previous/pybind11/cast.h +2067 -0
  232. ctpbee_api/ctp_mini/include/previous/pybind11/chrono.h +162 -0
  233. ctpbee_api/ctp_mini/include/previous/pybind11/common.h +2 -0
  234. ctpbee_api/ctp_mini/include/previous/pybind11/complex.h +61 -0
  235. ctpbee_api/ctp_mini/include/previous/pybind11/detail/class.h +626 -0
  236. ctpbee_api/ctp_mini/include/previous/pybind11/detail/common.h +803 -0
  237. ctpbee_api/ctp_mini/include/previous/pybind11/detail/descr.h +185 -0
  238. ctpbee_api/ctp_mini/include/previous/pybind11/detail/init.h +335 -0
  239. ctpbee_api/ctp_mini/include/previous/pybind11/detail/internals.h +285 -0
  240. ctpbee_api/ctp_mini/include/previous/pybind11/detail/typeid.h +53 -0
  241. ctpbee_api/ctp_mini/include/previous/pybind11/eigen.h +604 -0
  242. ctpbee_api/ctp_mini/include/previous/pybind11/embed.h +194 -0
  243. ctpbee_api/ctp_mini/include/previous/pybind11/eval.h +117 -0
  244. ctpbee_api/ctp_mini/include/previous/pybind11/functional.h +85 -0
  245. ctpbee_api/ctp_mini/include/previous/pybind11/iostream.h +200 -0
  246. ctpbee_api/ctp_mini/include/previous/pybind11/numpy.h +1601 -0
  247. ctpbee_api/ctp_mini/include/previous/pybind11/operators.h +168 -0
  248. ctpbee_api/ctp_mini/include/previous/pybind11/options.h +65 -0
  249. ctpbee_api/ctp_mini/include/previous/pybind11/pybind11.h +1965 -0
  250. ctpbee_api/ctp_mini/include/previous/pybind11/pytypes.h +1332 -0
  251. ctpbee_api/ctp_mini/include/previous/pybind11/stl.h +376 -0
  252. ctpbee_api/ctp_mini/include/previous/pybind11/stl_bind.h +599 -0
  253. ctpbee_api/ctp_mini/libs/thostmduserapi.lib +0 -0
  254. ctpbee_api/ctp_mini/libs/thosttraderapi.lib +0 -0
  255. ctpbee_api/ctp_mini/libthostmduserapi.so +0 -0
  256. ctpbee_api/ctp_mini/libthosttraderapi.so +0 -0
  257. ctpbee_api/ctp_mini/mini_constant.py +1186 -0
  258. ctpbee_api/ctp_mini/thostmduserapi.dll +0 -0
  259. ctpbee_api/ctp_mini/thosttraderapi.dll +0 -0
  260. ctpbee_api/ctp_mini/vnctp_mini/vnctp_mini.h +146 -0
  261. ctpbee_api/ctp_mini/vnctp_mini/vnctp_mini.sln +41 -0
  262. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/dllmain.cpp +0 -0
  263. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/stdafx.cpp +0 -0
  264. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/stdafx.h +0 -0
  265. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/targetver.h +0 -0
  266. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.cpp +886 -0
  267. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.h +203 -0
  268. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.vcxproj +183 -0
  269. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.vcxproj.filters +54 -0
  270. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.vcxproj.user +4 -0
  271. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/dllmain.cpp +0 -0
  272. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/stdafx.cpp +0 -0
  273. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/stdafx.h +0 -0
  274. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/targetver.h +0 -0
  275. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.cpp +5716 -0
  276. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.h +680 -0
  277. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.vcxproj +180 -0
  278. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.vcxproj.filters +54 -0
  279. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.vcxproj.user +4 -0
  280. ctpbee_api/ctp_mini/vnctp_minimd.cp310-win_amd64.pyd +0 -0
  281. ctpbee_api/ctp_mini/vnctp_minitd.cp310-win_amd64.pyd +0 -0
  282. ctpbee_api/ctp_mini/vnctp_minitd.lib +0 -0
  283. ctpbee_api/rohon/RohonBaseV64.dll +0 -0
  284. ctpbee_api/rohon/WinDataCollect.dll +0 -0
  285. ctpbee_api/rohon/__init__.py +3 -0
  286. ctpbee_api/rohon/generator/generate_api_functions.py +348 -0
  287. ctpbee_api/rohon/generator/generate_data_type.py +76 -0
  288. ctpbee_api/rohon/generator/generate_struct.py +84 -0
  289. ctpbee_api/rohon/generator/rohon_constant.py +1242 -0
  290. ctpbee_api/rohon/generator/rohon_md_header_define.h +13 -0
  291. ctpbee_api/rohon/generator/rohon_md_header_function.h +6 -0
  292. ctpbee_api/rohon/generator/rohon_md_header_on.h +26 -0
  293. ctpbee_api/rohon/generator/rohon_md_header_process.h +26 -0
  294. ctpbee_api/rohon/generator/rohon_md_source_function.cpp +40 -0
  295. ctpbee_api/rohon/generator/rohon_md_source_module.cpp +18 -0
  296. ctpbee_api/rohon/generator/rohon_md_source_on.cpp +156 -0
  297. ctpbee_api/rohon/generator/rohon_md_source_process.cpp +271 -0
  298. ctpbee_api/rohon/generator/rohon_md_source_switch.cpp +78 -0
  299. ctpbee_api/rohon/generator/rohon_md_source_task.cpp +211 -0
  300. ctpbee_api/rohon/generator/rohon_struct.py +4958 -0
  301. ctpbee_api/rohon/generator/rohon_td_header_define.h +125 -0
  302. ctpbee_api/rohon/generator/rohon_td_header_function.h +164 -0
  303. ctpbee_api/rohon/generator/rohon_td_header_on.h +250 -0
  304. ctpbee_api/rohon/generator/rohon_td_header_process.h +250 -0
  305. ctpbee_api/rohon/generator/rohon_td_source_function.cpp +1338 -0
  306. ctpbee_api/rohon/generator/rohon_td_source_module.cpp +209 -0
  307. ctpbee_api/rohon/generator/rohon_td_source_on.cpp +1500 -0
  308. ctpbee_api/rohon/generator/rohon_td_source_process.cpp +5125 -0
  309. ctpbee_api/rohon/generator/rohon_td_source_switch.cpp +750 -0
  310. ctpbee_api/rohon/generator/rohon_td_source_task.cpp +2339 -0
  311. ctpbee_api/rohon/generator/rohon_typedef.py +781 -0
  312. ctpbee_api/rohon/include/new/pybind11/attr.h +690 -0
  313. ctpbee_api/rohon/include/new/pybind11/buffer_info.h +208 -0
  314. ctpbee_api/rohon/include/new/pybind11/cast.h +1704 -0
  315. ctpbee_api/rohon/include/new/pybind11/chrono.h +225 -0
  316. ctpbee_api/rohon/include/new/pybind11/common.h +2 -0
  317. ctpbee_api/rohon/include/new/pybind11/complex.h +74 -0
  318. ctpbee_api/rohon/include/new/pybind11/detail/class.h +743 -0
  319. ctpbee_api/rohon/include/new/pybind11/detail/common.h +1255 -0
  320. ctpbee_api/rohon/include/new/pybind11/detail/descr.h +171 -0
  321. ctpbee_api/rohon/include/new/pybind11/detail/init.h +434 -0
  322. ctpbee_api/rohon/include/new/pybind11/detail/internals.h +656 -0
  323. ctpbee_api/rohon/include/new/pybind11/detail/type_caster_base.h +1177 -0
  324. ctpbee_api/rohon/include/new/pybind11/detail/typeid.h +65 -0
  325. ctpbee_api/rohon/include/new/pybind11/eigen/common.h +9 -0
  326. ctpbee_api/rohon/include/new/pybind11/eigen/matrix.h +714 -0
  327. ctpbee_api/rohon/include/new/pybind11/eigen/tensor.h +516 -0
  328. ctpbee_api/rohon/include/new/pybind11/eigen.h +12 -0
  329. ctpbee_api/rohon/include/new/pybind11/embed.h +316 -0
  330. ctpbee_api/rohon/include/new/pybind11/eval.h +156 -0
  331. ctpbee_api/rohon/include/new/pybind11/functional.h +137 -0
  332. ctpbee_api/rohon/include/new/pybind11/gil.h +239 -0
  333. ctpbee_api/rohon/include/new/pybind11/iostream.h +265 -0
  334. ctpbee_api/rohon/include/new/pybind11/numpy.h +1998 -0
  335. ctpbee_api/rohon/include/new/pybind11/operators.h +202 -0
  336. ctpbee_api/rohon/include/new/pybind11/options.h +92 -0
  337. ctpbee_api/rohon/include/new/pybind11/pybind11.h +2890 -0
  338. ctpbee_api/rohon/include/new/pybind11/pytypes.h +2557 -0
  339. ctpbee_api/rohon/include/new/pybind11/stl/filesystem.h +116 -0
  340. ctpbee_api/rohon/include/new/pybind11/stl.h +447 -0
  341. ctpbee_api/rohon/include/new/pybind11/stl_bind.h +851 -0
  342. ctpbee_api/rohon/include/new/pybind11/type_caster_pyobject_ptr.h +61 -0
  343. ctpbee_api/rohon/include/new/rohon/ThostFtdcMdApi.h +168 -0
  344. ctpbee_api/rohon/include/new/rohon/ThostFtdcTraderApi.h +739 -0
  345. ctpbee_api/rohon/include/new/rohon/ThostFtdcUserApiDataType.h +6708 -0
  346. ctpbee_api/rohon/include/new/rohon/ThostFtdcUserApiStruct.h +9580 -0
  347. ctpbee_api/rohon/include/previous/pybind11/attr.h +489 -0
  348. ctpbee_api/rohon/include/previous/pybind11/buffer_info.h +108 -0
  349. ctpbee_api/rohon/include/previous/pybind11/cast.h +2067 -0
  350. ctpbee_api/rohon/include/previous/pybind11/chrono.h +162 -0
  351. ctpbee_api/rohon/include/previous/pybind11/common.h +2 -0
  352. ctpbee_api/rohon/include/previous/pybind11/complex.h +61 -0
  353. ctpbee_api/rohon/include/previous/pybind11/detail/class.h +626 -0
  354. ctpbee_api/rohon/include/previous/pybind11/detail/common.h +803 -0
  355. ctpbee_api/rohon/include/previous/pybind11/detail/descr.h +185 -0
  356. ctpbee_api/rohon/include/previous/pybind11/detail/init.h +335 -0
  357. ctpbee_api/rohon/include/previous/pybind11/detail/internals.h +285 -0
  358. ctpbee_api/rohon/include/previous/pybind11/detail/typeid.h +53 -0
  359. ctpbee_api/rohon/include/previous/pybind11/eigen.h +604 -0
  360. ctpbee_api/rohon/include/previous/pybind11/embed.h +194 -0
  361. ctpbee_api/rohon/include/previous/pybind11/eval.h +117 -0
  362. ctpbee_api/rohon/include/previous/pybind11/functional.h +85 -0
  363. ctpbee_api/rohon/include/previous/pybind11/iostream.h +200 -0
  364. ctpbee_api/rohon/include/previous/pybind11/numpy.h +1601 -0
  365. ctpbee_api/rohon/include/previous/pybind11/operators.h +168 -0
  366. ctpbee_api/rohon/include/previous/pybind11/options.h +65 -0
  367. ctpbee_api/rohon/include/previous/pybind11/pybind11.h +1965 -0
  368. ctpbee_api/rohon/include/previous/pybind11/pytypes.h +1332 -0
  369. ctpbee_api/rohon/include/previous/pybind11/stl.h +376 -0
  370. ctpbee_api/rohon/include/previous/pybind11/stl_bind.h +599 -0
  371. ctpbee_api/rohon/include/previous/rohon/ThostFtdcMdApi.h +168 -0
  372. ctpbee_api/rohon/include/previous/rohon/ThostFtdcTraderApi.h +739 -0
  373. ctpbee_api/rohon/include/previous/rohon/ThostFtdcUserApiDataType.h +6708 -0
  374. ctpbee_api/rohon/include/previous/rohon/ThostFtdcUserApiStruct.h +9580 -0
  375. ctpbee_api/rohon/libLinuxDataCollect.so +0 -0
  376. ctpbee_api/rohon/librohonbase.so +0 -0
  377. ctpbee_api/rohon/librohonbase.so.1.1 +0 -0
  378. ctpbee_api/rohon/librohonbase.so.1.1.0.1 +0 -0
  379. ctpbee_api/rohon/libs/thostmduserapi_se.lib +0 -0
  380. ctpbee_api/rohon/libs/thosttraderapi_se.lib +0 -0
  381. ctpbee_api/rohon/libthostmduserapi_se.so +0 -0
  382. ctpbee_api/rohon/libthosttraderapi_se.so +0 -0
  383. ctpbee_api/rohon/rohon_constant.py +1242 -0
  384. ctpbee_api/rohon/thostmduserapi_se.dll +0 -0
  385. ctpbee_api/rohon/thosttraderapi_se.dll +0 -0
  386. ctpbee_api/rohon/vnrohon/.vs/vnrohon/v15/.suo +0 -0
  387. ctpbee_api/rohon/vnrohon/.vs/vnrohon/v15/Browse.VC.db +0 -0
  388. ctpbee_api/rohon/vnrohon/.vs/vnrohon/v15/Solution.VC.db +0 -0
  389. ctpbee_api/rohon/vnrohon/vnrohon.h +147 -0
  390. ctpbee_api/rohon/vnrohon/vnrohon.sln +41 -0
  391. ctpbee_api/rohon/vnrohon/vnrohonmd/dllmain.cpp +19 -0
  392. ctpbee_api/rohon/vnrohon/vnrohonmd/framework.h +5 -0
  393. ctpbee_api/rohon/vnrohon/vnrohonmd/pch.cpp +5 -0
  394. ctpbee_api/rohon/vnrohon/vnrohonmd/pch.h +13 -0
  395. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.cpp +931 -0
  396. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.h +207 -0
  397. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.vcxproj +188 -0
  398. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.vcxproj.filters +54 -0
  399. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.vcxproj.user +4 -0
  400. ctpbee_api/rohon/vnrohon/vnrohontd/dllmain.cpp +19 -0
  401. ctpbee_api/rohon/vnrohon/vnrohontd/framework.h +5 -0
  402. ctpbee_api/rohon/vnrohon/vnrohontd/pch.cpp +5 -0
  403. ctpbee_api/rohon/vnrohon/vnrohontd/pch.h +13 -0
  404. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.cpp +11395 -0
  405. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.h +1259 -0
  406. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.vcxproj +188 -0
  407. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.vcxproj.filters +54 -0
  408. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.vcxproj.user +4 -0
  409. ctpbee_api/rohon/vnrohonmd.cp310-win_amd64.pyd +0 -0
  410. ctpbee_api/rohon/vnrohontd.cp310-win_amd64.pyd +0 -0
  411. ctpbee_opt_api-0.1.0.dist-info/METADATA +46 -0
  412. ctpbee_opt_api-0.1.0.dist-info/RECORD +414 -0
  413. ctpbee_opt_api-0.1.0.dist-info/WHEEL +5 -0
  414. ctpbee_opt_api-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,489 @@
1
+ /*
2
+ pybind11/attr.h: Infrastructure for processing custom
3
+ type and function attributes
4
+
5
+ Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>
6
+
7
+ All rights reserved. Use of this source code is governed by a
8
+ BSD-style license that can be found in the LICENSE file.
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include "cast.h"
14
+
15
+ NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
16
+
17
+ /// \addtogroup annotations
18
+ /// @{
19
+
20
+ /// Annotation for methods
21
+ struct is_method { handle class_; is_method(const handle &c) : class_(c) { } };
22
+
23
+ /// Annotation for operators
24
+ struct is_operator { };
25
+
26
+ /// Annotation for parent scope
27
+ struct scope { handle value; scope(const handle &s) : value(s) { } };
28
+
29
+ /// Annotation for documentation
30
+ struct doc { const char *value; doc(const char *value) : value(value) { } };
31
+
32
+ /// Annotation for function names
33
+ struct name { const char *value; name(const char *value) : value(value) { } };
34
+
35
+ /// Annotation indicating that a function is an overload associated with a given "sibling"
36
+ struct sibling { handle value; sibling(const handle &value) : value(value.ptr()) { } };
37
+
38
+ /// Annotation indicating that a class derives from another given type
39
+ template <typename T> struct base {
40
+ PYBIND11_DEPRECATED("base<T>() was deprecated in favor of specifying 'T' as a template argument to class_")
41
+ base() { }
42
+ };
43
+
44
+ /// Keep patient alive while nurse lives
45
+ template <size_t Nurse, size_t Patient> struct keep_alive { };
46
+
47
+ /// Annotation indicating that a class is involved in a multiple inheritance relationship
48
+ struct multiple_inheritance { };
49
+
50
+ /// Annotation which enables dynamic attributes, i.e. adds `__dict__` to a class
51
+ struct dynamic_attr { };
52
+
53
+ /// Annotation which enables the buffer protocol for a type
54
+ struct buffer_protocol { };
55
+
56
+ /// Annotation which requests that a special metaclass is created for a type
57
+ struct metaclass {
58
+ handle value;
59
+
60
+ PYBIND11_DEPRECATED("py::metaclass() is no longer required. It's turned on by default now.")
61
+ metaclass() {}
62
+
63
+ /// Override pybind11's default metaclass
64
+ explicit metaclass(handle value) : value(value) { }
65
+ };
66
+
67
+ /// Annotation that marks a class as local to the module:
68
+ struct module_local { const bool value; constexpr module_local(bool v = true) : value(v) { } };
69
+
70
+ /// Annotation to mark enums as an arithmetic type
71
+ struct arithmetic { };
72
+
73
+ /** \rst
74
+ A call policy which places one or more guard variables (``Ts...``) around the function call.
75
+
76
+ For example, this definition:
77
+
78
+ .. code-block:: cpp
79
+
80
+ m.def("foo", foo, py::call_guard<T>());
81
+
82
+ is equivalent to the following pseudocode:
83
+
84
+ .. code-block:: cpp
85
+
86
+ m.def("foo", [](args...) {
87
+ T scope_guard;
88
+ return foo(args...); // forwarded arguments
89
+ });
90
+ \endrst */
91
+ template <typename... Ts> struct call_guard;
92
+
93
+ template <> struct call_guard<> { using type = detail::void_type; };
94
+
95
+ template <typename T>
96
+ struct call_guard<T> {
97
+ static_assert(std::is_default_constructible<T>::value,
98
+ "The guard type must be default constructible");
99
+
100
+ using type = T;
101
+ };
102
+
103
+ template <typename T, typename... Ts>
104
+ struct call_guard<T, Ts...> {
105
+ struct type {
106
+ T guard{}; // Compose multiple guard types with left-to-right default-constructor order
107
+ typename call_guard<Ts...>::type next{};
108
+ };
109
+ };
110
+
111
+ /// @} annotations
112
+
113
+ NAMESPACE_BEGIN(detail)
114
+ /* Forward declarations */
115
+ enum op_id : int;
116
+ enum op_type : int;
117
+ struct undefined_t;
118
+ template <op_id id, op_type ot, typename L = undefined_t, typename R = undefined_t> struct op_;
119
+ inline void keep_alive_impl(size_t Nurse, size_t Patient, function_call &call, handle ret);
120
+
121
+ /// Internal data structure which holds metadata about a keyword argument
122
+ struct argument_record {
123
+ const char *name; ///< Argument name
124
+ const char *descr; ///< Human-readable version of the argument value
125
+ handle value; ///< Associated Python object
126
+ bool convert : 1; ///< True if the argument is allowed to convert when loading
127
+ bool none : 1; ///< True if None is allowed when loading
128
+
129
+ argument_record(const char *name, const char *descr, handle value, bool convert, bool none)
130
+ : name(name), descr(descr), value(value), convert(convert), none(none) { }
131
+ };
132
+
133
+ /// Internal data structure which holds metadata about a bound function (signature, overloads, etc.)
134
+ struct function_record {
135
+ function_record()
136
+ : is_constructor(false), is_new_style_constructor(false), is_stateless(false),
137
+ is_operator(false), has_args(false), has_kwargs(false), is_method(false) { }
138
+
139
+ /// Function name
140
+ char *name = nullptr; /* why no C++ strings? They generate heavier code.. */
141
+
142
+ // User-specified documentation string
143
+ char *doc = nullptr;
144
+
145
+ /// Human-readable version of the function signature
146
+ char *signature = nullptr;
147
+
148
+ /// List of registered keyword arguments
149
+ std::vector<argument_record> args;
150
+
151
+ /// Pointer to lambda function which converts arguments and performs the actual call
152
+ handle (*impl) (function_call &) = nullptr;
153
+
154
+ /// Storage for the wrapped function pointer and captured data, if any
155
+ void *data[3] = { };
156
+
157
+ /// Pointer to custom destructor for 'data' (if needed)
158
+ void (*free_data) (function_record *ptr) = nullptr;
159
+
160
+ /// Return value policy associated with this function
161
+ return_value_policy policy = return_value_policy::automatic;
162
+
163
+ /// True if name == '__init__'
164
+ bool is_constructor : 1;
165
+
166
+ /// True if this is a new-style `__init__` defined in `detail/init.h`
167
+ bool is_new_style_constructor : 1;
168
+
169
+ /// True if this is a stateless function pointer
170
+ bool is_stateless : 1;
171
+
172
+ /// True if this is an operator (__add__), etc.
173
+ bool is_operator : 1;
174
+
175
+ /// True if the function has a '*args' argument
176
+ bool has_args : 1;
177
+
178
+ /// True if the function has a '**kwargs' argument
179
+ bool has_kwargs : 1;
180
+
181
+ /// True if this is a method
182
+ bool is_method : 1;
183
+
184
+ /// Number of arguments (including py::args and/or py::kwargs, if present)
185
+ std::uint16_t nargs;
186
+
187
+ /// Python method object
188
+ PyMethodDef *def = nullptr;
189
+
190
+ /// Python handle to the parent scope (a class or a module)
191
+ handle scope;
192
+
193
+ /// Python handle to the sibling function representing an overload chain
194
+ handle sibling;
195
+
196
+ /// Pointer to next overload
197
+ function_record *next = nullptr;
198
+ };
199
+
200
+ /// Special data structure which (temporarily) holds metadata about a bound class
201
+ struct type_record {
202
+ PYBIND11_NOINLINE type_record()
203
+ : multiple_inheritance(false), dynamic_attr(false), buffer_protocol(false), module_local(false) { }
204
+
205
+ /// Handle to the parent scope
206
+ handle scope;
207
+
208
+ /// Name of the class
209
+ const char *name = nullptr;
210
+
211
+ // Pointer to RTTI type_info data structure
212
+ const std::type_info *type = nullptr;
213
+
214
+ /// How large is the underlying C++ type?
215
+ size_t type_size = 0;
216
+
217
+ /// How large is the type's holder?
218
+ size_t holder_size = 0;
219
+
220
+ /// The global operator new can be overridden with a class-specific variant
221
+ void *(*operator_new)(size_t) = ::operator new;
222
+
223
+ /// Function pointer to class_<..>::init_instance
224
+ void (*init_instance)(instance *, const void *) = nullptr;
225
+
226
+ /// Function pointer to class_<..>::dealloc
227
+ void (*dealloc)(detail::value_and_holder &) = nullptr;
228
+
229
+ /// List of base classes of the newly created type
230
+ list bases;
231
+
232
+ /// Optional docstring
233
+ const char *doc = nullptr;
234
+
235
+ /// Custom metaclass (optional)
236
+ handle metaclass;
237
+
238
+ /// Multiple inheritance marker
239
+ bool multiple_inheritance : 1;
240
+
241
+ /// Does the class manage a __dict__?
242
+ bool dynamic_attr : 1;
243
+
244
+ /// Does the class implement the buffer protocol?
245
+ bool buffer_protocol : 1;
246
+
247
+ /// Is the default (unique_ptr) holder type used?
248
+ bool default_holder : 1;
249
+
250
+ /// Is the class definition local to the module shared object?
251
+ bool module_local : 1;
252
+
253
+ PYBIND11_NOINLINE void add_base(const std::type_info &base, void *(*caster)(void *)) {
254
+ auto base_info = detail::get_type_info(base, false);
255
+ if (!base_info) {
256
+ std::string tname(base.name());
257
+ detail::clean_type_id(tname);
258
+ pybind11_fail("generic_type: type \"" + std::string(name) +
259
+ "\" referenced unknown base type \"" + tname + "\"");
260
+ }
261
+
262
+ if (default_holder != base_info->default_holder) {
263
+ std::string tname(base.name());
264
+ detail::clean_type_id(tname);
265
+ pybind11_fail("generic_type: type \"" + std::string(name) + "\" " +
266
+ (default_holder ? "does not have" : "has") +
267
+ " a non-default holder type while its base \"" + tname + "\" " +
268
+ (base_info->default_holder ? "does not" : "does"));
269
+ }
270
+
271
+ bases.append((PyObject *) base_info->type);
272
+
273
+ if (base_info->type->tp_dictoffset != 0)
274
+ dynamic_attr = true;
275
+
276
+ if (caster)
277
+ base_info->implicit_casts.emplace_back(type, caster);
278
+ }
279
+ };
280
+
281
+ inline function_call::function_call(function_record &f, handle p) :
282
+ func(f), parent(p) {
283
+ args.reserve(f.nargs);
284
+ args_convert.reserve(f.nargs);
285
+ }
286
+
287
+ /// Tag for a new-style `__init__` defined in `detail/init.h`
288
+ struct is_new_style_constructor { };
289
+
290
+ /**
291
+ * Partial template specializations to process custom attributes provided to
292
+ * cpp_function_ and class_. These are either used to initialize the respective
293
+ * fields in the type_record and function_record data structures or executed at
294
+ * runtime to deal with custom call policies (e.g. keep_alive).
295
+ */
296
+ template <typename T, typename SFINAE = void> struct process_attribute;
297
+
298
+ template <typename T> struct process_attribute_default {
299
+ /// Default implementation: do nothing
300
+ static void init(const T &, function_record *) { }
301
+ static void init(const T &, type_record *) { }
302
+ static void precall(function_call &) { }
303
+ static void postcall(function_call &, handle) { }
304
+ };
305
+
306
+ /// Process an attribute specifying the function's name
307
+ template <> struct process_attribute<name> : process_attribute_default<name> {
308
+ static void init(const name &n, function_record *r) { r->name = const_cast<char *>(n.value); }
309
+ };
310
+
311
+ /// Process an attribute specifying the function's docstring
312
+ template <> struct process_attribute<doc> : process_attribute_default<doc> {
313
+ static void init(const doc &n, function_record *r) { r->doc = const_cast<char *>(n.value); }
314
+ };
315
+
316
+ /// Process an attribute specifying the function's docstring (provided as a C-style string)
317
+ template <> struct process_attribute<const char *> : process_attribute_default<const char *> {
318
+ static void init(const char *d, function_record *r) { r->doc = const_cast<char *>(d); }
319
+ static void init(const char *d, type_record *r) { r->doc = const_cast<char *>(d); }
320
+ };
321
+ template <> struct process_attribute<char *> : process_attribute<const char *> { };
322
+
323
+ /// Process an attribute indicating the function's return value policy
324
+ template <> struct process_attribute<return_value_policy> : process_attribute_default<return_value_policy> {
325
+ static void init(const return_value_policy &p, function_record *r) { r->policy = p; }
326
+ };
327
+
328
+ /// Process an attribute which indicates that this is an overloaded function associated with a given sibling
329
+ template <> struct process_attribute<sibling> : process_attribute_default<sibling> {
330
+ static void init(const sibling &s, function_record *r) { r->sibling = s.value; }
331
+ };
332
+
333
+ /// Process an attribute which indicates that this function is a method
334
+ template <> struct process_attribute<is_method> : process_attribute_default<is_method> {
335
+ static void init(const is_method &s, function_record *r) { r->is_method = true; r->scope = s.class_; }
336
+ };
337
+
338
+ /// Process an attribute which indicates the parent scope of a method
339
+ template <> struct process_attribute<scope> : process_attribute_default<scope> {
340
+ static void init(const scope &s, function_record *r) { r->scope = s.value; }
341
+ };
342
+
343
+ /// Process an attribute which indicates that this function is an operator
344
+ template <> struct process_attribute<is_operator> : process_attribute_default<is_operator> {
345
+ static void init(const is_operator &, function_record *r) { r->is_operator = true; }
346
+ };
347
+
348
+ template <> struct process_attribute<is_new_style_constructor> : process_attribute_default<is_new_style_constructor> {
349
+ static void init(const is_new_style_constructor &, function_record *r) { r->is_new_style_constructor = true; }
350
+ };
351
+
352
+ /// Process a keyword argument attribute (*without* a default value)
353
+ template <> struct process_attribute<arg> : process_attribute_default<arg> {
354
+ static void init(const arg &a, function_record *r) {
355
+ if (r->is_method && r->args.empty())
356
+ r->args.emplace_back("self", nullptr, handle(), true /*convert*/, false /*none not allowed*/);
357
+ r->args.emplace_back(a.name, nullptr, handle(), !a.flag_noconvert, a.flag_none);
358
+ }
359
+ };
360
+
361
+ /// Process a keyword argument attribute (*with* a default value)
362
+ template <> struct process_attribute<arg_v> : process_attribute_default<arg_v> {
363
+ static void init(const arg_v &a, function_record *r) {
364
+ if (r->is_method && r->args.empty())
365
+ r->args.emplace_back("self", nullptr /*descr*/, handle() /*parent*/, true /*convert*/, false /*none not allowed*/);
366
+
367
+ if (!a.value) {
368
+ #if !defined(NDEBUG)
369
+ std::string descr("'");
370
+ if (a.name) descr += std::string(a.name) + ": ";
371
+ descr += a.type + "'";
372
+ if (r->is_method) {
373
+ if (r->name)
374
+ descr += " in method '" + (std::string) str(r->scope) + "." + (std::string) r->name + "'";
375
+ else
376
+ descr += " in method of '" + (std::string) str(r->scope) + "'";
377
+ } else if (r->name) {
378
+ descr += " in function '" + (std::string) r->name + "'";
379
+ }
380
+ pybind11_fail("arg(): could not convert default argument "
381
+ + descr + " into a Python object (type not registered yet?)");
382
+ #else
383
+ pybind11_fail("arg(): could not convert default argument "
384
+ "into a Python object (type not registered yet?). "
385
+ "Compile in debug mode for more information.");
386
+ #endif
387
+ }
388
+ r->args.emplace_back(a.name, a.descr, a.value.inc_ref(), !a.flag_noconvert, a.flag_none);
389
+ }
390
+ };
391
+
392
+ /// Process a parent class attribute. Single inheritance only (class_ itself already guarantees that)
393
+ template <typename T>
394
+ struct process_attribute<T, enable_if_t<is_pyobject<T>::value>> : process_attribute_default<handle> {
395
+ static void init(const handle &h, type_record *r) { r->bases.append(h); }
396
+ };
397
+
398
+ /// Process a parent class attribute (deprecated, does not support multiple inheritance)
399
+ template <typename T>
400
+ struct process_attribute<base<T>> : process_attribute_default<base<T>> {
401
+ static void init(const base<T> &, type_record *r) { r->add_base(typeid(T), nullptr); }
402
+ };
403
+
404
+ /// Process a multiple inheritance attribute
405
+ template <>
406
+ struct process_attribute<multiple_inheritance> : process_attribute_default<multiple_inheritance> {
407
+ static void init(const multiple_inheritance &, type_record *r) { r->multiple_inheritance = true; }
408
+ };
409
+
410
+ template <>
411
+ struct process_attribute<dynamic_attr> : process_attribute_default<dynamic_attr> {
412
+ static void init(const dynamic_attr &, type_record *r) { r->dynamic_attr = true; }
413
+ };
414
+
415
+ template <>
416
+ struct process_attribute<buffer_protocol> : process_attribute_default<buffer_protocol> {
417
+ static void init(const buffer_protocol &, type_record *r) { r->buffer_protocol = true; }
418
+ };
419
+
420
+ template <>
421
+ struct process_attribute<metaclass> : process_attribute_default<metaclass> {
422
+ static void init(const metaclass &m, type_record *r) { r->metaclass = m.value; }
423
+ };
424
+
425
+ template <>
426
+ struct process_attribute<module_local> : process_attribute_default<module_local> {
427
+ static void init(const module_local &l, type_record *r) { r->module_local = l.value; }
428
+ };
429
+
430
+ /// Process an 'arithmetic' attribute for enums (does nothing here)
431
+ template <>
432
+ struct process_attribute<arithmetic> : process_attribute_default<arithmetic> {};
433
+
434
+ template <typename... Ts>
435
+ struct process_attribute<call_guard<Ts...>> : process_attribute_default<call_guard<Ts...>> { };
436
+
437
+ /**
438
+ * Process a keep_alive call policy -- invokes keep_alive_impl during the
439
+ * pre-call handler if both Nurse, Patient != 0 and use the post-call handler
440
+ * otherwise
441
+ */
442
+ template <size_t Nurse, size_t Patient> struct process_attribute<keep_alive<Nurse, Patient>> : public process_attribute_default<keep_alive<Nurse, Patient>> {
443
+ template <size_t N = Nurse, size_t P = Patient, enable_if_t<N != 0 && P != 0, int> = 0>
444
+ static void precall(function_call &call) { keep_alive_impl(Nurse, Patient, call, handle()); }
445
+ template <size_t N = Nurse, size_t P = Patient, enable_if_t<N != 0 && P != 0, int> = 0>
446
+ static void postcall(function_call &, handle) { }
447
+ template <size_t N = Nurse, size_t P = Patient, enable_if_t<N == 0 || P == 0, int> = 0>
448
+ static void precall(function_call &) { }
449
+ template <size_t N = Nurse, size_t P = Patient, enable_if_t<N == 0 || P == 0, int> = 0>
450
+ static void postcall(function_call &call, handle ret) { keep_alive_impl(Nurse, Patient, call, ret); }
451
+ };
452
+
453
+ /// Recursively iterate over variadic template arguments
454
+ template <typename... Args> struct process_attributes {
455
+ static void init(const Args&... args, function_record *r) {
456
+ int unused[] = { 0, (process_attribute<typename std::decay<Args>::type>::init(args, r), 0) ... };
457
+ ignore_unused(unused);
458
+ }
459
+ static void init(const Args&... args, type_record *r) {
460
+ int unused[] = { 0, (process_attribute<typename std::decay<Args>::type>::init(args, r), 0) ... };
461
+ ignore_unused(unused);
462
+ }
463
+ static void precall(function_call &call) {
464
+ int unused[] = { 0, (process_attribute<typename std::decay<Args>::type>::precall(call), 0) ... };
465
+ ignore_unused(unused);
466
+ }
467
+ static void postcall(function_call &call, handle fn_ret) {
468
+ int unused[] = { 0, (process_attribute<typename std::decay<Args>::type>::postcall(call, fn_ret), 0) ... };
469
+ ignore_unused(unused);
470
+ }
471
+ };
472
+
473
+ template <typename T>
474
+ using is_call_guard = is_instantiation<call_guard, T>;
475
+
476
+ /// Extract the ``type`` from the first `call_guard` in `Extras...` (or `void_type` if none found)
477
+ template <typename... Extra>
478
+ using extract_guard_t = typename exactly_one_t<is_call_guard, call_guard<>, Extra...>::type;
479
+
480
+ /// Check the number of named arguments at compile time
481
+ template <typename... Extra,
482
+ size_t named = constexpr_sum(std::is_base_of<arg, Extra>::value...),
483
+ size_t self = constexpr_sum(std::is_same<is_method, Extra>::value...)>
484
+ constexpr bool expected_num_args(size_t nargs, bool has_args, bool has_kwargs) {
485
+ return named == 0 || (self + named + has_args + has_kwargs) == nargs;
486
+ }
487
+
488
+ NAMESPACE_END(detail)
489
+ NAMESPACE_END(PYBIND11_NAMESPACE)
@@ -0,0 +1,108 @@
1
+ /*
2
+ pybind11/buffer_info.h: Python buffer object interface
3
+
4
+ Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>
5
+
6
+ All rights reserved. Use of this source code is governed by a
7
+ BSD-style license that can be found in the LICENSE file.
8
+ */
9
+
10
+ #pragma once
11
+
12
+ #include "detail/common.h"
13
+
14
+ NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
15
+
16
+ /// Information record describing a Python buffer object
17
+ struct buffer_info {
18
+ void *ptr = nullptr; // Pointer to the underlying storage
19
+ ssize_t itemsize = 0; // Size of individual items in bytes
20
+ ssize_t size = 0; // Total number of entries
21
+ std::string format; // For homogeneous buffers, this should be set to format_descriptor<T>::format()
22
+ ssize_t ndim = 0; // Number of dimensions
23
+ std::vector<ssize_t> shape; // Shape of the tensor (1 entry per dimension)
24
+ std::vector<ssize_t> strides; // Number of entries between adjacent entries (for each per dimension)
25
+
26
+ buffer_info() { }
27
+
28
+ buffer_info(void *ptr, ssize_t itemsize, const std::string &format, ssize_t ndim,
29
+ detail::any_container<ssize_t> shape_in, detail::any_container<ssize_t> strides_in)
30
+ : ptr(ptr), itemsize(itemsize), size(1), format(format), ndim(ndim),
31
+ shape(std::move(shape_in)), strides(std::move(strides_in)) {
32
+ if (ndim != (ssize_t) shape.size() || ndim != (ssize_t) strides.size())
33
+ pybind11_fail("buffer_info: ndim doesn't match shape and/or strides length");
34
+ for (size_t i = 0; i < (size_t) ndim; ++i)
35
+ size *= shape[i];
36
+ }
37
+
38
+ template <typename T>
39
+ buffer_info(T *ptr, detail::any_container<ssize_t> shape_in, detail::any_container<ssize_t> strides_in)
40
+ : buffer_info(private_ctr_tag(), ptr, sizeof(T), format_descriptor<T>::format(), static_cast<ssize_t>(shape_in->size()), std::move(shape_in), std::move(strides_in)) { }
41
+
42
+ buffer_info(void *ptr, ssize_t itemsize, const std::string &format, ssize_t size)
43
+ : buffer_info(ptr, itemsize, format, 1, {size}, {itemsize}) { }
44
+
45
+ template <typename T>
46
+ buffer_info(T *ptr, ssize_t size)
47
+ : buffer_info(ptr, sizeof(T), format_descriptor<T>::format(), size) { }
48
+
49
+ explicit buffer_info(Py_buffer *view, bool ownview = true)
50
+ : buffer_info(view->buf, view->itemsize, view->format, view->ndim,
51
+ {view->shape, view->shape + view->ndim}, {view->strides, view->strides + view->ndim}) {
52
+ this->view = view;
53
+ this->ownview = ownview;
54
+ }
55
+
56
+ buffer_info(const buffer_info &) = delete;
57
+ buffer_info& operator=(const buffer_info &) = delete;
58
+
59
+ buffer_info(buffer_info &&other) {
60
+ (*this) = std::move(other);
61
+ }
62
+
63
+ buffer_info& operator=(buffer_info &&rhs) {
64
+ ptr = rhs.ptr;
65
+ itemsize = rhs.itemsize;
66
+ size = rhs.size;
67
+ format = std::move(rhs.format);
68
+ ndim = rhs.ndim;
69
+ shape = std::move(rhs.shape);
70
+ strides = std::move(rhs.strides);
71
+ std::swap(view, rhs.view);
72
+ std::swap(ownview, rhs.ownview);
73
+ return *this;
74
+ }
75
+
76
+ ~buffer_info() {
77
+ if (view && ownview) { PyBuffer_Release(view); delete view; }
78
+ }
79
+
80
+ private:
81
+ struct private_ctr_tag { };
82
+
83
+ buffer_info(private_ctr_tag, void *ptr, ssize_t itemsize, const std::string &format, ssize_t ndim,
84
+ detail::any_container<ssize_t> &&shape_in, detail::any_container<ssize_t> &&strides_in)
85
+ : buffer_info(ptr, itemsize, format, ndim, std::move(shape_in), std::move(strides_in)) { }
86
+
87
+ Py_buffer *view = nullptr;
88
+ bool ownview = false;
89
+ };
90
+
91
+ NAMESPACE_BEGIN(detail)
92
+
93
+ template <typename T, typename SFINAE = void> struct compare_buffer_info {
94
+ static bool compare(const buffer_info& b) {
95
+ return b.format == format_descriptor<T>::format() && b.itemsize == (ssize_t) sizeof(T);
96
+ }
97
+ };
98
+
99
+ template <typename T> struct compare_buffer_info<T, detail::enable_if_t<std::is_integral<T>::value>> {
100
+ static bool compare(const buffer_info& b) {
101
+ return (size_t) b.itemsize == sizeof(T) && (b.format == format_descriptor<T>::value ||
102
+ ((sizeof(T) == sizeof(long)) && b.format == (std::is_unsigned<T>::value ? "L" : "l")) ||
103
+ ((sizeof(T) == sizeof(size_t)) && b.format == (std::is_unsigned<T>::value ? "N" : "n")));
104
+ }
105
+ };
106
+
107
+ NAMESPACE_END(detail)
108
+ NAMESPACE_END(PYBIND11_NAMESPACE)