Boost logo

Boost :

From: Marcin Kalicinski (kalita_at_[hidden])
Date: 2006-04-21 17:22:49


>> : > How would you look at ptree being a possible target format (Archive)
>> : > for boost::serialize ?
>> :
>> : I am not sure I understand: how PT could be an Archive? Archive if I am
>> not
>> : mistaken is the model of permanent storage. PT is the model of
>> in-memory
>> : storage.
>> ... which is why PT is very complementary.

There are reasons that you might want to have it as an archive target. You
get archives in JSON, INI, Registry formats for free, and even an
alternative format for XML. I have actually implemented an Archive class
that uses ptree, so it definitely is possible and quite easy also. I might
post it in the future when I make it somewhat more general (it's just a
quick hack now). Truth is, it is not very fast, but if you want a sample of
archive in JSON, here you go:

{
    "d":
    {
        "class_id_type": "1",
        "class_name_type": "class Derived",
        "tracking_type": "0",
        "version_type": "0",
        "Base":
        {
            "class_id_optional_type": "0",
            "tracking_type": "0",
            "version_type": "0",
            "b": "78"
        },
        "d": "111"
    },
    "d2":
    {
        "class_id_type": "1",
        "Base":
        {
            "b": "11"
        },
        "d": "146"
    },
    "b":
    {
        "class_id_type": "0",
        "b": "52"
    },
    "i": "3",
    "v":
    {
        "class_id_optional_type": "2",
        "tracking_type": "0",
        "version_type": "0",
        "count": "5",
        "item":
        {
            "count": "3",
            "item": "1",
            "item": "2",
            "item": "3"
        },
        "item":
        {
            "count": "0"
        },
        "item":
        {
            "count": "0"
        },
        "item":
        {
            "count": "0"
        },
        "item":
        {
            "count": "0"
        }
    }
}

Kind regards,
Marcin


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk