|
Boost Users : |
Subject: [Boost-users] [serialization] How to deserialize only a part of an XML archive?
From: luca (luca.penasa_at_[hidden])
Date: 2013-12-05 13:05:48
This is my scenario:
I've got a shared library in which these classes are defined:
class base
{
...
serialize()
...
}
class parent: public base
{
...
serialize(...) {...serialize base. and itselft too!}
...
}
the shared lib is used by a computational application that re-implements
class parent in an extended version - this because the app is a Qt
application that does visualization etc...:
class grandParent: public parent
{
//it also defines some specific serialization capabilities:
serialize (...) {serialize parent and also itself}
}
Now if I serialize into an XML archive an instance of grandParent I am
clarly able to deserialize it in a grandParent object, but what about to
deserialize it as a parent object?
if I serialize from grandParent I would get something like:
<grandParent>
<parent>
<base>
</base>
</parent>
</grandParent>
I would need to deserialize only the parent part:
<parent>
<base>
</base>
</parent>
In practice I would like to be able to deserialize an XML archive to a
base class instead that to the derived. But in this case the derived
class is not accessible by boost (that thus complains about it)
In this way I would get the better inter-operability between my
application and the underlaying lib, that must be able to run without
the app itself...
Many thanks!
Luca
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net