序列化数据结构用C [英] Serialize Data Structures in C

查看:131
本文介绍了序列化数据结构用C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一个C库,可我的序列化数据结构到磁盘,然后稍后再加载它们。它应该具有循环引用接受任意嵌套的结构,有可能。

I'd like a C library that can serialize my data structures to disk, and then load them again later. It should accept arbitrarily nested structures, possibly with circular references.

我presume这个工具需要一个配置文件描述我的数据结构。该库被允许使用code一代,虽然我相当肯定这是可能做到这一点离不开它。

I presume that this tool would need a configuration file describing my data structures. The library is allowed to use code generation, although I'm fairly sure it's possible to do this without it.

请注意,我不感兴趣的数据可移植性。我想用它作为缓存,这样我就可以靠环境不改变。

Note I'm not interested in data portability. I'd like to use it as a cache, so I can rely on the environment not changing.

感谢。


结果

有人建议 TPL 这是一个真棒图书馆,但我相信,它不会做任意的对象图,如树节点,每个包含其他两个节点。

Someone suggested Tpl which is an awesome library, but I believe that it does not do arbitrary object graphs, such as a tree of Nodes that each contain two other Nodes.

另一个候选是 EET 的,这是在一个项目Enlightenment窗口管理器。看起来很有趣,但同样,似乎没有序列化嵌套结构的能力。

Another candidate is Eet, which is a project of the Enlightenment window manager. Looks interesting but, again, seems not to have the ability to serialize nested structures.

推荐答案

查看 TPL 。从概述:

TPL是序列℃的库
  数据。的数据存储在其
  自然二进制形式。 API是小
  并试图留闪开。
  相比于使用XML,第三方物流的速度更快
  并且更容易在C程序中使用。 TPL
  可序列化许多C的数据类型,
  包括结构。

Tpl is a library for serializing C data. The data is stored in its natural binary form. The API is small and tries to stay "out of the way". Compared to using XML, tpl is faster and easier to use in C programs. Tpl can serialize many C data types, including structures.

这篇关于序列化数据结构用C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆