Boost logo

Boost Users :

From: Vidal Roca (vidal.roca_at_[hidden])
Date: 2006-06-23 02:45:17


Robert: right, I don't want to do/have neither a) nor b).

The solution that Bill proposes does indeed what I need. However I wanted to
avoid these kind of "global" flags and to know if there are
already some built solutions wihtin the library itself.

Here is my concrete case:

struct parkinglot {
    // static data
    ...
   // simulation data
    ...

    template <class Archive>
    void serialize1(Archive& ar, const unsigned int version) {
        // static data
        // ...
    }

    template <class Archive>
    void serialize2(Archive& ar, const unsigned int version) {
        // simulation data
        // ...
    }

};

I want to serialize static data indendently of the simulation data and vice
versa.
Of course, the best solution would be a redesign of this data structure.
But the question is: does the library offer a solution to declare more than
one form of serialization for the same type of Archive?

Thanks,
Vidal

"Robert Ramey" <ramey_at_[hidden]> schrieb im Newsbeitrag
news:e7eck6$8g8$1_at_sea.gmane.org...
> a) you shouldn't want to do this
> b) you shouldn't have to do this
>
> If you want to do this anyway, try
>
> class Foo {
> void serialize(boost::archive::binary_iarchive & ar, const unsigned int
> version);
> void serialize(boost::archive::text_iarchive & ar, const unsigned int
> version);
> void serialize(boost::archive::binary_oarchive & ar, const unsigned int
> version);
> void serialize(boost::archive::text_oarchive & ar, const unsigned int
> version);
> };
>
>
> Rober Ramey


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