直接从 C++ 使用 ZODB。示例和设计提示
我想直接从 C++ 使用 ZODB,并且不想为此编写 Python 代码。你有这样做的经验吗?如果我要使用 C++ 进行 GUI 并从 ZODB 查询/写入数据,应该如何设计?
I'd like to use ZODB directly from C++ and don't want to write Python code for that. Have you had any experience doing so? If I were to use C++ for GUI and quering/writing data from/to ZODB, how the design should be?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
似乎你有 2 个选择
a) 弄清楚如何从 c++ 调用 ZODB python 模块
谷歌显示 boost 有一个库,我相信 python.org 也会告诉你
b) 找出文件格式并用 c++ 编写等效代码
阅读可能并非不可能,写作则更困难。然而,你最终会遇到 python->dynamic、c++->static 的阻抗不匹配,
我不知道 ZODB,但我猜它与 python 对象的动态性质紧密匹配,因此具有与 c++ 通用的等效项不会工作。不过,您将能够创建特定的对象模式实现。我的意思是你可以有一个包含客户、订单、产品的 zodb,并且你可以创建一个将 ZODB 数据映射到等效 C++ 对象的层
seems like you have 2 choices
a) work out how to call ZODB python module from c++
google shows boost has a library, and I am sure python.org will tell you too
b) work out the file format and write the equivalent code in c++
Probably not impossible for reading, harder for writing. However you will eventually end up with the impedance mismatch of python->dynamic, c++->static
I dont know ZODB but I will guess it is tightly matched to the dynamic nature of python's objects and so having a general purpose equivalent for c++ wont work. You would be able to create a particular object schema implementation though. I mean you could have a zodb with Customer, Order, Product and you can create a layer that maps the ZODB data to equivalent C++ objects