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,171 @@
1
+ /*
2
+ pybind11/detail/descr.h: Helper type for concatenating type signatures at compile time
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 "common.h"
13
+
14
+ PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
15
+ PYBIND11_NAMESPACE_BEGIN(detail)
16
+
17
+ #if !defined(_MSC_VER)
18
+ # define PYBIND11_DESCR_CONSTEXPR static constexpr
19
+ #else
20
+ # define PYBIND11_DESCR_CONSTEXPR const
21
+ #endif
22
+
23
+ /* Concatenate type signatures at compile time */
24
+ template <size_t N, typename... Ts>
25
+ struct descr {
26
+ char text[N + 1]{'\0'};
27
+
28
+ constexpr descr() = default;
29
+ // NOLINTNEXTLINE(google-explicit-constructor)
30
+ constexpr descr(char const (&s)[N + 1]) : descr(s, make_index_sequence<N>()) {}
31
+
32
+ template <size_t... Is>
33
+ constexpr descr(char const (&s)[N + 1], index_sequence<Is...>) : text{s[Is]..., '\0'} {}
34
+
35
+ template <typename... Chars>
36
+ // NOLINTNEXTLINE(google-explicit-constructor)
37
+ constexpr descr(char c, Chars... cs) : text{c, static_cast<char>(cs)..., '\0'} {}
38
+
39
+ static constexpr std::array<const std::type_info *, sizeof...(Ts) + 1> types() {
40
+ return {{&typeid(Ts)..., nullptr}};
41
+ }
42
+ };
43
+
44
+ template <size_t N1, size_t N2, typename... Ts1, typename... Ts2, size_t... Is1, size_t... Is2>
45
+ constexpr descr<N1 + N2, Ts1..., Ts2...> plus_impl(const descr<N1, Ts1...> &a,
46
+ const descr<N2, Ts2...> &b,
47
+ index_sequence<Is1...>,
48
+ index_sequence<Is2...>) {
49
+ PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(b);
50
+ return {a.text[Is1]..., b.text[Is2]...};
51
+ }
52
+
53
+ template <size_t N1, size_t N2, typename... Ts1, typename... Ts2>
54
+ constexpr descr<N1 + N2, Ts1..., Ts2...> operator+(const descr<N1, Ts1...> &a,
55
+ const descr<N2, Ts2...> &b) {
56
+ return plus_impl(a, b, make_index_sequence<N1>(), make_index_sequence<N2>());
57
+ }
58
+
59
+ template <size_t N>
60
+ constexpr descr<N - 1> const_name(char const (&text)[N]) {
61
+ return descr<N - 1>(text);
62
+ }
63
+ constexpr descr<0> const_name(char const (&)[1]) { return {}; }
64
+
65
+ template <size_t Rem, size_t... Digits>
66
+ struct int_to_str : int_to_str<Rem / 10, Rem % 10, Digits...> {};
67
+ template <size_t... Digits>
68
+ struct int_to_str<0, Digits...> {
69
+ // WARNING: This only works with C++17 or higher.
70
+ static constexpr auto digits = descr<sizeof...(Digits)>(('0' + Digits)...);
71
+ };
72
+
73
+ // Ternary description (like std::conditional)
74
+ template <bool B, size_t N1, size_t N2>
75
+ constexpr enable_if_t<B, descr<N1 - 1>> const_name(char const (&text1)[N1], char const (&)[N2]) {
76
+ return const_name(text1);
77
+ }
78
+ template <bool B, size_t N1, size_t N2>
79
+ constexpr enable_if_t<!B, descr<N2 - 1>> const_name(char const (&)[N1], char const (&text2)[N2]) {
80
+ return const_name(text2);
81
+ }
82
+
83
+ template <bool B, typename T1, typename T2>
84
+ constexpr enable_if_t<B, T1> const_name(const T1 &d, const T2 &) {
85
+ return d;
86
+ }
87
+ template <bool B, typename T1, typename T2>
88
+ constexpr enable_if_t<!B, T2> const_name(const T1 &, const T2 &d) {
89
+ return d;
90
+ }
91
+
92
+ template <size_t Size>
93
+ auto constexpr const_name() -> remove_cv_t<decltype(int_to_str<Size / 10, Size % 10>::digits)> {
94
+ return int_to_str<Size / 10, Size % 10>::digits;
95
+ }
96
+
97
+ template <typename Type>
98
+ constexpr descr<1, Type> const_name() {
99
+ return {'%'};
100
+ }
101
+
102
+ // If "_" is defined as a macro, py::detail::_ cannot be provided.
103
+ // It is therefore best to use py::detail::const_name universally.
104
+ // This block is for backward compatibility only.
105
+ // (The const_name code is repeated to avoid introducing a "_" #define ourselves.)
106
+ #ifndef _
107
+ # define PYBIND11_DETAIL_UNDERSCORE_BACKWARD_COMPATIBILITY
108
+ template <size_t N>
109
+ constexpr descr<N - 1> _(char const (&text)[N]) {
110
+ return const_name<N>(text);
111
+ }
112
+ template <bool B, size_t N1, size_t N2>
113
+ constexpr enable_if_t<B, descr<N1 - 1>> _(char const (&text1)[N1], char const (&text2)[N2]) {
114
+ return const_name<B, N1, N2>(text1, text2);
115
+ }
116
+ template <bool B, size_t N1, size_t N2>
117
+ constexpr enable_if_t<!B, descr<N2 - 1>> _(char const (&text1)[N1], char const (&text2)[N2]) {
118
+ return const_name<B, N1, N2>(text1, text2);
119
+ }
120
+ template <bool B, typename T1, typename T2>
121
+ constexpr enable_if_t<B, T1> _(const T1 &d1, const T2 &d2) {
122
+ return const_name<B, T1, T2>(d1, d2);
123
+ }
124
+ template <bool B, typename T1, typename T2>
125
+ constexpr enable_if_t<!B, T2> _(const T1 &d1, const T2 &d2) {
126
+ return const_name<B, T1, T2>(d1, d2);
127
+ }
128
+
129
+ template <size_t Size>
130
+ auto constexpr _() -> remove_cv_t<decltype(int_to_str<Size / 10, Size % 10>::digits)> {
131
+ return const_name<Size>();
132
+ }
133
+ template <typename Type>
134
+ constexpr descr<1, Type> _() {
135
+ return const_name<Type>();
136
+ }
137
+ #endif // #ifndef _
138
+
139
+ constexpr descr<0> concat() { return {}; }
140
+
141
+ template <size_t N, typename... Ts>
142
+ constexpr descr<N, Ts...> concat(const descr<N, Ts...> &descr) {
143
+ return descr;
144
+ }
145
+
146
+ #ifdef __cpp_fold_expressions
147
+ template <size_t N1, size_t N2, typename... Ts1, typename... Ts2>
148
+ constexpr descr<N1 + N2 + 2, Ts1..., Ts2...> operator,(const descr<N1, Ts1...> &a,
149
+ const descr<N2, Ts2...> &b) {
150
+ return a + const_name(", ") + b;
151
+ }
152
+
153
+ template <size_t N, typename... Ts, typename... Args>
154
+ constexpr auto concat(const descr<N, Ts...> &d, const Args &...args) {
155
+ return (d, ..., args);
156
+ }
157
+ #else
158
+ template <size_t N, typename... Ts, typename... Args>
159
+ constexpr auto concat(const descr<N, Ts...> &d, const Args &...args)
160
+ -> decltype(std::declval<descr<N + 2, Ts...>>() + concat(args...)) {
161
+ return d + const_name(", ") + concat(args...);
162
+ }
163
+ #endif
164
+
165
+ template <size_t N, typename... Ts>
166
+ constexpr descr<N + 2, Ts...> type_descr(const descr<N, Ts...> &descr) {
167
+ return const_name("{") + descr + const_name("}");
168
+ }
169
+
170
+ PYBIND11_NAMESPACE_END(detail)
171
+ PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
@@ -0,0 +1,434 @@
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
+ PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
15
+
16
+ PYBIND11_WARNING_DISABLE_MSVC(4127)
17
+
18
+ PYBIND11_NAMESPACE_BEGIN(detail)
19
+
20
+ template <>
21
+ class type_caster<value_and_holder> {
22
+ public:
23
+ bool load(handle h, bool) {
24
+ value = reinterpret_cast<value_and_holder *>(h.ptr());
25
+ return true;
26
+ }
27
+
28
+ template <typename>
29
+ using cast_op_type = value_and_holder &;
30
+ explicit operator value_and_holder &() { return *value; }
31
+ static constexpr auto name = const_name<value_and_holder>();
32
+
33
+ private:
34
+ value_and_holder *value = nullptr;
35
+ };
36
+
37
+ PYBIND11_NAMESPACE_BEGIN(initimpl)
38
+
39
+ inline void no_nullptr(void *ptr) {
40
+ if (!ptr) {
41
+ throw type_error("pybind11::init(): factory function returned nullptr");
42
+ }
43
+ }
44
+
45
+ // Implementing functions for all forms of py::init<...> and py::init(...)
46
+ template <typename Class>
47
+ using Cpp = typename Class::type;
48
+ template <typename Class>
49
+ using Alias = typename Class::type_alias;
50
+ template <typename Class>
51
+ using Holder = typename Class::holder_type;
52
+
53
+ template <typename Class>
54
+ using is_alias_constructible = std::is_constructible<Alias<Class>, Cpp<Class> &&>;
55
+
56
+ // Takes a Cpp pointer and returns true if it actually is a polymorphic Alias instance.
57
+ template <typename Class, enable_if_t<Class::has_alias, int> = 0>
58
+ bool is_alias(Cpp<Class> *ptr) {
59
+ return dynamic_cast<Alias<Class> *>(ptr) != nullptr;
60
+ }
61
+ // Failing fallback version of the above for a no-alias class (always returns false)
62
+ template <typename /*Class*/>
63
+ constexpr bool is_alias(void *) {
64
+ return false;
65
+ }
66
+
67
+ // Constructs and returns a new object; if the given arguments don't map to a constructor, we fall
68
+ // back to brace aggregate initiailization so that for aggregate initialization can be used with
69
+ // py::init, e.g. `py::init<int, int>` to initialize a `struct T { int a; int b; }`. For
70
+ // non-aggregate types, we need to use an ordinary T(...) constructor (invoking as `T{...}` usually
71
+ // works, but will not do the expected thing when `T` has an `initializer_list<T>` constructor).
72
+ template <typename Class,
73
+ typename... Args,
74
+ detail::enable_if_t<std::is_constructible<Class, Args...>::value, int> = 0>
75
+ inline Class *construct_or_initialize(Args &&...args) {
76
+ return new Class(std::forward<Args>(args)...);
77
+ }
78
+ template <typename Class,
79
+ typename... Args,
80
+ detail::enable_if_t<!std::is_constructible<Class, Args...>::value, int> = 0>
81
+ inline Class *construct_or_initialize(Args &&...args) {
82
+ return new Class{std::forward<Args>(args)...};
83
+ }
84
+
85
+ // Attempts to constructs an alias using a `Alias(Cpp &&)` constructor. This allows types with
86
+ // an alias to provide only a single Cpp factory function as long as the Alias can be
87
+ // constructed from an rvalue reference of the base Cpp type. This means that Alias classes
88
+ // can, when appropriate, simply define a `Alias(Cpp &&)` constructor rather than needing to
89
+ // inherit all the base class constructors.
90
+ template <typename Class>
91
+ void construct_alias_from_cpp(std::true_type /*is_alias_constructible*/,
92
+ value_and_holder &v_h,
93
+ Cpp<Class> &&base) {
94
+ v_h.value_ptr() = new Alias<Class>(std::move(base));
95
+ }
96
+ template <typename Class>
97
+ [[noreturn]] void construct_alias_from_cpp(std::false_type /*!is_alias_constructible*/,
98
+ value_and_holder &,
99
+ Cpp<Class> &&) {
100
+ throw type_error("pybind11::init(): unable to convert returned instance to required "
101
+ "alias class: no `Alias<Class>(Class &&)` constructor available");
102
+ }
103
+
104
+ // Error-generating fallback for factories that don't match one of the below construction
105
+ // mechanisms.
106
+ template <typename Class>
107
+ void construct(...) {
108
+ static_assert(!std::is_same<Class, Class>::value /* always false */,
109
+ "pybind11::init(): init function must return a compatible pointer, "
110
+ "holder, or value");
111
+ }
112
+
113
+ // Pointer return v1: the factory function returns a class pointer for a registered class.
114
+ // If we don't need an alias (because this class doesn't have one, or because the final type is
115
+ // inherited on the Python side) we can simply take over ownership. Otherwise we need to try to
116
+ // construct an Alias from the returned base instance.
117
+ template <typename Class>
118
+ void construct(value_and_holder &v_h, Cpp<Class> *ptr, bool need_alias) {
119
+ PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(need_alias);
120
+ no_nullptr(ptr);
121
+ if (Class::has_alias && need_alias && !is_alias<Class>(ptr)) {
122
+ // We're going to try to construct an alias by moving the cpp type. Whether or not
123
+ // that succeeds, we still need to destroy the original cpp pointer (either the
124
+ // moved away leftover, if the alias construction works, or the value itself if we
125
+ // throw an error), but we can't just call `delete ptr`: it might have a special
126
+ // deleter, or might be shared_from_this. So we construct a holder around it as if
127
+ // it was a normal instance, then steal the holder away into a local variable; thus
128
+ // the holder and destruction happens when we leave the C++ scope, and the holder
129
+ // class gets to handle the destruction however it likes.
130
+ v_h.value_ptr() = ptr;
131
+ v_h.set_instance_registered(true); // To prevent init_instance from registering it
132
+ v_h.type->init_instance(v_h.inst, nullptr); // Set up the holder
133
+ Holder<Class> temp_holder(std::move(v_h.holder<Holder<Class>>())); // Steal the holder
134
+ v_h.type->dealloc(v_h); // Destroys the moved-out holder remains, resets value ptr to null
135
+ v_h.set_instance_registered(false);
136
+
137
+ construct_alias_from_cpp<Class>(is_alias_constructible<Class>{}, v_h, std::move(*ptr));
138
+ } else {
139
+ // Otherwise the type isn't inherited, so we don't need an Alias
140
+ v_h.value_ptr() = ptr;
141
+ }
142
+ }
143
+
144
+ // Pointer return v2: a factory that always returns an alias instance ptr. We simply take over
145
+ // ownership of the pointer.
146
+ template <typename Class, enable_if_t<Class::has_alias, int> = 0>
147
+ void construct(value_and_holder &v_h, Alias<Class> *alias_ptr, bool) {
148
+ no_nullptr(alias_ptr);
149
+ v_h.value_ptr() = static_cast<Cpp<Class> *>(alias_ptr);
150
+ }
151
+
152
+ // Holder return: copy its pointer, and move or copy the returned holder into the new instance's
153
+ // holder. This also handles types like std::shared_ptr<T> and std::unique_ptr<T> where T is a
154
+ // derived type (through those holder's implicit conversion from derived class holder
155
+ // constructors).
156
+ template <typename Class>
157
+ void construct(value_and_holder &v_h, Holder<Class> holder, bool need_alias) {
158
+ PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(need_alias);
159
+ auto *ptr = holder_helper<Holder<Class>>::get(holder);
160
+ no_nullptr(ptr);
161
+ // If we need an alias, check that the held pointer is actually an alias instance
162
+ if (Class::has_alias && need_alias && !is_alias<Class>(ptr)) {
163
+ throw type_error("pybind11::init(): construction failed: returned holder-wrapped instance "
164
+ "is not an alias instance");
165
+ }
166
+
167
+ v_h.value_ptr() = ptr;
168
+ v_h.type->init_instance(v_h.inst, &holder);
169
+ }
170
+
171
+ // return-by-value version 1: returning a cpp class by value. If the class has an alias and an
172
+ // alias is required the alias must have an `Alias(Cpp &&)` constructor so that we can construct
173
+ // the alias from the base when needed (i.e. because of Python-side inheritance). When we don't
174
+ // need it, we simply move-construct the cpp value into a new instance.
175
+ template <typename Class>
176
+ void construct(value_and_holder &v_h, Cpp<Class> &&result, bool need_alias) {
177
+ PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(need_alias);
178
+ static_assert(is_move_constructible<Cpp<Class>>::value,
179
+ "pybind11::init() return-by-value factory function requires a movable class");
180
+ if (Class::has_alias && need_alias) {
181
+ construct_alias_from_cpp<Class>(is_alias_constructible<Class>{}, v_h, std::move(result));
182
+ } else {
183
+ v_h.value_ptr() = new Cpp<Class>(std::move(result));
184
+ }
185
+ }
186
+
187
+ // return-by-value version 2: returning a value of the alias type itself. We move-construct an
188
+ // Alias instance (even if no the python-side inheritance is involved). The is intended for
189
+ // cases where Alias initialization is always desired.
190
+ template <typename Class>
191
+ void construct(value_and_holder &v_h, Alias<Class> &&result, bool) {
192
+ static_assert(
193
+ is_move_constructible<Alias<Class>>::value,
194
+ "pybind11::init() return-by-alias-value factory function requires a movable alias class");
195
+ v_h.value_ptr() = new Alias<Class>(std::move(result));
196
+ }
197
+
198
+ // Implementing class for py::init<...>()
199
+ template <typename... Args>
200
+ struct constructor {
201
+ template <typename Class, typename... Extra, enable_if_t<!Class::has_alias, int> = 0>
202
+ static void execute(Class &cl, const Extra &...extra) {
203
+ cl.def(
204
+ "__init__",
205
+ [](value_and_holder &v_h, Args... args) {
206
+ v_h.value_ptr() = construct_or_initialize<Cpp<Class>>(std::forward<Args>(args)...);
207
+ },
208
+ is_new_style_constructor(),
209
+ extra...);
210
+ }
211
+
212
+ template <
213
+ typename Class,
214
+ typename... Extra,
215
+ enable_if_t<Class::has_alias && std::is_constructible<Cpp<Class>, Args...>::value, int>
216
+ = 0>
217
+ static void execute(Class &cl, const Extra &...extra) {
218
+ cl.def(
219
+ "__init__",
220
+ [](value_and_holder &v_h, Args... args) {
221
+ if (Py_TYPE(v_h.inst) == v_h.type->type) {
222
+ v_h.value_ptr()
223
+ = construct_or_initialize<Cpp<Class>>(std::forward<Args>(args)...);
224
+ } else {
225
+ v_h.value_ptr()
226
+ = construct_or_initialize<Alias<Class>>(std::forward<Args>(args)...);
227
+ }
228
+ },
229
+ is_new_style_constructor(),
230
+ extra...);
231
+ }
232
+
233
+ template <
234
+ typename Class,
235
+ typename... Extra,
236
+ enable_if_t<Class::has_alias && !std::is_constructible<Cpp<Class>, Args...>::value, int>
237
+ = 0>
238
+ static void execute(Class &cl, const Extra &...extra) {
239
+ cl.def(
240
+ "__init__",
241
+ [](value_and_holder &v_h, Args... args) {
242
+ v_h.value_ptr()
243
+ = construct_or_initialize<Alias<Class>>(std::forward<Args>(args)...);
244
+ },
245
+ is_new_style_constructor(),
246
+ extra...);
247
+ }
248
+ };
249
+
250
+ // Implementing class for py::init_alias<...>()
251
+ template <typename... Args>
252
+ struct alias_constructor {
253
+ template <
254
+ typename Class,
255
+ typename... Extra,
256
+ enable_if_t<Class::has_alias && std::is_constructible<Alias<Class>, Args...>::value, int>
257
+ = 0>
258
+ static void execute(Class &cl, const Extra &...extra) {
259
+ cl.def(
260
+ "__init__",
261
+ [](value_and_holder &v_h, Args... args) {
262
+ v_h.value_ptr()
263
+ = construct_or_initialize<Alias<Class>>(std::forward<Args>(args)...);
264
+ },
265
+ is_new_style_constructor(),
266
+ extra...);
267
+ }
268
+ };
269
+
270
+ // Implementation class for py::init(Func) and py::init(Func, AliasFunc)
271
+ template <typename CFunc,
272
+ typename AFunc = void_type (*)(),
273
+ typename = function_signature_t<CFunc>,
274
+ typename = function_signature_t<AFunc>>
275
+ struct factory;
276
+
277
+ // Specialization for py::init(Func)
278
+ template <typename Func, typename Return, typename... Args>
279
+ struct factory<Func, void_type (*)(), Return(Args...)> {
280
+ remove_reference_t<Func> class_factory;
281
+
282
+ // NOLINTNEXTLINE(google-explicit-constructor)
283
+ factory(Func &&f) : class_factory(std::forward<Func>(f)) {}
284
+
285
+ // The given class either has no alias or has no separate alias factory;
286
+ // this always constructs the class itself. If the class is registered with an alias
287
+ // type and an alias instance is needed (i.e. because the final type is a Python class
288
+ // inheriting from the C++ type) the returned value needs to either already be an alias
289
+ // instance, or the alias needs to be constructible from a `Class &&` argument.
290
+ template <typename Class, typename... Extra>
291
+ void execute(Class &cl, const Extra &...extra) && {
292
+ #if defined(PYBIND11_CPP14)
293
+ cl.def(
294
+ "__init__",
295
+ [func = std::move(class_factory)]
296
+ #else
297
+ auto &func = class_factory;
298
+ cl.def(
299
+ "__init__",
300
+ [func]
301
+ #endif
302
+ (value_and_holder &v_h, Args... args) {
303
+ construct<Class>(
304
+ v_h, func(std::forward<Args>(args)...), Py_TYPE(v_h.inst) != v_h.type->type);
305
+ },
306
+ is_new_style_constructor(),
307
+ extra...);
308
+ }
309
+ };
310
+
311
+ // Specialization for py::init(Func, AliasFunc)
312
+ template <typename CFunc,
313
+ typename AFunc,
314
+ typename CReturn,
315
+ typename... CArgs,
316
+ typename AReturn,
317
+ typename... AArgs>
318
+ struct factory<CFunc, AFunc, CReturn(CArgs...), AReturn(AArgs...)> {
319
+ static_assert(sizeof...(CArgs) == sizeof...(AArgs),
320
+ "pybind11::init(class_factory, alias_factory): class and alias factories "
321
+ "must have identical argument signatures");
322
+ static_assert(all_of<std::is_same<CArgs, AArgs>...>::value,
323
+ "pybind11::init(class_factory, alias_factory): class and alias factories "
324
+ "must have identical argument signatures");
325
+
326
+ remove_reference_t<CFunc> class_factory;
327
+ remove_reference_t<AFunc> alias_factory;
328
+
329
+ factory(CFunc &&c, AFunc &&a)
330
+ : class_factory(std::forward<CFunc>(c)), alias_factory(std::forward<AFunc>(a)) {}
331
+
332
+ // The class factory is called when the `self` type passed to `__init__` is the direct
333
+ // class (i.e. not inherited), the alias factory when `self` is a Python-side subtype.
334
+ template <typename Class, typename... Extra>
335
+ void execute(Class &cl, const Extra &...extra) && {
336
+ static_assert(Class::has_alias,
337
+ "The two-argument version of `py::init()` can "
338
+ "only be used if the class has an alias");
339
+ #if defined(PYBIND11_CPP14)
340
+ cl.def(
341
+ "__init__",
342
+ [class_func = std::move(class_factory), alias_func = std::move(alias_factory)]
343
+ #else
344
+ auto &class_func = class_factory;
345
+ auto &alias_func = alias_factory;
346
+ cl.def(
347
+ "__init__",
348
+ [class_func, alias_func]
349
+ #endif
350
+ (value_and_holder &v_h, CArgs... args) {
351
+ if (Py_TYPE(v_h.inst) == v_h.type->type) {
352
+ // If the instance type equals the registered type we don't have inheritance,
353
+ // so don't need the alias and can construct using the class function:
354
+ construct<Class>(v_h, class_func(std::forward<CArgs>(args)...), false);
355
+ } else {
356
+ construct<Class>(v_h, alias_func(std::forward<CArgs>(args)...), true);
357
+ }
358
+ },
359
+ is_new_style_constructor(),
360
+ extra...);
361
+ }
362
+ };
363
+
364
+ /// Set just the C++ state. Same as `__init__`.
365
+ template <typename Class, typename T>
366
+ void setstate(value_and_holder &v_h, T &&result, bool need_alias) {
367
+ construct<Class>(v_h, std::forward<T>(result), need_alias);
368
+ }
369
+
370
+ /// Set both the C++ and Python states
371
+ template <typename Class,
372
+ typename T,
373
+ typename O,
374
+ enable_if_t<std::is_convertible<O, handle>::value, int> = 0>
375
+ void setstate(value_and_holder &v_h, std::pair<T, O> &&result, bool need_alias) {
376
+ construct<Class>(v_h, std::move(result.first), need_alias);
377
+ auto d = handle(result.second);
378
+ if (PyDict_Check(d.ptr()) && PyDict_Size(d.ptr()) == 0) {
379
+ // Skipping setattr below, to not force use of py::dynamic_attr() for Class unnecessarily.
380
+ // See PR #2972 for details.
381
+ return;
382
+ }
383
+ setattr((PyObject *) v_h.inst, "__dict__", d);
384
+ }
385
+
386
+ /// Implementation for py::pickle(GetState, SetState)
387
+ template <typename Get,
388
+ typename Set,
389
+ typename = function_signature_t<Get>,
390
+ typename = function_signature_t<Set>>
391
+ struct pickle_factory;
392
+
393
+ template <typename Get,
394
+ typename Set,
395
+ typename RetState,
396
+ typename Self,
397
+ typename NewInstance,
398
+ typename ArgState>
399
+ struct pickle_factory<Get, Set, RetState(Self), NewInstance(ArgState)> {
400
+ static_assert(std::is_same<intrinsic_t<RetState>, intrinsic_t<ArgState>>::value,
401
+ "The type returned by `__getstate__` must be the same "
402
+ "as the argument accepted by `__setstate__`");
403
+
404
+ remove_reference_t<Get> get;
405
+ remove_reference_t<Set> set;
406
+
407
+ pickle_factory(Get get, Set set) : get(std::forward<Get>(get)), set(std::forward<Set>(set)) {}
408
+
409
+ template <typename Class, typename... Extra>
410
+ void execute(Class &cl, const Extra &...extra) && {
411
+ cl.def("__getstate__", std::move(get));
412
+
413
+ #if defined(PYBIND11_CPP14)
414
+ cl.def(
415
+ "__setstate__",
416
+ [func = std::move(set)]
417
+ #else
418
+ auto &func = set;
419
+ cl.def(
420
+ "__setstate__",
421
+ [func]
422
+ #endif
423
+ (value_and_holder &v_h, ArgState state) {
424
+ setstate<Class>(
425
+ v_h, func(std::forward<ArgState>(state)), Py_TYPE(v_h.inst) != v_h.type->type);
426
+ },
427
+ is_new_style_constructor(),
428
+ extra...);
429
+ }
430
+ };
431
+
432
+ PYBIND11_NAMESPACE_END(initimpl)
433
+ PYBIND11_NAMESPACE_END(detail)
434
+ PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)