Binary data-structure serialization

Jacob Carlborg doob at me.com
Mon Jun 7 04:37:17 PDT 2010


On 2010-06-06 21:32, Eric Poggel wrote:
> On 6/1/2010 5:31 PM, Robert M. Münch wrote:
>> On 2010-06-01 02:13:18 +0200, Eric Poggel said:
>>
>>> After having difficulty getting ddbg to work, I decided to write a
>>> dump function so I could easily see my data structures at runtime. The
>>> biggest part of it is a json encoder which can handle most D
>>> structures. If I recall, it only has trouble with enum's and pointers
>>> (since there's no length info).
>>>
>>> It's available in Yage's source here
>>> (http://dsource.org/projects/yage/browser/trunk/src/yage/core/json.d)
>>> Yage is licensed LGPL but I grant permission to use this under the
>>> Boost 1.0 license if you or anyone else needs it.
>>
>> Thanks for this. I will take a look.
>>
>>> However, for now it's only one-way and there's no deserialization part
>>> to it.
>>
>> Well, this part is left for the reader as an exercise ;-).
>>
>
> It seems it also doesn't serialize members of parent classes, which can
> be a major caveat. I took a look at it yesterday but unfortunately
> wasn't able to figure it out.

You can have a look at my serialization library: 
http://dsource.org/projects/orange/ it could use some testing.

* It handles both serializing and deserializing
* It automatically serializes the base classes
* It supports events (before and after (de)serializing)
* It supports non-serialized fields (you can say that some fields in a 
class should not be serialized)
* It's licensed under the Boost license
* It's fairly std/runtime library independent (hopefully it's only the 
XMLArchive that is dependent on the runtime library, I've only tested it 
with Tango)
* You can create new archive types and use them with the existing serializer

* It currently only supports XML as the archive type but the library is 
built so you can create new archive types and use them with the existing 
serializer
* If you want to serialize objects through base class references you 
need to register a serialize function, everything else should be handled 
automatically

You can have a look at an example of usage at the project site.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list