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,185 @@
1
+ /*
2
+ pybind11/detail/descr.h: Helper type for concatenating type signatures
3
+ either at runtime (C++11) or compile time (C++14)
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 "common.h"
14
+
15
+ NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
16
+ NAMESPACE_BEGIN(detail)
17
+
18
+ /* Concatenate type signatures at compile time using C++14 */
19
+ #if defined(PYBIND11_CPP14) && !defined(_MSC_VER)
20
+ #define PYBIND11_CONSTEXPR_DESCR
21
+
22
+ template <size_t Size1, size_t Size2> class descr {
23
+ template <size_t Size1_, size_t Size2_> friend class descr;
24
+ public:
25
+ constexpr descr(char const (&text) [Size1+1], const std::type_info * const (&types)[Size2+1])
26
+ : descr(text, types,
27
+ make_index_sequence<Size1>(),
28
+ make_index_sequence<Size2>()) { }
29
+
30
+ constexpr const char *text() const { return m_text; }
31
+ constexpr const std::type_info * const * types() const { return m_types; }
32
+
33
+ template <size_t OtherSize1, size_t OtherSize2>
34
+ constexpr descr<Size1 + OtherSize1, Size2 + OtherSize2> operator+(const descr<OtherSize1, OtherSize2> &other) const {
35
+ return concat(other,
36
+ make_index_sequence<Size1>(),
37
+ make_index_sequence<Size2>(),
38
+ make_index_sequence<OtherSize1>(),
39
+ make_index_sequence<OtherSize2>());
40
+ }
41
+
42
+ protected:
43
+ template <size_t... Indices1, size_t... Indices2>
44
+ constexpr descr(
45
+ char const (&text) [Size1+1],
46
+ const std::type_info * const (&types) [Size2+1],
47
+ index_sequence<Indices1...>, index_sequence<Indices2...>)
48
+ : m_text{text[Indices1]..., '\0'},
49
+ m_types{types[Indices2]..., nullptr } {}
50
+
51
+ template <size_t OtherSize1, size_t OtherSize2, size_t... Indices1,
52
+ size_t... Indices2, size_t... OtherIndices1, size_t... OtherIndices2>
53
+ constexpr descr<Size1 + OtherSize1, Size2 + OtherSize2>
54
+ concat(const descr<OtherSize1, OtherSize2> &other,
55
+ index_sequence<Indices1...>, index_sequence<Indices2...>,
56
+ index_sequence<OtherIndices1...>, index_sequence<OtherIndices2...>) const {
57
+ return descr<Size1 + OtherSize1, Size2 + OtherSize2>(
58
+ { m_text[Indices1]..., other.m_text[OtherIndices1]..., '\0' },
59
+ { m_types[Indices2]..., other.m_types[OtherIndices2]..., nullptr }
60
+ );
61
+ }
62
+
63
+ protected:
64
+ char m_text[Size1 + 1];
65
+ const std::type_info * m_types[Size2 + 1];
66
+ };
67
+
68
+ template <size_t Size> constexpr descr<Size - 1, 0> _(char const(&text)[Size]) {
69
+ return descr<Size - 1, 0>(text, { nullptr });
70
+ }
71
+
72
+ template <size_t Rem, size_t... Digits> struct int_to_str : int_to_str<Rem/10, Rem%10, Digits...> { };
73
+ template <size_t...Digits> struct int_to_str<0, Digits...> {
74
+ static constexpr auto digits = descr<sizeof...(Digits), 0>({ ('0' + Digits)..., '\0' }, { nullptr });
75
+ };
76
+
77
+ // Ternary description (like std::conditional)
78
+ template <bool B, size_t Size1, size_t Size2>
79
+ constexpr enable_if_t<B, descr<Size1 - 1, 0>> _(char const(&text1)[Size1], char const(&)[Size2]) {
80
+ return _(text1);
81
+ }
82
+ template <bool B, size_t Size1, size_t Size2>
83
+ constexpr enable_if_t<!B, descr<Size2 - 1, 0>> _(char const(&)[Size1], char const(&text2)[Size2]) {
84
+ return _(text2);
85
+ }
86
+ template <bool B, size_t SizeA1, size_t SizeA2, size_t SizeB1, size_t SizeB2>
87
+ constexpr enable_if_t<B, descr<SizeA1, SizeA2>> _(descr<SizeA1, SizeA2> d, descr<SizeB1, SizeB2>) { return d; }
88
+ template <bool B, size_t SizeA1, size_t SizeA2, size_t SizeB1, size_t SizeB2>
89
+ constexpr enable_if_t<!B, descr<SizeB1, SizeB2>> _(descr<SizeA1, SizeA2>, descr<SizeB1, SizeB2> d) { return d; }
90
+
91
+ template <size_t Size> auto constexpr _() -> decltype(int_to_str<Size / 10, Size % 10>::digits) {
92
+ return int_to_str<Size / 10, Size % 10>::digits;
93
+ }
94
+
95
+ template <typename Type> constexpr descr<1, 1> _() {
96
+ return descr<1, 1>({ '%', '\0' }, { &typeid(Type), nullptr });
97
+ }
98
+
99
+ inline constexpr descr<0, 0> concat() { return _(""); }
100
+ template <size_t Size1, size_t Size2, typename... Args> auto constexpr concat(descr<Size1, Size2> descr) { return descr; }
101
+ template <size_t Size1, size_t Size2, typename... Args> auto constexpr concat(descr<Size1, Size2> descr, Args&&... args) { return descr + _(", ") + concat(args...); }
102
+ template <size_t Size1, size_t Size2> auto constexpr type_descr(descr<Size1, Size2> descr) { return _("{") + descr + _("}"); }
103
+
104
+ #define PYBIND11_DESCR constexpr auto
105
+
106
+ #else /* Simpler C++11 implementation based on run-time memory allocation and copying */
107
+
108
+ class descr {
109
+ public:
110
+ PYBIND11_NOINLINE descr(const char *text, const std::type_info * const * types) {
111
+ size_t nChars = len(text), nTypes = len(types);
112
+ m_text = new char[nChars];
113
+ m_types = new const std::type_info *[nTypes];
114
+ memcpy(m_text, text, nChars * sizeof(char));
115
+ memcpy(m_types, types, nTypes * sizeof(const std::type_info *));
116
+ }
117
+
118
+ PYBIND11_NOINLINE descr operator+(descr &&d2) && {
119
+ descr r;
120
+
121
+ size_t nChars1 = len(m_text), nTypes1 = len(m_types);
122
+ size_t nChars2 = len(d2.m_text), nTypes2 = len(d2.m_types);
123
+
124
+ r.m_text = new char[nChars1 + nChars2 - 1];
125
+ r.m_types = new const std::type_info *[nTypes1 + nTypes2 - 1];
126
+ memcpy(r.m_text, m_text, (nChars1-1) * sizeof(char));
127
+ memcpy(r.m_text + nChars1 - 1, d2.m_text, nChars2 * sizeof(char));
128
+ memcpy(r.m_types, m_types, (nTypes1-1) * sizeof(std::type_info *));
129
+ memcpy(r.m_types + nTypes1 - 1, d2.m_types, nTypes2 * sizeof(std::type_info *));
130
+
131
+ delete[] m_text; delete[] m_types;
132
+ delete[] d2.m_text; delete[] d2.m_types;
133
+
134
+ return r;
135
+ }
136
+
137
+ char *text() { return m_text; }
138
+ const std::type_info * * types() { return m_types; }
139
+
140
+ protected:
141
+ PYBIND11_NOINLINE descr() { }
142
+
143
+ template <typename T> static size_t len(const T *ptr) { // return length including null termination
144
+ const T *it = ptr;
145
+ while (*it++ != (T) 0)
146
+ ;
147
+ return static_cast<size_t>(it - ptr);
148
+ }
149
+
150
+ const std::type_info **m_types = nullptr;
151
+ char *m_text = nullptr;
152
+ };
153
+
154
+ /* The 'PYBIND11_NOINLINE inline' combinations below are intentional to get the desired linkage while producing as little object code as possible */
155
+
156
+ PYBIND11_NOINLINE inline descr _(const char *text) {
157
+ const std::type_info *types[1] = { nullptr };
158
+ return descr(text, types);
159
+ }
160
+
161
+ template <bool B> PYBIND11_NOINLINE enable_if_t<B, descr> _(const char *text1, const char *) { return _(text1); }
162
+ template <bool B> PYBIND11_NOINLINE enable_if_t<!B, descr> _(char const *, const char *text2) { return _(text2); }
163
+ template <bool B> PYBIND11_NOINLINE enable_if_t<B, descr> _(descr d, descr) { return d; }
164
+ template <bool B> PYBIND11_NOINLINE enable_if_t<!B, descr> _(descr, descr d) { return d; }
165
+
166
+ template <typename Type> PYBIND11_NOINLINE descr _() {
167
+ const std::type_info *types[2] = { &typeid(Type), nullptr };
168
+ return descr("%", types);
169
+ }
170
+
171
+ template <size_t Size> PYBIND11_NOINLINE descr _() {
172
+ const std::type_info *types[1] = { nullptr };
173
+ return descr(std::to_string(Size).c_str(), types);
174
+ }
175
+
176
+ PYBIND11_NOINLINE inline descr concat() { return _(""); }
177
+ PYBIND11_NOINLINE inline descr concat(descr &&d) { return d; }
178
+ template <typename... Args> PYBIND11_NOINLINE descr concat(descr &&d, Args&&... args) { return std::move(d) + _(", ") + concat(std::forward<Args>(args)...); }
179
+ PYBIND11_NOINLINE inline descr type_descr(descr&& d) { return _("{") + std::move(d) + _("}"); }
180
+
181
+ #define PYBIND11_DESCR ::pybind11::detail::descr
182
+ #endif
183
+
184
+ NAMESPACE_END(detail)
185
+ NAMESPACE_END(PYBIND11_NAMESPACE)
@@ -0,0 +1,335 @@
1
+ /*
2
+ pybind11/detail/init.h: init factory function implementation and support code.
3
+
4
+ Copyright (c) 2017 Jason Rhinelander <jason@imaginary.ca>
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 "class.h"
13
+
14
+ NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
15
+ NAMESPACE_BEGIN(detail)
16
+
17
+ template <>
18
+ class type_caster<value_and_holder> {
19
+ public:
20
+ bool load(handle h, bool) {
21
+ value = reinterpret_cast<value_and_holder *>(h.ptr());
22
+ return true;
23
+ }
24
+
25
+ template <typename> using cast_op_type = value_and_holder &;
26
+ operator value_and_holder &() { return *value; }
27
+ static PYBIND11_DESCR name() { return type_descr(_<value_and_holder>()); }
28
+
29
+ private:
30
+ value_and_holder *value = nullptr;
31
+ };
32
+
33
+ NAMESPACE_BEGIN(initimpl)
34
+
35
+ inline void no_nullptr(void *ptr) {
36
+ if (!ptr) throw type_error("pybind11::init(): factory function returned nullptr");
37
+ }
38
+
39
+ // Implementing functions for all forms of py::init<...> and py::init(...)
40
+ template <typename Class> using Cpp = typename Class::type;
41
+ template <typename Class> using Alias = typename Class::type_alias;
42
+ template <typename Class> using Holder = typename Class::holder_type;
43
+
44
+ template <typename Class> using is_alias_constructible = std::is_constructible<Alias<Class>, Cpp<Class> &&>;
45
+
46
+ // Takes a Cpp pointer and returns true if it actually is a polymorphic Alias instance.
47
+ template <typename Class, enable_if_t<Class::has_alias, int> = 0>
48
+ bool is_alias(Cpp<Class> *ptr) {
49
+ return dynamic_cast<Alias<Class> *>(ptr) != nullptr;
50
+ }
51
+ // Failing fallback version of the above for a no-alias class (always returns false)
52
+ template <typename /*Class*/>
53
+ constexpr bool is_alias(void *) { return false; }
54
+
55
+ // Constructs and returns a new object; if the given arguments don't map to a constructor, we fall
56
+ // back to brace aggregate initiailization so that for aggregate initialization can be used with
57
+ // py::init, e.g. `py::init<int, int>` to initialize a `struct T { int a; int b; }`. For
58
+ // non-aggregate types, we need to use an ordinary T(...) constructor (invoking as `T{...}` usually
59
+ // works, but will not do the expected thing when `T` has an `initializer_list<T>` constructor).
60
+ template <typename Class, typename... Args, detail::enable_if_t<std::is_constructible<Class, Args...>::value, int> = 0>
61
+ inline Class *construct_or_initialize(Args &&...args) { return new Class(std::forward<Args>(args)...); }
62
+ template <typename Class, typename... Args, detail::enable_if_t<!std::is_constructible<Class, Args...>::value, int> = 0>
63
+ inline Class *construct_or_initialize(Args &&...args) { return new Class{std::forward<Args>(args)...}; }
64
+
65
+ // Attempts to constructs an alias using a `Alias(Cpp &&)` constructor. This allows types with
66
+ // an alias to provide only a single Cpp factory function as long as the Alias can be
67
+ // constructed from an rvalue reference of the base Cpp type. This means that Alias classes
68
+ // can, when appropriate, simply define a `Alias(Cpp &&)` constructor rather than needing to
69
+ // inherit all the base class constructors.
70
+ template <typename Class>
71
+ void construct_alias_from_cpp(std::true_type /*is_alias_constructible*/,
72
+ value_and_holder &v_h, Cpp<Class> &&base) {
73
+ v_h.value_ptr() = new Alias<Class>(std::move(base));
74
+ }
75
+ template <typename Class>
76
+ [[noreturn]] void construct_alias_from_cpp(std::false_type /*!is_alias_constructible*/,
77
+ value_and_holder &, Cpp<Class> &&) {
78
+ throw type_error("pybind11::init(): unable to convert returned instance to required "
79
+ "alias class: no `Alias<Class>(Class &&)` constructor available");
80
+ }
81
+
82
+ // Error-generating fallback for factories that don't match one of the below construction
83
+ // mechanisms.
84
+ template <typename Class>
85
+ void construct(...) {
86
+ static_assert(!std::is_same<Class, Class>::value /* always false */,
87
+ "pybind11::init(): init function must return a compatible pointer, "
88
+ "holder, or value");
89
+ }
90
+
91
+ // Pointer return v1: the factory function returns a class pointer for a registered class.
92
+ // If we don't need an alias (because this class doesn't have one, or because the final type is
93
+ // inherited on the Python side) we can simply take over ownership. Otherwise we need to try to
94
+ // construct an Alias from the returned base instance.
95
+ template <typename Class>
96
+ void construct(value_and_holder &v_h, Cpp<Class> *ptr, bool need_alias) {
97
+ no_nullptr(ptr);
98
+ if (Class::has_alias && need_alias && !is_alias<Class>(ptr)) {
99
+ // We're going to try to construct an alias by moving the cpp type. Whether or not
100
+ // that succeeds, we still need to destroy the original cpp pointer (either the
101
+ // moved away leftover, if the alias construction works, or the value itself if we
102
+ // throw an error), but we can't just call `delete ptr`: it might have a special
103
+ // deleter, or might be shared_from_this. So we construct a holder around it as if
104
+ // it was a normal instance, then steal the holder away into a local variable; thus
105
+ // the holder and destruction happens when we leave the C++ scope, and the holder
106
+ // class gets to handle the destruction however it likes.
107
+ v_h.value_ptr() = ptr;
108
+ v_h.set_instance_registered(true); // To prevent init_instance from registering it
109
+ v_h.type->init_instance(v_h.inst, nullptr); // Set up the holder
110
+ Holder<Class> temp_holder(std::move(v_h.holder<Holder<Class>>())); // Steal the holder
111
+ v_h.type->dealloc(v_h); // Destroys the moved-out holder remains, resets value ptr to null
112
+ v_h.set_instance_registered(false);
113
+
114
+ construct_alias_from_cpp<Class>(is_alias_constructible<Class>{}, v_h, std::move(*ptr));
115
+ } else {
116
+ // Otherwise the type isn't inherited, so we don't need an Alias
117
+ v_h.value_ptr() = ptr;
118
+ }
119
+ }
120
+
121
+ // Pointer return v2: a factory that always returns an alias instance ptr. We simply take over
122
+ // ownership of the pointer.
123
+ template <typename Class, enable_if_t<Class::has_alias, int> = 0>
124
+ void construct(value_and_holder &v_h, Alias<Class> *alias_ptr, bool) {
125
+ no_nullptr(alias_ptr);
126
+ v_h.value_ptr() = static_cast<Cpp<Class> *>(alias_ptr);
127
+ }
128
+
129
+ // Holder return: copy its pointer, and move or copy the returned holder into the new instance's
130
+ // holder. This also handles types like std::shared_ptr<T> and std::unique_ptr<T> where T is a
131
+ // derived type (through those holder's implicit conversion from derived class holder constructors).
132
+ template <typename Class>
133
+ void construct(value_and_holder &v_h, Holder<Class> holder, bool need_alias) {
134
+ auto *ptr = holder_helper<Holder<Class>>::get(holder);
135
+ // If we need an alias, check that the held pointer is actually an alias instance
136
+ if (Class::has_alias && need_alias && !is_alias<Class>(ptr))
137
+ throw type_error("pybind11::init(): construction failed: returned holder-wrapped instance "
138
+ "is not an alias instance");
139
+
140
+ v_h.value_ptr() = ptr;
141
+ v_h.type->init_instance(v_h.inst, &holder);
142
+ }
143
+
144
+ // return-by-value version 1: returning a cpp class by value. If the class has an alias and an
145
+ // alias is required the alias must have an `Alias(Cpp &&)` constructor so that we can construct
146
+ // the alias from the base when needed (i.e. because of Python-side inheritance). When we don't
147
+ // need it, we simply move-construct the cpp value into a new instance.
148
+ template <typename Class>
149
+ void construct(value_and_holder &v_h, Cpp<Class> &&result, bool need_alias) {
150
+ static_assert(std::is_move_constructible<Cpp<Class>>::value,
151
+ "pybind11::init() return-by-value factory function requires a movable class");
152
+ if (Class::has_alias && need_alias)
153
+ construct_alias_from_cpp<Class>(is_alias_constructible<Class>{}, v_h, std::move(result));
154
+ else
155
+ v_h.value_ptr() = new Cpp<Class>(std::move(result));
156
+ }
157
+
158
+ // return-by-value version 2: returning a value of the alias type itself. We move-construct an
159
+ // Alias instance (even if no the python-side inheritance is involved). The is intended for
160
+ // cases where Alias initialization is always desired.
161
+ template <typename Class>
162
+ void construct(value_and_holder &v_h, Alias<Class> &&result, bool) {
163
+ static_assert(std::is_move_constructible<Alias<Class>>::value,
164
+ "pybind11::init() return-by-alias-value factory function requires a movable alias class");
165
+ v_h.value_ptr() = new Alias<Class>(std::move(result));
166
+ }
167
+
168
+ // Implementing class for py::init<...>()
169
+ template <typename... Args>
170
+ struct constructor {
171
+ template <typename Class, typename... Extra, enable_if_t<!Class::has_alias, int> = 0>
172
+ static void execute(Class &cl, const Extra&... extra) {
173
+ cl.def("__init__", [](value_and_holder &v_h, Args... args) {
174
+ v_h.value_ptr() = construct_or_initialize<Cpp<Class>>(std::forward<Args>(args)...);
175
+ }, is_new_style_constructor(), extra...);
176
+ }
177
+
178
+ template <typename Class, typename... Extra,
179
+ enable_if_t<Class::has_alias &&
180
+ std::is_constructible<Cpp<Class>, Args...>::value, int> = 0>
181
+ static void execute(Class &cl, const Extra&... extra) {
182
+ cl.def("__init__", [](value_and_holder &v_h, Args... args) {
183
+ if (Py_TYPE(v_h.inst) == v_h.type->type)
184
+ v_h.value_ptr() = construct_or_initialize<Cpp<Class>>(std::forward<Args>(args)...);
185
+ else
186
+ v_h.value_ptr() = construct_or_initialize<Alias<Class>>(std::forward<Args>(args)...);
187
+ }, is_new_style_constructor(), extra...);
188
+ }
189
+
190
+ template <typename Class, typename... Extra,
191
+ enable_if_t<Class::has_alias &&
192
+ !std::is_constructible<Cpp<Class>, Args...>::value, int> = 0>
193
+ static void execute(Class &cl, const Extra&... extra) {
194
+ cl.def("__init__", [](value_and_holder &v_h, Args... args) {
195
+ v_h.value_ptr() = construct_or_initialize<Alias<Class>>(std::forward<Args>(args)...);
196
+ }, is_new_style_constructor(), extra...);
197
+ }
198
+ };
199
+
200
+ // Implementing class for py::init_alias<...>()
201
+ template <typename... Args> struct alias_constructor {
202
+ template <typename Class, typename... Extra,
203
+ enable_if_t<Class::has_alias && std::is_constructible<Alias<Class>, Args...>::value, int> = 0>
204
+ static void execute(Class &cl, const Extra&... extra) {
205
+ cl.def("__init__", [](value_and_holder &v_h, Args... args) {
206
+ v_h.value_ptr() = construct_or_initialize<Alias<Class>>(std::forward<Args>(args)...);
207
+ }, is_new_style_constructor(), extra...);
208
+ }
209
+ };
210
+
211
+ // Implementation class for py::init(Func) and py::init(Func, AliasFunc)
212
+ template <typename CFunc, typename AFunc = void_type (*)(),
213
+ typename = function_signature_t<CFunc>, typename = function_signature_t<AFunc>>
214
+ struct factory;
215
+
216
+ // Specialization for py::init(Func)
217
+ template <typename Func, typename Return, typename... Args>
218
+ struct factory<Func, void_type (*)(), Return(Args...)> {
219
+ remove_reference_t<Func> class_factory;
220
+
221
+ factory(Func &&f) : class_factory(std::forward<Func>(f)) { }
222
+
223
+ // The given class either has no alias or has no separate alias factory;
224
+ // this always constructs the class itself. If the class is registered with an alias
225
+ // type and an alias instance is needed (i.e. because the final type is a Python class
226
+ // inheriting from the C++ type) the returned value needs to either already be an alias
227
+ // instance, or the alias needs to be constructible from a `Class &&` argument.
228
+ template <typename Class, typename... Extra>
229
+ void execute(Class &cl, const Extra &...extra) && {
230
+ #if defined(PYBIND11_CPP14)
231
+ cl.def("__init__", [func = std::move(class_factory)]
232
+ #else
233
+ auto &func = class_factory;
234
+ cl.def("__init__", [func]
235
+ #endif
236
+ (value_and_holder &v_h, Args... args) {
237
+ construct<Class>(v_h, func(std::forward<Args>(args)...),
238
+ Py_TYPE(v_h.inst) != v_h.type->type);
239
+ }, is_new_style_constructor(), extra...);
240
+ }
241
+ };
242
+
243
+ // Specialization for py::init(Func, AliasFunc)
244
+ template <typename CFunc, typename AFunc,
245
+ typename CReturn, typename... CArgs, typename AReturn, typename... AArgs>
246
+ struct factory<CFunc, AFunc, CReturn(CArgs...), AReturn(AArgs...)> {
247
+ static_assert(sizeof...(CArgs) == sizeof...(AArgs),
248
+ "pybind11::init(class_factory, alias_factory): class and alias factories "
249
+ "must have identical argument signatures");
250
+ static_assert(all_of<std::is_same<CArgs, AArgs>...>::value,
251
+ "pybind11::init(class_factory, alias_factory): class and alias factories "
252
+ "must have identical argument signatures");
253
+
254
+ remove_reference_t<CFunc> class_factory;
255
+ remove_reference_t<AFunc> alias_factory;
256
+
257
+ factory(CFunc &&c, AFunc &&a)
258
+ : class_factory(std::forward<CFunc>(c)), alias_factory(std::forward<AFunc>(a)) { }
259
+
260
+ // The class factory is called when the `self` type passed to `__init__` is the direct
261
+ // class (i.e. not inherited), the alias factory when `self` is a Python-side subtype.
262
+ template <typename Class, typename... Extra>
263
+ void execute(Class &cl, const Extra&... extra) && {
264
+ static_assert(Class::has_alias, "The two-argument version of `py::init()` can "
265
+ "only be used if the class has an alias");
266
+ #if defined(PYBIND11_CPP14)
267
+ cl.def("__init__", [class_func = std::move(class_factory), alias_func = std::move(alias_factory)]
268
+ #else
269
+ auto &class_func = class_factory;
270
+ auto &alias_func = alias_factory;
271
+ cl.def("__init__", [class_func, alias_func]
272
+ #endif
273
+ (value_and_holder &v_h, CArgs... args) {
274
+ if (Py_TYPE(v_h.inst) == v_h.type->type)
275
+ // If the instance type equals the registered type we don't have inheritance, so
276
+ // don't need the alias and can construct using the class function:
277
+ construct<Class>(v_h, class_func(std::forward<CArgs>(args)...), false);
278
+ else
279
+ construct<Class>(v_h, alias_func(std::forward<CArgs>(args)...), true);
280
+ }, is_new_style_constructor(), extra...);
281
+ }
282
+ };
283
+
284
+ /// Set just the C++ state. Same as `__init__`.
285
+ template <typename Class, typename T>
286
+ void setstate(value_and_holder &v_h, T &&result, bool need_alias) {
287
+ construct<Class>(v_h, std::forward<T>(result), need_alias);
288
+ }
289
+
290
+ /// Set both the C++ and Python states
291
+ template <typename Class, typename T, typename O,
292
+ enable_if_t<std::is_convertible<O, handle>::value, int> = 0>
293
+ void setstate(value_and_holder &v_h, std::pair<T, O> &&result, bool need_alias) {
294
+ construct<Class>(v_h, std::move(result.first), need_alias);
295
+ setattr((PyObject *) v_h.inst, "__dict__", result.second);
296
+ }
297
+
298
+ /// Implementation for py::pickle(GetState, SetState)
299
+ template <typename Get, typename Set,
300
+ typename = function_signature_t<Get>, typename = function_signature_t<Set>>
301
+ struct pickle_factory;
302
+
303
+ template <typename Get, typename Set,
304
+ typename RetState, typename Self, typename NewInstance, typename ArgState>
305
+ struct pickle_factory<Get, Set, RetState(Self), NewInstance(ArgState)> {
306
+ static_assert(std::is_same<intrinsic_t<RetState>, intrinsic_t<ArgState>>::value,
307
+ "The type returned by `__getstate__` must be the same "
308
+ "as the argument accepted by `__setstate__`");
309
+
310
+ remove_reference_t<Get> get;
311
+ remove_reference_t<Set> set;
312
+
313
+ pickle_factory(Get get, Set set)
314
+ : get(std::forward<Get>(get)), set(std::forward<Set>(set)) { }
315
+
316
+ template <typename Class, typename... Extra>
317
+ void execute(Class &cl, const Extra &...extra) && {
318
+ cl.def("__getstate__", std::move(get));
319
+
320
+ #if defined(PYBIND11_CPP14)
321
+ cl.def("__setstate__", [func = std::move(set)]
322
+ #else
323
+ auto &func = set;
324
+ cl.def("__setstate__", [func]
325
+ #endif
326
+ (value_and_holder &v_h, ArgState state) {
327
+ setstate<Class>(v_h, func(std::forward<ArgState>(state)),
328
+ Py_TYPE(v_h.inst) != v_h.type->type);
329
+ }, is_new_style_constructor(), extra...);
330
+ }
331
+ };
332
+
333
+ NAMESPACE_END(initimpl)
334
+ NAMESPACE_END(detail)
335
+ NAMESPACE_END(pybind11)