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.
- ctpbee_api/__init__.py +17 -0
- ctpbee_api/ctp/__init__.py +3 -0
- ctpbee_api/ctp/ctp_constant.py +1253 -0
- ctpbee_api/ctp/generator/concat.py +93 -0
- ctpbee_api/ctp/generator/const.py +325 -0
- ctpbee_api/ctp/generator/ctp_constant.py +1274 -0
- ctpbee_api/ctp/generator/ctp_md_header_define.h +13 -0
- ctpbee_api/ctp/generator/ctp_md_header_function.h +6 -0
- ctpbee_api/ctp/generator/ctp_md_header_on.h +26 -0
- ctpbee_api/ctp/generator/ctp_md_header_process.h +26 -0
- ctpbee_api/ctp/generator/ctp_md_source_function.cpp +42 -0
- ctpbee_api/ctp/generator/ctp_md_source_module.cpp +18 -0
- ctpbee_api/ctp/generator/ctp_md_source_on.cpp +156 -0
- ctpbee_api/ctp/generator/ctp_md_source_process.cpp +282 -0
- ctpbee_api/ctp/generator/ctp_md_source_switch.cpp +78 -0
- ctpbee_api/ctp/generator/ctp_md_source_task.cpp +211 -0
- ctpbee_api/ctp/generator/ctp_struct.py +5640 -0
- ctpbee_api/ctp/generator/ctp_td_header_define.h +130 -0
- ctpbee_api/ctp/generator/ctp_td_header_function.h +174 -0
- ctpbee_api/ctp/generator/ctp_td_header_on.h +260 -0
- ctpbee_api/ctp/generator/ctp_td_header_process.h +260 -0
- ctpbee_api/ctp/generator/ctp_td_source_function.cpp +1456 -0
- ctpbee_api/ctp/generator/ctp_td_source_module.cpp +222 -0
- ctpbee_api/ctp/generator/ctp_td_source_on.cpp +1572 -0
- ctpbee_api/ctp/generator/ctp_td_source_process.cpp +5472 -0
- ctpbee_api/ctp/generator/ctp_td_source_switch.cpp +780 -0
- ctpbee_api/ctp/generator/ctp_td_source_task.cpp +2444 -0
- ctpbee_api/ctp/generator/ctp_typedef.py +800 -0
- ctpbee_api/ctp/generator/generate_api_functions.py +345 -0
- ctpbee_api/ctp/generator/generate_data_type.py +76 -0
- ctpbee_api/ctp/generator/generate_struct.py +84 -0
- ctpbee_api/ctp/include/mac/ctp/ThostFtdcMdApi.h +168 -0
- ctpbee_api/ctp/include/mac/ctp/ThostFtdcTraderApi.h +770 -0
- ctpbee_api/ctp/include/mac/ctp/ThostFtdcUserApiDataType.h +6878 -0
- ctpbee_api/ctp/include/mac/ctp/ThostFtdcUserApiStruct.h +10915 -0
- ctpbee_api/ctp/include/mac/pybind11/attr.h +690 -0
- ctpbee_api/ctp/include/mac/pybind11/buffer_info.h +208 -0
- ctpbee_api/ctp/include/mac/pybind11/cast.h +1704 -0
- ctpbee_api/ctp/include/mac/pybind11/chrono.h +225 -0
- ctpbee_api/ctp/include/mac/pybind11/common.h +2 -0
- ctpbee_api/ctp/include/mac/pybind11/complex.h +74 -0
- ctpbee_api/ctp/include/mac/pybind11/detail/class.h +743 -0
- ctpbee_api/ctp/include/mac/pybind11/detail/common.h +1255 -0
- ctpbee_api/ctp/include/mac/pybind11/detail/descr.h +171 -0
- ctpbee_api/ctp/include/mac/pybind11/detail/init.h +434 -0
- ctpbee_api/ctp/include/mac/pybind11/detail/internals.h +656 -0
- ctpbee_api/ctp/include/mac/pybind11/detail/type_caster_base.h +1177 -0
- ctpbee_api/ctp/include/mac/pybind11/detail/typeid.h +65 -0
- ctpbee_api/ctp/include/mac/pybind11/eigen/common.h +9 -0
- ctpbee_api/ctp/include/mac/pybind11/eigen/matrix.h +714 -0
- ctpbee_api/ctp/include/mac/pybind11/eigen/tensor.h +516 -0
- ctpbee_api/ctp/include/mac/pybind11/eigen.h +12 -0
- ctpbee_api/ctp/include/mac/pybind11/embed.h +316 -0
- ctpbee_api/ctp/include/mac/pybind11/eval.h +156 -0
- ctpbee_api/ctp/include/mac/pybind11/functional.h +137 -0
- ctpbee_api/ctp/include/mac/pybind11/gil.h +239 -0
- ctpbee_api/ctp/include/mac/pybind11/iostream.h +265 -0
- ctpbee_api/ctp/include/mac/pybind11/numpy.h +1998 -0
- ctpbee_api/ctp/include/mac/pybind11/operators.h +202 -0
- ctpbee_api/ctp/include/mac/pybind11/options.h +92 -0
- ctpbee_api/ctp/include/mac/pybind11/pybind11.h +2890 -0
- ctpbee_api/ctp/include/mac/pybind11/pytypes.h +2557 -0
- ctpbee_api/ctp/include/mac/pybind11/stl/filesystem.h +116 -0
- ctpbee_api/ctp/include/mac/pybind11/stl.h +447 -0
- ctpbee_api/ctp/include/mac/pybind11/stl_bind.h +851 -0
- ctpbee_api/ctp/include/mac/pybind11/type_caster_pyobject_ptr.h +61 -0
- ctpbee_api/ctp/include/new/ctp/ThostFtdcMdApi.h +168 -0
- ctpbee_api/ctp/include/new/ctp/ThostFtdcTraderApi.h +770 -0
- ctpbee_api/ctp/include/new/ctp/ThostFtdcUserApiDataType.h +6878 -0
- ctpbee_api/ctp/include/new/ctp/ThostFtdcUserApiStruct.h +10915 -0
- ctpbee_api/ctp/include/new/pybind11/attr.h +690 -0
- ctpbee_api/ctp/include/new/pybind11/buffer_info.h +208 -0
- ctpbee_api/ctp/include/new/pybind11/cast.h +1704 -0
- ctpbee_api/ctp/include/new/pybind11/chrono.h +225 -0
- ctpbee_api/ctp/include/new/pybind11/common.h +2 -0
- ctpbee_api/ctp/include/new/pybind11/complex.h +74 -0
- ctpbee_api/ctp/include/new/pybind11/detail/class.h +743 -0
- ctpbee_api/ctp/include/new/pybind11/detail/common.h +1255 -0
- ctpbee_api/ctp/include/new/pybind11/detail/descr.h +171 -0
- ctpbee_api/ctp/include/new/pybind11/detail/init.h +434 -0
- ctpbee_api/ctp/include/new/pybind11/detail/internals.h +656 -0
- ctpbee_api/ctp/include/new/pybind11/detail/type_caster_base.h +1177 -0
- ctpbee_api/ctp/include/new/pybind11/detail/typeid.h +65 -0
- ctpbee_api/ctp/include/new/pybind11/eigen/common.h +9 -0
- ctpbee_api/ctp/include/new/pybind11/eigen/matrix.h +714 -0
- ctpbee_api/ctp/include/new/pybind11/eigen/tensor.h +516 -0
- ctpbee_api/ctp/include/new/pybind11/eigen.h +12 -0
- ctpbee_api/ctp/include/new/pybind11/embed.h +316 -0
- ctpbee_api/ctp/include/new/pybind11/eval.h +156 -0
- ctpbee_api/ctp/include/new/pybind11/functional.h +137 -0
- ctpbee_api/ctp/include/new/pybind11/gil.h +239 -0
- ctpbee_api/ctp/include/new/pybind11/iostream.h +265 -0
- ctpbee_api/ctp/include/new/pybind11/numpy.h +1998 -0
- ctpbee_api/ctp/include/new/pybind11/operators.h +202 -0
- ctpbee_api/ctp/include/new/pybind11/options.h +92 -0
- ctpbee_api/ctp/include/new/pybind11/pybind11.h +2890 -0
- ctpbee_api/ctp/include/new/pybind11/pytypes.h +2557 -0
- ctpbee_api/ctp/include/new/pybind11/stl/filesystem.h +116 -0
- ctpbee_api/ctp/include/new/pybind11/stl.h +447 -0
- ctpbee_api/ctp/include/new/pybind11/stl_bind.h +851 -0
- ctpbee_api/ctp/include/new/pybind11/type_caster_pyobject_ptr.h +61 -0
- ctpbee_api/ctp/include/previous/ctp/ThostFtdcMdApi.h +168 -0
- ctpbee_api/ctp/include/previous/ctp/ThostFtdcTraderApi.h +770 -0
- ctpbee_api/ctp/include/previous/ctp/ThostFtdcUserApiDataType.h +6878 -0
- ctpbee_api/ctp/include/previous/ctp/ThostFtdcUserApiStruct.h +10915 -0
- ctpbee_api/ctp/include/previous/pybind11/attr.h +489 -0
- ctpbee_api/ctp/include/previous/pybind11/buffer_info.h +108 -0
- ctpbee_api/ctp/include/previous/pybind11/cast.h +2067 -0
- ctpbee_api/ctp/include/previous/pybind11/chrono.h +162 -0
- ctpbee_api/ctp/include/previous/pybind11/common.h +2 -0
- ctpbee_api/ctp/include/previous/pybind11/complex.h +61 -0
- ctpbee_api/ctp/include/previous/pybind11/detail/class.h +626 -0
- ctpbee_api/ctp/include/previous/pybind11/detail/common.h +803 -0
- ctpbee_api/ctp/include/previous/pybind11/detail/descr.h +185 -0
- ctpbee_api/ctp/include/previous/pybind11/detail/init.h +335 -0
- ctpbee_api/ctp/include/previous/pybind11/detail/internals.h +285 -0
- ctpbee_api/ctp/include/previous/pybind11/detail/typeid.h +53 -0
- ctpbee_api/ctp/include/previous/pybind11/eigen.h +604 -0
- ctpbee_api/ctp/include/previous/pybind11/embed.h +194 -0
- ctpbee_api/ctp/include/previous/pybind11/eval.h +117 -0
- ctpbee_api/ctp/include/previous/pybind11/functional.h +85 -0
- ctpbee_api/ctp/include/previous/pybind11/iostream.h +200 -0
- ctpbee_api/ctp/include/previous/pybind11/numpy.h +1601 -0
- ctpbee_api/ctp/include/previous/pybind11/operators.h +168 -0
- ctpbee_api/ctp/include/previous/pybind11/options.h +65 -0
- ctpbee_api/ctp/include/previous/pybind11/pybind11.h +1965 -0
- ctpbee_api/ctp/include/previous/pybind11/pytypes.h +1332 -0
- ctpbee_api/ctp/include/previous/pybind11/stl.h +376 -0
- ctpbee_api/ctp/include/previous/pybind11/stl_bind.h +599 -0
- ctpbee_api/ctp/libs/libcomunicationkey.a +0 -0
- ctpbee_api/ctp/libs/libcrypto.a +0 -0
- ctpbee_api/ctp/libs/libssl.a +0 -0
- ctpbee_api/ctp/libs/thostmduserapi_se.lib +0 -0
- ctpbee_api/ctp/libs/thosttraderapi_se.lib +0 -0
- ctpbee_api/ctp/libthostmduserapi_se.so +0 -0
- ctpbee_api/ctp/libthosttraderapi_se.so +0 -0
- ctpbee_api/ctp/thostmduserapi_se.dll +0 -0
- ctpbee_api/ctp/thosttraderapi_se.dll +0 -0
- ctpbee_api/ctp/vnctp/vnctp.h +189 -0
- ctpbee_api/ctp/vnctp/vnctp.sln +41 -0
- ctpbee_api/ctp/vnctp/vnctpmd/dllmain.cpp +19 -0
- ctpbee_api/ctp/vnctp/vnctpmd/stdafx.cpp +1 -0
- ctpbee_api/ctp/vnctp/vnctpmd/stdafx.h +17 -0
- ctpbee_api/ctp/vnctp/vnctpmd/targetver.h +8 -0
- ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.cpp +953 -0
- ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.h +209 -0
- ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj +200 -0
- ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj.filters +54 -0
- ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj.user +4 -0
- ctpbee_api/ctp/vnctp/vnctptd/dllmain.cpp +19 -0
- ctpbee_api/ctp/vnctp/vnctptd/stdafx.cpp +1 -0
- ctpbee_api/ctp/vnctp/vnctptd/stdafx.h +16 -0
- ctpbee_api/ctp/vnctp/vnctptd/targetver.h +8 -0
- ctpbee_api/ctp/vnctp/vnctptd/vnctptd.cpp +12148 -0
- ctpbee_api/ctp/vnctp/vnctptd/vnctptd.h +1329 -0
- ctpbee_api/ctp/vnctp/vnctptd/vnctptd.vcxproj +198 -0
- ctpbee_api/ctp/vnctp/vnctptd/vnctptd.vcxproj.filters +54 -0
- ctpbee_api/ctp/vnctp/vnctptd/vnctptd.vcxproj.user +4 -0
- ctpbee_api/ctp/vnctpmd.cp310-win_amd64.pyd +0 -0
- ctpbee_api/ctp/vnctptd.cp310-win_amd64.pyd +0 -0
- ctpbee_api/ctp_mini/__init__.py +3 -0
- ctpbee_api/ctp_mini/generator/generate_api_functions.py +343 -0
- ctpbee_api/ctp_mini/generator/generate_data_type.py +76 -0
- ctpbee_api/ctp_mini/generator/generate_struct.py +85 -0
- ctpbee_api/ctp_mini/generator/mini_constant.py +1186 -0
- ctpbee_api/ctp_mini/generator/mini_md_header_define.h +13 -0
- ctpbee_api/ctp_mini/generator/mini_md_header_function.h +4 -0
- ctpbee_api/ctp_mini/generator/mini_md_header_on.h +26 -0
- ctpbee_api/ctp_mini/generator/mini_md_header_process.h +26 -0
- ctpbee_api/ctp_mini/generator/mini_md_source_function.cpp +29 -0
- ctpbee_api/ctp_mini/generator/mini_md_source_module.cpp +17 -0
- ctpbee_api/ctp_mini/generator/mini_md_source_on.cpp +156 -0
- ctpbee_api/ctp_mini/generator/mini_md_source_process.cpp +264 -0
- ctpbee_api/ctp_mini/generator/mini_md_source_switch.cpp +78 -0
- ctpbee_api/ctp_mini/generator/mini_md_source_task.cpp +203 -0
- ctpbee_api/ctp_mini/generator/mini_struct.py +4599 -0
- ctpbee_api/ctp_mini/generator/mini_td_header_define.h +63 -0
- ctpbee_api/ctp_mini/generator/mini_td_header_function.h +84 -0
- ctpbee_api/ctp_mini/generator/mini_td_header_on.h +126 -0
- ctpbee_api/ctp_mini/generator/mini_td_header_process.h +126 -0
- ctpbee_api/ctp_mini/generator/mini_td_source_function.cpp +663 -0
- ctpbee_api/ctp_mini/generator/mini_td_source_module.cpp +107 -0
- ctpbee_api/ctp_mini/generator/mini_td_source_on.cpp +756 -0
- ctpbee_api/ctp_mini/generator/mini_td_source_process.cpp +2492 -0
- ctpbee_api/ctp_mini/generator/mini_td_source_switch.cpp +378 -0
- ctpbee_api/ctp_mini/generator/mini_td_source_task.cpp +1193 -0
- ctpbee_api/ctp_mini/generator/mini_typedef.py +755 -0
- ctpbee_api/ctp_mini/generator/package/vnminimd.cpp +886 -0
- ctpbee_api/ctp_mini/generator/package/vnminimd.h +205 -0
- ctpbee_api/ctp_mini/include/new/mini/ThostFtdcMdApi.h +148 -0
- ctpbee_api/ctp_mini/include/new/mini/ThostFtdcTraderApi.h +419 -0
- ctpbee_api/ctp_mini/include/new/mini/ThostFtdcUserApiDataType.h +6458 -0
- ctpbee_api/ctp_mini/include/new/mini/ThostFtdcUserApiStruct.h +8890 -0
- ctpbee_api/ctp_mini/include/new/pybind11/attr.h +690 -0
- ctpbee_api/ctp_mini/include/new/pybind11/buffer_info.h +208 -0
- ctpbee_api/ctp_mini/include/new/pybind11/cast.h +1704 -0
- ctpbee_api/ctp_mini/include/new/pybind11/chrono.h +225 -0
- ctpbee_api/ctp_mini/include/new/pybind11/common.h +2 -0
- ctpbee_api/ctp_mini/include/new/pybind11/complex.h +74 -0
- ctpbee_api/ctp_mini/include/new/pybind11/detail/class.h +743 -0
- ctpbee_api/ctp_mini/include/new/pybind11/detail/common.h +1255 -0
- ctpbee_api/ctp_mini/include/new/pybind11/detail/descr.h +171 -0
- ctpbee_api/ctp_mini/include/new/pybind11/detail/init.h +434 -0
- ctpbee_api/ctp_mini/include/new/pybind11/detail/internals.h +656 -0
- ctpbee_api/ctp_mini/include/new/pybind11/detail/type_caster_base.h +1177 -0
- ctpbee_api/ctp_mini/include/new/pybind11/detail/typeid.h +65 -0
- ctpbee_api/ctp_mini/include/new/pybind11/eigen/common.h +9 -0
- ctpbee_api/ctp_mini/include/new/pybind11/eigen/matrix.h +714 -0
- ctpbee_api/ctp_mini/include/new/pybind11/eigen/tensor.h +516 -0
- ctpbee_api/ctp_mini/include/new/pybind11/eigen.h +12 -0
- ctpbee_api/ctp_mini/include/new/pybind11/embed.h +316 -0
- ctpbee_api/ctp_mini/include/new/pybind11/eval.h +156 -0
- ctpbee_api/ctp_mini/include/new/pybind11/functional.h +137 -0
- ctpbee_api/ctp_mini/include/new/pybind11/gil.h +239 -0
- ctpbee_api/ctp_mini/include/new/pybind11/iostream.h +265 -0
- ctpbee_api/ctp_mini/include/new/pybind11/numpy.h +1998 -0
- ctpbee_api/ctp_mini/include/new/pybind11/operators.h +202 -0
- ctpbee_api/ctp_mini/include/new/pybind11/options.h +92 -0
- ctpbee_api/ctp_mini/include/new/pybind11/pybind11.h +2890 -0
- ctpbee_api/ctp_mini/include/new/pybind11/pytypes.h +2557 -0
- ctpbee_api/ctp_mini/include/new/pybind11/stl/filesystem.h +116 -0
- ctpbee_api/ctp_mini/include/new/pybind11/stl.h +447 -0
- ctpbee_api/ctp_mini/include/new/pybind11/stl_bind.h +851 -0
- ctpbee_api/ctp_mini/include/new/pybind11/type_caster_pyobject_ptr.h +61 -0
- ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcMdApi.h +148 -0
- ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcTraderApi.h +419 -0
- ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcUserApiDataType.h +6458 -0
- ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcUserApiStruct.h +8890 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/attr.h +489 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/buffer_info.h +108 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/cast.h +2067 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/chrono.h +162 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/common.h +2 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/complex.h +61 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/detail/class.h +626 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/detail/common.h +803 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/detail/descr.h +185 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/detail/init.h +335 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/detail/internals.h +285 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/detail/typeid.h +53 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/eigen.h +604 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/embed.h +194 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/eval.h +117 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/functional.h +85 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/iostream.h +200 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/numpy.h +1601 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/operators.h +168 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/options.h +65 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/pybind11.h +1965 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/pytypes.h +1332 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/stl.h +376 -0
- ctpbee_api/ctp_mini/include/previous/pybind11/stl_bind.h +599 -0
- ctpbee_api/ctp_mini/libs/thostmduserapi.lib +0 -0
- ctpbee_api/ctp_mini/libs/thosttraderapi.lib +0 -0
- ctpbee_api/ctp_mini/libthostmduserapi.so +0 -0
- ctpbee_api/ctp_mini/libthosttraderapi.so +0 -0
- ctpbee_api/ctp_mini/mini_constant.py +1186 -0
- ctpbee_api/ctp_mini/thostmduserapi.dll +0 -0
- ctpbee_api/ctp_mini/thosttraderapi.dll +0 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_mini.h +146 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_mini.sln +41 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/dllmain.cpp +0 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/stdafx.cpp +0 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/stdafx.h +0 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/targetver.h +0 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.cpp +886 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.h +203 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.vcxproj +183 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.vcxproj.filters +54 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.vcxproj.user +4 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/dllmain.cpp +0 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/stdafx.cpp +0 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/stdafx.h +0 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/targetver.h +0 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.cpp +5716 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.h +680 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.vcxproj +180 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.vcxproj.filters +54 -0
- ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.vcxproj.user +4 -0
- ctpbee_api/ctp_mini/vnctp_minimd.cp310-win_amd64.pyd +0 -0
- ctpbee_api/ctp_mini/vnctp_minitd.cp310-win_amd64.pyd +0 -0
- ctpbee_api/ctp_mini/vnctp_minitd.lib +0 -0
- ctpbee_api/rohon/RohonBaseV64.dll +0 -0
- ctpbee_api/rohon/WinDataCollect.dll +0 -0
- ctpbee_api/rohon/__init__.py +3 -0
- ctpbee_api/rohon/generator/generate_api_functions.py +348 -0
- ctpbee_api/rohon/generator/generate_data_type.py +76 -0
- ctpbee_api/rohon/generator/generate_struct.py +84 -0
- ctpbee_api/rohon/generator/rohon_constant.py +1242 -0
- ctpbee_api/rohon/generator/rohon_md_header_define.h +13 -0
- ctpbee_api/rohon/generator/rohon_md_header_function.h +6 -0
- ctpbee_api/rohon/generator/rohon_md_header_on.h +26 -0
- ctpbee_api/rohon/generator/rohon_md_header_process.h +26 -0
- ctpbee_api/rohon/generator/rohon_md_source_function.cpp +40 -0
- ctpbee_api/rohon/generator/rohon_md_source_module.cpp +18 -0
- ctpbee_api/rohon/generator/rohon_md_source_on.cpp +156 -0
- ctpbee_api/rohon/generator/rohon_md_source_process.cpp +271 -0
- ctpbee_api/rohon/generator/rohon_md_source_switch.cpp +78 -0
- ctpbee_api/rohon/generator/rohon_md_source_task.cpp +211 -0
- ctpbee_api/rohon/generator/rohon_struct.py +4958 -0
- ctpbee_api/rohon/generator/rohon_td_header_define.h +125 -0
- ctpbee_api/rohon/generator/rohon_td_header_function.h +164 -0
- ctpbee_api/rohon/generator/rohon_td_header_on.h +250 -0
- ctpbee_api/rohon/generator/rohon_td_header_process.h +250 -0
- ctpbee_api/rohon/generator/rohon_td_source_function.cpp +1338 -0
- ctpbee_api/rohon/generator/rohon_td_source_module.cpp +209 -0
- ctpbee_api/rohon/generator/rohon_td_source_on.cpp +1500 -0
- ctpbee_api/rohon/generator/rohon_td_source_process.cpp +5125 -0
- ctpbee_api/rohon/generator/rohon_td_source_switch.cpp +750 -0
- ctpbee_api/rohon/generator/rohon_td_source_task.cpp +2339 -0
- ctpbee_api/rohon/generator/rohon_typedef.py +781 -0
- ctpbee_api/rohon/include/new/pybind11/attr.h +690 -0
- ctpbee_api/rohon/include/new/pybind11/buffer_info.h +208 -0
- ctpbee_api/rohon/include/new/pybind11/cast.h +1704 -0
- ctpbee_api/rohon/include/new/pybind11/chrono.h +225 -0
- ctpbee_api/rohon/include/new/pybind11/common.h +2 -0
- ctpbee_api/rohon/include/new/pybind11/complex.h +74 -0
- ctpbee_api/rohon/include/new/pybind11/detail/class.h +743 -0
- ctpbee_api/rohon/include/new/pybind11/detail/common.h +1255 -0
- ctpbee_api/rohon/include/new/pybind11/detail/descr.h +171 -0
- ctpbee_api/rohon/include/new/pybind11/detail/init.h +434 -0
- ctpbee_api/rohon/include/new/pybind11/detail/internals.h +656 -0
- ctpbee_api/rohon/include/new/pybind11/detail/type_caster_base.h +1177 -0
- ctpbee_api/rohon/include/new/pybind11/detail/typeid.h +65 -0
- ctpbee_api/rohon/include/new/pybind11/eigen/common.h +9 -0
- ctpbee_api/rohon/include/new/pybind11/eigen/matrix.h +714 -0
- ctpbee_api/rohon/include/new/pybind11/eigen/tensor.h +516 -0
- ctpbee_api/rohon/include/new/pybind11/eigen.h +12 -0
- ctpbee_api/rohon/include/new/pybind11/embed.h +316 -0
- ctpbee_api/rohon/include/new/pybind11/eval.h +156 -0
- ctpbee_api/rohon/include/new/pybind11/functional.h +137 -0
- ctpbee_api/rohon/include/new/pybind11/gil.h +239 -0
- ctpbee_api/rohon/include/new/pybind11/iostream.h +265 -0
- ctpbee_api/rohon/include/new/pybind11/numpy.h +1998 -0
- ctpbee_api/rohon/include/new/pybind11/operators.h +202 -0
- ctpbee_api/rohon/include/new/pybind11/options.h +92 -0
- ctpbee_api/rohon/include/new/pybind11/pybind11.h +2890 -0
- ctpbee_api/rohon/include/new/pybind11/pytypes.h +2557 -0
- ctpbee_api/rohon/include/new/pybind11/stl/filesystem.h +116 -0
- ctpbee_api/rohon/include/new/pybind11/stl.h +447 -0
- ctpbee_api/rohon/include/new/pybind11/stl_bind.h +851 -0
- ctpbee_api/rohon/include/new/pybind11/type_caster_pyobject_ptr.h +61 -0
- ctpbee_api/rohon/include/new/rohon/ThostFtdcMdApi.h +168 -0
- ctpbee_api/rohon/include/new/rohon/ThostFtdcTraderApi.h +739 -0
- ctpbee_api/rohon/include/new/rohon/ThostFtdcUserApiDataType.h +6708 -0
- ctpbee_api/rohon/include/new/rohon/ThostFtdcUserApiStruct.h +9580 -0
- ctpbee_api/rohon/include/previous/pybind11/attr.h +489 -0
- ctpbee_api/rohon/include/previous/pybind11/buffer_info.h +108 -0
- ctpbee_api/rohon/include/previous/pybind11/cast.h +2067 -0
- ctpbee_api/rohon/include/previous/pybind11/chrono.h +162 -0
- ctpbee_api/rohon/include/previous/pybind11/common.h +2 -0
- ctpbee_api/rohon/include/previous/pybind11/complex.h +61 -0
- ctpbee_api/rohon/include/previous/pybind11/detail/class.h +626 -0
- ctpbee_api/rohon/include/previous/pybind11/detail/common.h +803 -0
- ctpbee_api/rohon/include/previous/pybind11/detail/descr.h +185 -0
- ctpbee_api/rohon/include/previous/pybind11/detail/init.h +335 -0
- ctpbee_api/rohon/include/previous/pybind11/detail/internals.h +285 -0
- ctpbee_api/rohon/include/previous/pybind11/detail/typeid.h +53 -0
- ctpbee_api/rohon/include/previous/pybind11/eigen.h +604 -0
- ctpbee_api/rohon/include/previous/pybind11/embed.h +194 -0
- ctpbee_api/rohon/include/previous/pybind11/eval.h +117 -0
- ctpbee_api/rohon/include/previous/pybind11/functional.h +85 -0
- ctpbee_api/rohon/include/previous/pybind11/iostream.h +200 -0
- ctpbee_api/rohon/include/previous/pybind11/numpy.h +1601 -0
- ctpbee_api/rohon/include/previous/pybind11/operators.h +168 -0
- ctpbee_api/rohon/include/previous/pybind11/options.h +65 -0
- ctpbee_api/rohon/include/previous/pybind11/pybind11.h +1965 -0
- ctpbee_api/rohon/include/previous/pybind11/pytypes.h +1332 -0
- ctpbee_api/rohon/include/previous/pybind11/stl.h +376 -0
- ctpbee_api/rohon/include/previous/pybind11/stl_bind.h +599 -0
- ctpbee_api/rohon/include/previous/rohon/ThostFtdcMdApi.h +168 -0
- ctpbee_api/rohon/include/previous/rohon/ThostFtdcTraderApi.h +739 -0
- ctpbee_api/rohon/include/previous/rohon/ThostFtdcUserApiDataType.h +6708 -0
- ctpbee_api/rohon/include/previous/rohon/ThostFtdcUserApiStruct.h +9580 -0
- ctpbee_api/rohon/libLinuxDataCollect.so +0 -0
- ctpbee_api/rohon/librohonbase.so +0 -0
- ctpbee_api/rohon/librohonbase.so.1.1 +0 -0
- ctpbee_api/rohon/librohonbase.so.1.1.0.1 +0 -0
- ctpbee_api/rohon/libs/thostmduserapi_se.lib +0 -0
- ctpbee_api/rohon/libs/thosttraderapi_se.lib +0 -0
- ctpbee_api/rohon/libthostmduserapi_se.so +0 -0
- ctpbee_api/rohon/libthosttraderapi_se.so +0 -0
- ctpbee_api/rohon/rohon_constant.py +1242 -0
- ctpbee_api/rohon/thostmduserapi_se.dll +0 -0
- ctpbee_api/rohon/thosttraderapi_se.dll +0 -0
- ctpbee_api/rohon/vnrohon/.vs/vnrohon/v15/.suo +0 -0
- ctpbee_api/rohon/vnrohon/.vs/vnrohon/v15/Browse.VC.db +0 -0
- ctpbee_api/rohon/vnrohon/.vs/vnrohon/v15/Solution.VC.db +0 -0
- ctpbee_api/rohon/vnrohon/vnrohon.h +147 -0
- ctpbee_api/rohon/vnrohon/vnrohon.sln +41 -0
- ctpbee_api/rohon/vnrohon/vnrohonmd/dllmain.cpp +19 -0
- ctpbee_api/rohon/vnrohon/vnrohonmd/framework.h +5 -0
- ctpbee_api/rohon/vnrohon/vnrohonmd/pch.cpp +5 -0
- ctpbee_api/rohon/vnrohon/vnrohonmd/pch.h +13 -0
- ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.cpp +931 -0
- ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.h +207 -0
- ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.vcxproj +188 -0
- ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.vcxproj.filters +54 -0
- ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.vcxproj.user +4 -0
- ctpbee_api/rohon/vnrohon/vnrohontd/dllmain.cpp +19 -0
- ctpbee_api/rohon/vnrohon/vnrohontd/framework.h +5 -0
- ctpbee_api/rohon/vnrohon/vnrohontd/pch.cpp +5 -0
- ctpbee_api/rohon/vnrohon/vnrohontd/pch.h +13 -0
- ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.cpp +11395 -0
- ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.h +1259 -0
- ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.vcxproj +188 -0
- ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.vcxproj.filters +54 -0
- ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.vcxproj.user +4 -0
- ctpbee_api/rohon/vnrohonmd.cp310-win_amd64.pyd +0 -0
- ctpbee_api/rohon/vnrohontd.cp310-win_amd64.pyd +0 -0
- ctpbee_opt_api-0.1.0.dist-info/METADATA +46 -0
- ctpbee_opt_api-0.1.0.dist-info/RECORD +414 -0
- ctpbee_opt_api-0.1.0.dist-info/WHEEL +5 -0
- ctpbee_opt_api-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
/*
|
|
2
|
+
pybind11/eigen/tensor.h: Transparent conversion for Eigen tensors
|
|
3
|
+
|
|
4
|
+
All rights reserved. Use of this source code is governed by a
|
|
5
|
+
BSD-style license that can be found in the LICENSE file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "../numpy.h"
|
|
11
|
+
#include "common.h"
|
|
12
|
+
|
|
13
|
+
#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
|
|
14
|
+
static_assert(__GNUC__ > 5, "Eigen Tensor support in pybind11 requires GCC > 5.0");
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
// Disable warnings for Eigen
|
|
18
|
+
PYBIND11_WARNING_PUSH
|
|
19
|
+
PYBIND11_WARNING_DISABLE_MSVC(4554)
|
|
20
|
+
PYBIND11_WARNING_DISABLE_MSVC(4127)
|
|
21
|
+
#if defined(__MINGW32__)
|
|
22
|
+
PYBIND11_WARNING_DISABLE_GCC("-Wmaybe-uninitialized")
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
#include <unsupported/Eigen/CXX11/Tensor>
|
|
26
|
+
|
|
27
|
+
PYBIND11_WARNING_POP
|
|
28
|
+
|
|
29
|
+
static_assert(EIGEN_VERSION_AT_LEAST(3, 3, 0),
|
|
30
|
+
"Eigen Tensor support in pybind11 requires Eigen >= 3.3.0");
|
|
31
|
+
|
|
32
|
+
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
|
|
33
|
+
|
|
34
|
+
PYBIND11_WARNING_DISABLE_MSVC(4127)
|
|
35
|
+
|
|
36
|
+
PYBIND11_NAMESPACE_BEGIN(detail)
|
|
37
|
+
|
|
38
|
+
inline bool is_tensor_aligned(const void *data) {
|
|
39
|
+
return (reinterpret_cast<std::size_t>(data) % EIGEN_DEFAULT_ALIGN_BYTES) == 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
template <typename T>
|
|
43
|
+
constexpr int compute_array_flag_from_tensor() {
|
|
44
|
+
static_assert((static_cast<int>(T::Layout) == static_cast<int>(Eigen::RowMajor))
|
|
45
|
+
|| (static_cast<int>(T::Layout) == static_cast<int>(Eigen::ColMajor)),
|
|
46
|
+
"Layout must be row or column major");
|
|
47
|
+
return (static_cast<int>(T::Layout) == static_cast<int>(Eigen::RowMajor)) ? array::c_style
|
|
48
|
+
: array::f_style;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
template <typename T>
|
|
52
|
+
struct eigen_tensor_helper {};
|
|
53
|
+
|
|
54
|
+
template <typename Scalar_, int NumIndices_, int Options_, typename IndexType>
|
|
55
|
+
struct eigen_tensor_helper<Eigen::Tensor<Scalar_, NumIndices_, Options_, IndexType>> {
|
|
56
|
+
using Type = Eigen::Tensor<Scalar_, NumIndices_, Options_, IndexType>;
|
|
57
|
+
using ValidType = void;
|
|
58
|
+
|
|
59
|
+
static Eigen::DSizes<typename Type::Index, Type::NumIndices> get_shape(const Type &f) {
|
|
60
|
+
return f.dimensions();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static constexpr bool
|
|
64
|
+
is_correct_shape(const Eigen::DSizes<typename Type::Index, Type::NumIndices> & /*shape*/) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
template <typename T>
|
|
69
|
+
struct helper {};
|
|
70
|
+
|
|
71
|
+
template <size_t... Is>
|
|
72
|
+
struct helper<index_sequence<Is...>> {
|
|
73
|
+
static constexpr auto value = concat(const_name(((void) Is, "?"))...);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
static constexpr auto dimensions_descriptor
|
|
77
|
+
= helper<decltype(make_index_sequence<Type::NumIndices>())>::value;
|
|
78
|
+
|
|
79
|
+
template <typename... Args>
|
|
80
|
+
static Type *alloc(Args &&...args) {
|
|
81
|
+
return new Type(std::forward<Args>(args)...);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static void free(Type *tensor) { delete tensor; }
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
template <typename Scalar_, typename std::ptrdiff_t... Indices, int Options_, typename IndexType>
|
|
88
|
+
struct eigen_tensor_helper<
|
|
89
|
+
Eigen::TensorFixedSize<Scalar_, Eigen::Sizes<Indices...>, Options_, IndexType>> {
|
|
90
|
+
using Type = Eigen::TensorFixedSize<Scalar_, Eigen::Sizes<Indices...>, Options_, IndexType>;
|
|
91
|
+
using ValidType = void;
|
|
92
|
+
|
|
93
|
+
static constexpr Eigen::DSizes<typename Type::Index, Type::NumIndices>
|
|
94
|
+
get_shape(const Type & /*f*/) {
|
|
95
|
+
return get_shape();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
static constexpr Eigen::DSizes<typename Type::Index, Type::NumIndices> get_shape() {
|
|
99
|
+
return Eigen::DSizes<typename Type::Index, Type::NumIndices>(Indices...);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static bool
|
|
103
|
+
is_correct_shape(const Eigen::DSizes<typename Type::Index, Type::NumIndices> &shape) {
|
|
104
|
+
return get_shape() == shape;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
static constexpr auto dimensions_descriptor = concat(const_name<Indices>()...);
|
|
108
|
+
|
|
109
|
+
template <typename... Args>
|
|
110
|
+
static Type *alloc(Args &&...args) {
|
|
111
|
+
Eigen::aligned_allocator<Type> allocator;
|
|
112
|
+
return ::new (allocator.allocate(1)) Type(std::forward<Args>(args)...);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
static void free(Type *tensor) {
|
|
116
|
+
Eigen::aligned_allocator<Type> allocator;
|
|
117
|
+
tensor->~Type();
|
|
118
|
+
allocator.deallocate(tensor, 1);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
template <typename Type, bool ShowDetails, bool NeedsWriteable = false>
|
|
123
|
+
struct get_tensor_descriptor {
|
|
124
|
+
static constexpr auto details
|
|
125
|
+
= const_name<NeedsWriteable>(", flags.writeable", "")
|
|
126
|
+
+ const_name<static_cast<int>(Type::Layout) == static_cast<int>(Eigen::RowMajor)>(
|
|
127
|
+
", flags.c_contiguous", ", flags.f_contiguous");
|
|
128
|
+
static constexpr auto value
|
|
129
|
+
= const_name("numpy.ndarray[") + npy_format_descriptor<typename Type::Scalar>::name
|
|
130
|
+
+ const_name("[") + eigen_tensor_helper<remove_cv_t<Type>>::dimensions_descriptor
|
|
131
|
+
+ const_name("]") + const_name<ShowDetails>(details, const_name("")) + const_name("]");
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// When EIGEN_AVOID_STL_ARRAY is defined, Eigen::DSizes<T, 0> does not have the begin() member
|
|
135
|
+
// function. Falling back to a simple loop works around this issue.
|
|
136
|
+
//
|
|
137
|
+
// We need to disable the type-limits warning for the inner loop when size = 0.
|
|
138
|
+
|
|
139
|
+
PYBIND11_WARNING_PUSH
|
|
140
|
+
PYBIND11_WARNING_DISABLE_GCC("-Wtype-limits")
|
|
141
|
+
|
|
142
|
+
template <typename T, int size>
|
|
143
|
+
std::vector<T> convert_dsizes_to_vector(const Eigen::DSizes<T, size> &arr) {
|
|
144
|
+
std::vector<T> result(size);
|
|
145
|
+
|
|
146
|
+
for (size_t i = 0; i < size; i++) {
|
|
147
|
+
result[i] = arr[i];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return result;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
template <typename T, int size>
|
|
154
|
+
Eigen::DSizes<T, size> get_shape_for_array(const array &arr) {
|
|
155
|
+
Eigen::DSizes<T, size> result;
|
|
156
|
+
const T *shape = arr.shape();
|
|
157
|
+
for (size_t i = 0; i < size; i++) {
|
|
158
|
+
result[i] = shape[i];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return result;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
PYBIND11_WARNING_POP
|
|
165
|
+
|
|
166
|
+
template <typename Type>
|
|
167
|
+
struct type_caster<Type, typename eigen_tensor_helper<Type>::ValidType> {
|
|
168
|
+
static_assert(!std::is_pointer<typename Type::Scalar>::value,
|
|
169
|
+
PYBIND11_EIGEN_MESSAGE_POINTER_TYPES_ARE_NOT_SUPPORTED);
|
|
170
|
+
using Helper = eigen_tensor_helper<Type>;
|
|
171
|
+
static constexpr auto temp_name = get_tensor_descriptor<Type, false>::value;
|
|
172
|
+
PYBIND11_TYPE_CASTER(Type, temp_name);
|
|
173
|
+
|
|
174
|
+
bool load(handle src, bool convert) {
|
|
175
|
+
if (!convert) {
|
|
176
|
+
if (!isinstance<array>(src)) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
array temp = array::ensure(src);
|
|
180
|
+
if (!temp) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (!temp.dtype().is(dtype::of<typename Type::Scalar>())) {
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
array_t<typename Type::Scalar, compute_array_flag_from_tensor<Type>()> arr(
|
|
190
|
+
reinterpret_borrow<object>(src));
|
|
191
|
+
|
|
192
|
+
if (arr.ndim() != Type::NumIndices) {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
auto shape = get_shape_for_array<typename Type::Index, Type::NumIndices>(arr);
|
|
196
|
+
|
|
197
|
+
if (!Helper::is_correct_shape(shape)) {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
#if EIGEN_VERSION_AT_LEAST(3, 4, 0)
|
|
202
|
+
auto data_pointer = arr.data();
|
|
203
|
+
#else
|
|
204
|
+
// Handle Eigen bug
|
|
205
|
+
auto data_pointer = const_cast<typename Type::Scalar *>(arr.data());
|
|
206
|
+
#endif
|
|
207
|
+
|
|
208
|
+
if (is_tensor_aligned(arr.data())) {
|
|
209
|
+
value = Eigen::TensorMap<const Type, Eigen::Aligned>(data_pointer, shape);
|
|
210
|
+
} else {
|
|
211
|
+
value = Eigen::TensorMap<const Type>(data_pointer, shape);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
static handle cast(Type &&src, return_value_policy policy, handle parent) {
|
|
218
|
+
if (policy == return_value_policy::reference
|
|
219
|
+
|| policy == return_value_policy::reference_internal) {
|
|
220
|
+
pybind11_fail("Cannot use a reference return value policy for an rvalue");
|
|
221
|
+
}
|
|
222
|
+
return cast_impl(&src, return_value_policy::move, parent);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
static handle cast(const Type &&src, return_value_policy policy, handle parent) {
|
|
226
|
+
if (policy == return_value_policy::reference
|
|
227
|
+
|| policy == return_value_policy::reference_internal) {
|
|
228
|
+
pybind11_fail("Cannot use a reference return value policy for an rvalue");
|
|
229
|
+
}
|
|
230
|
+
return cast_impl(&src, return_value_policy::move, parent);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
static handle cast(Type &src, return_value_policy policy, handle parent) {
|
|
234
|
+
if (policy == return_value_policy::automatic
|
|
235
|
+
|| policy == return_value_policy::automatic_reference) {
|
|
236
|
+
policy = return_value_policy::copy;
|
|
237
|
+
}
|
|
238
|
+
return cast_impl(&src, policy, parent);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
static handle cast(const Type &src, return_value_policy policy, handle parent) {
|
|
242
|
+
if (policy == return_value_policy::automatic
|
|
243
|
+
|| policy == return_value_policy::automatic_reference) {
|
|
244
|
+
policy = return_value_policy::copy;
|
|
245
|
+
}
|
|
246
|
+
return cast(&src, policy, parent);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
static handle cast(Type *src, return_value_policy policy, handle parent) {
|
|
250
|
+
if (policy == return_value_policy::automatic) {
|
|
251
|
+
policy = return_value_policy::take_ownership;
|
|
252
|
+
} else if (policy == return_value_policy::automatic_reference) {
|
|
253
|
+
policy = return_value_policy::reference;
|
|
254
|
+
}
|
|
255
|
+
return cast_impl(src, policy, parent);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
static handle cast(const Type *src, return_value_policy policy, handle parent) {
|
|
259
|
+
if (policy == return_value_policy::automatic) {
|
|
260
|
+
policy = return_value_policy::take_ownership;
|
|
261
|
+
} else if (policy == return_value_policy::automatic_reference) {
|
|
262
|
+
policy = return_value_policy::reference;
|
|
263
|
+
}
|
|
264
|
+
return cast_impl(src, policy, parent);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
template <typename C>
|
|
268
|
+
static handle cast_impl(C *src, return_value_policy policy, handle parent) {
|
|
269
|
+
object parent_object;
|
|
270
|
+
bool writeable = false;
|
|
271
|
+
switch (policy) {
|
|
272
|
+
case return_value_policy::move:
|
|
273
|
+
if (std::is_const<C>::value) {
|
|
274
|
+
pybind11_fail("Cannot move from a constant reference");
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
src = Helper::alloc(std::move(*src));
|
|
278
|
+
|
|
279
|
+
parent_object
|
|
280
|
+
= capsule(src, [](void *ptr) { Helper::free(reinterpret_cast<Type *>(ptr)); });
|
|
281
|
+
writeable = true;
|
|
282
|
+
break;
|
|
283
|
+
|
|
284
|
+
case return_value_policy::take_ownership:
|
|
285
|
+
if (std::is_const<C>::value) {
|
|
286
|
+
// This cast is ugly, and might be UB in some cases, but we don't have an
|
|
287
|
+
// alternative here as we must free that memory
|
|
288
|
+
Helper::free(const_cast<Type *>(src));
|
|
289
|
+
pybind11_fail("Cannot take ownership of a const reference");
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
parent_object
|
|
293
|
+
= capsule(src, [](void *ptr) { Helper::free(reinterpret_cast<Type *>(ptr)); });
|
|
294
|
+
writeable = true;
|
|
295
|
+
break;
|
|
296
|
+
|
|
297
|
+
case return_value_policy::copy:
|
|
298
|
+
writeable = true;
|
|
299
|
+
break;
|
|
300
|
+
|
|
301
|
+
case return_value_policy::reference:
|
|
302
|
+
parent_object = none();
|
|
303
|
+
writeable = !std::is_const<C>::value;
|
|
304
|
+
break;
|
|
305
|
+
|
|
306
|
+
case return_value_policy::reference_internal:
|
|
307
|
+
// Default should do the right thing
|
|
308
|
+
if (!parent) {
|
|
309
|
+
pybind11_fail("Cannot use reference internal when there is no parent");
|
|
310
|
+
}
|
|
311
|
+
parent_object = reinterpret_borrow<object>(parent);
|
|
312
|
+
writeable = !std::is_const<C>::value;
|
|
313
|
+
break;
|
|
314
|
+
|
|
315
|
+
default:
|
|
316
|
+
pybind11_fail("pybind11 bug in eigen.h, please file a bug report");
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
auto result = array_t<typename Type::Scalar, compute_array_flag_from_tensor<Type>()>(
|
|
320
|
+
convert_dsizes_to_vector(Helper::get_shape(*src)), src->data(), parent_object);
|
|
321
|
+
|
|
322
|
+
if (!writeable) {
|
|
323
|
+
array_proxy(result.ptr())->flags &= ~detail::npy_api::NPY_ARRAY_WRITEABLE_;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return result.release();
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
template <typename StoragePointerType,
|
|
331
|
+
bool needs_writeable,
|
|
332
|
+
enable_if_t<!needs_writeable, bool> = true>
|
|
333
|
+
StoragePointerType get_array_data_for_type(array &arr) {
|
|
334
|
+
#if EIGEN_VERSION_AT_LEAST(3, 4, 0)
|
|
335
|
+
return reinterpret_cast<StoragePointerType>(arr.data());
|
|
336
|
+
#else
|
|
337
|
+
// Handle Eigen bug
|
|
338
|
+
return reinterpret_cast<StoragePointerType>(const_cast<void *>(arr.data()));
|
|
339
|
+
#endif
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
template <typename StoragePointerType,
|
|
343
|
+
bool needs_writeable,
|
|
344
|
+
enable_if_t<needs_writeable, bool> = true>
|
|
345
|
+
StoragePointerType get_array_data_for_type(array &arr) {
|
|
346
|
+
return reinterpret_cast<StoragePointerType>(arr.mutable_data());
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
template <typename T, typename = void>
|
|
350
|
+
struct get_storage_pointer_type;
|
|
351
|
+
|
|
352
|
+
template <typename MapType>
|
|
353
|
+
struct get_storage_pointer_type<MapType, void_t<typename MapType::StoragePointerType>> {
|
|
354
|
+
using SPT = typename MapType::StoragePointerType;
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
template <typename MapType>
|
|
358
|
+
struct get_storage_pointer_type<MapType, void_t<typename MapType::PointerArgType>> {
|
|
359
|
+
using SPT = typename MapType::PointerArgType;
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
template <typename Type, int Options>
|
|
363
|
+
struct type_caster<Eigen::TensorMap<Type, Options>,
|
|
364
|
+
typename eigen_tensor_helper<remove_cv_t<Type>>::ValidType> {
|
|
365
|
+
static_assert(!std::is_pointer<typename Type::Scalar>::value,
|
|
366
|
+
PYBIND11_EIGEN_MESSAGE_POINTER_TYPES_ARE_NOT_SUPPORTED);
|
|
367
|
+
using MapType = Eigen::TensorMap<Type, Options>;
|
|
368
|
+
using Helper = eigen_tensor_helper<remove_cv_t<Type>>;
|
|
369
|
+
|
|
370
|
+
bool load(handle src, bool /*convert*/) {
|
|
371
|
+
// Note that we have a lot more checks here as we want to make sure to avoid copies
|
|
372
|
+
if (!isinstance<array>(src)) {
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
auto arr = reinterpret_borrow<array>(src);
|
|
376
|
+
if ((arr.flags() & compute_array_flag_from_tensor<Type>()) == 0) {
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
if (!arr.dtype().is(dtype::of<typename Type::Scalar>())) {
|
|
381
|
+
return false;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
if (arr.ndim() != Type::NumIndices) {
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
constexpr bool is_aligned = (Options & Eigen::Aligned) != 0;
|
|
389
|
+
|
|
390
|
+
if (is_aligned && !is_tensor_aligned(arr.data())) {
|
|
391
|
+
return false;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
auto shape = get_shape_for_array<typename Type::Index, Type::NumIndices>(arr);
|
|
395
|
+
|
|
396
|
+
if (!Helper::is_correct_shape(shape)) {
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
if (needs_writeable && !arr.writeable()) {
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
auto result = get_array_data_for_type<typename get_storage_pointer_type<MapType>::SPT,
|
|
405
|
+
needs_writeable>(arr);
|
|
406
|
+
|
|
407
|
+
value.reset(new MapType(std::move(result), std::move(shape)));
|
|
408
|
+
|
|
409
|
+
return true;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
static handle cast(MapType &&src, return_value_policy policy, handle parent) {
|
|
413
|
+
return cast_impl(&src, policy, parent);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
static handle cast(const MapType &&src, return_value_policy policy, handle parent) {
|
|
417
|
+
return cast_impl(&src, policy, parent);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
static handle cast(MapType &src, return_value_policy policy, handle parent) {
|
|
421
|
+
if (policy == return_value_policy::automatic
|
|
422
|
+
|| policy == return_value_policy::automatic_reference) {
|
|
423
|
+
policy = return_value_policy::copy;
|
|
424
|
+
}
|
|
425
|
+
return cast_impl(&src, policy, parent);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
static handle cast(const MapType &src, return_value_policy policy, handle parent) {
|
|
429
|
+
if (policy == return_value_policy::automatic
|
|
430
|
+
|| policy == return_value_policy::automatic_reference) {
|
|
431
|
+
policy = return_value_policy::copy;
|
|
432
|
+
}
|
|
433
|
+
return cast(&src, policy, parent);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
static handle cast(MapType *src, return_value_policy policy, handle parent) {
|
|
437
|
+
if (policy == return_value_policy::automatic) {
|
|
438
|
+
policy = return_value_policy::take_ownership;
|
|
439
|
+
} else if (policy == return_value_policy::automatic_reference) {
|
|
440
|
+
policy = return_value_policy::reference;
|
|
441
|
+
}
|
|
442
|
+
return cast_impl(src, policy, parent);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
static handle cast(const MapType *src, return_value_policy policy, handle parent) {
|
|
446
|
+
if (policy == return_value_policy::automatic) {
|
|
447
|
+
policy = return_value_policy::take_ownership;
|
|
448
|
+
} else if (policy == return_value_policy::automatic_reference) {
|
|
449
|
+
policy = return_value_policy::reference;
|
|
450
|
+
}
|
|
451
|
+
return cast_impl(src, policy, parent);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
template <typename C>
|
|
455
|
+
static handle cast_impl(C *src, return_value_policy policy, handle parent) {
|
|
456
|
+
object parent_object;
|
|
457
|
+
constexpr bool writeable = !std::is_const<C>::value;
|
|
458
|
+
switch (policy) {
|
|
459
|
+
case return_value_policy::reference:
|
|
460
|
+
parent_object = none();
|
|
461
|
+
break;
|
|
462
|
+
|
|
463
|
+
case return_value_policy::reference_internal:
|
|
464
|
+
// Default should do the right thing
|
|
465
|
+
if (!parent) {
|
|
466
|
+
pybind11_fail("Cannot use reference internal when there is no parent");
|
|
467
|
+
}
|
|
468
|
+
parent_object = reinterpret_borrow<object>(parent);
|
|
469
|
+
break;
|
|
470
|
+
|
|
471
|
+
case return_value_policy::take_ownership:
|
|
472
|
+
delete src;
|
|
473
|
+
// fallthrough
|
|
474
|
+
default:
|
|
475
|
+
// move, take_ownership don't make any sense for a ref/map:
|
|
476
|
+
pybind11_fail("Invalid return_value_policy for Eigen Map type, must be either "
|
|
477
|
+
"reference or reference_internal");
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
auto result = array_t<typename Type::Scalar, compute_array_flag_from_tensor<Type>()>(
|
|
481
|
+
convert_dsizes_to_vector(Helper::get_shape(*src)),
|
|
482
|
+
src->data(),
|
|
483
|
+
std::move(parent_object));
|
|
484
|
+
|
|
485
|
+
if (!writeable) {
|
|
486
|
+
array_proxy(result.ptr())->flags &= ~detail::npy_api::NPY_ARRAY_WRITEABLE_;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
return result.release();
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
#if EIGEN_VERSION_AT_LEAST(3, 4, 0)
|
|
493
|
+
|
|
494
|
+
static constexpr bool needs_writeable = !std::is_const<typename std::remove_pointer<
|
|
495
|
+
typename get_storage_pointer_type<MapType>::SPT>::type>::value;
|
|
496
|
+
#else
|
|
497
|
+
// Handle Eigen bug
|
|
498
|
+
static constexpr bool needs_writeable = !std::is_const<Type>::value;
|
|
499
|
+
#endif
|
|
500
|
+
|
|
501
|
+
protected:
|
|
502
|
+
// TODO: Move to std::optional once std::optional has more support
|
|
503
|
+
std::unique_ptr<MapType> value;
|
|
504
|
+
|
|
505
|
+
public:
|
|
506
|
+
static constexpr auto name = get_tensor_descriptor<Type, true, needs_writeable>::value;
|
|
507
|
+
explicit operator MapType *() { return value.get(); }
|
|
508
|
+
explicit operator MapType &() { return *value; }
|
|
509
|
+
explicit operator MapType &&() && { return std::move(*value); }
|
|
510
|
+
|
|
511
|
+
template <typename T_>
|
|
512
|
+
using cast_op_type = ::pybind11::detail::movable_cast_op_type<T_>;
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
PYBIND11_NAMESPACE_END(detail)
|
|
516
|
+
PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
pybind11/eigen.h: Transparent conversion for dense and sparse Eigen matrices
|
|
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 "eigen/matrix.h"
|