|
Boost Users : |
From: Stefan Holzmann (Stefan.Holzmann_at_[hidden])
Date: 2007-03-23 18:45:32
Sorry I think the explanation of my problem wasn't clear enough.
I want to store some of my objects into a different archive without
duplicating them. I have some kind of project file (Workspace) at my
application which should be the "main" archiv and several document files
(measurment data).
The serialization process always start by loading/save this workspace
object, because this object stores the location of the current opened
measument objects.
I noticed that I can create and load this kind of archiv structue as
following:
template<class Archive>
void save(Archive & ar, const unsigned int version) const
{
ar & BOOST_SERIALIZATION_NVP(m_FileName); // store the
file name of the archiv
std::ofstream ofs(m_FileName.c_str());
assert(ofs.good());
boost::archive::xml_oarchive oa(ofs);
oa << BOOST_SERIALIZATION_NVP(m_SignalList); // store the
child objects into the new archiv
}
But I don't know how I can serialize a reference on a object located at a
different archiv. I need such references from workspace object to store a
persistent view object.
The Object Tracking works only within a archive.
Any ideas or suggestions on this problem?
Regards,
Stefan
>Von: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] Im Auftrag von Robert Ramey
>Gesendet: Freitag, 23. März 2007 17:09
>An: boost-users_at_[hidden]
>Betreff: Re: [Boost-users] Serialization: Serialize into multiple archives
>
>
>"Stefan Holzmann" <Stefan.Holzmann_at_[hidden]> wrote in message
news:34183.4475555972$1174634703_at_news.gmane.org...
>Hello,
>
>I'am new to the boost serialize libary and have the following question.
>
>At my data acquisition application I have a workspace object which contain
several recorded data objects (measurements) which should be stored into
>separate archives.
>
>**** The first idea that occurs to me would be to use the iostreams library
to create a fancier stream which transform any write into two separate
>ones. Since the serialization library relies on streams, this would create
multiple archives from one serialization.
>
>
>The workspace objects needs to store references (weak pointers) on objects
inside the measurement archives (e.g. references from views which should be
>serialized).
>
>**** which it can do. The will automatically serialize the references
being pointed to.
>
>It should be possible to have the same measurement archive references from
more than one workspace object.
>
>**** If the archives are reloaded- you'll get new instances of the
referenced views. Probably not what you want.
>
>Is this possible with the boost serialization libary?
>
>*** You might be able to get what you want. But this would require a
deeper understanding of the library than is usually necessary.
>
>Righ now I don't know how the object tracking is working in detail, is
there a more detailed documentation on this?
>
>*** read the docs and the code.
>
>Robert Ramey
>
>Stefan
________________________________________
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
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