直接从 C++ 使用 ZODB。示例和设计提示

发布于 2024-08-17 16:43:29 字数 95 浏览 4 评论 0原文

我想直接从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

当爱已成负担 2024-08-24 16:43:29

似乎你有 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文