通过管道进行序列化

发布于 2024-08-24 18:42:34 字数 332 浏览 19 评论 0原文

我用 C++ 编写了几个模拟程序,并希望用管道连接它们的输出/输入(最好的解决方案可能是使用 C++ 流)。

为此,我想序列化一些对象(例如模拟输出/输入是张量和矩阵)。我应该如何处理这个问题?我在谷歌上搜索了一段时间的序列化+管道,但并没有真正找到任何关于这个的东西......

关于起点有什么提示吗?例如,使用 boost/serialization 与管道交换对象是否容易?一般来说,如果序列化是基于文本的(为了避免舍入错误,我会发送十六进制值而不是十进制),我会很高兴,这样我就可以将输出流重定向到文本文件中,将它们拆分等...这样我也可以可能会在不同的程序中编写我的模拟...

感谢所有答案!

I wrote several simulation programs in C++ and want to connect their outputs/inputs with pipes (best solution would probably be to use the C++ streams).

For this I would like to serialize some objects (for example the simulations output/input are tensors and matrices). How should I handle this problem? I searched around for some time for serialization + pipes on google but was not really able to find anything about this...

Any tips on a starting point? Is it easy for example to use the boost/serialization to exchange objects with pipes? Generally I would be pleased, if serialization is text-based (to avoid rounding errors I would send hex-values rather than decimal), so I could redirect the output streams into textfiles, split them up etc... Also this way I could probably write my simulations in different programs...

Thx for all the answers!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文