Andreas Hadjigeorgiou
Andreas Hadjigeorgiou

Reputation: 194

What does it mean to make a Class serializable in Boost.MPI?

I am reading the documentation of the Boost.MPI and I reach a point where it describes how to make Classes serializable, but I actually don't understand what that means and why we want to do it.

this is the Class from the Boost.MPI tutorioal:

class gps_position
{
private:
    friend class boost::serialization::access;

    template<class Archive>
    void serialize(Archive & ar, const unsigned int version)
    {
        ar & degrees;
        ar & minutes;
        ar & seconds;
    }

    int degrees;
    int minutes;
    float seconds;
public:
    gps_position(){};
    gps_position(int d, int m, float s) :
        degrees(d), minutes(m), seconds(s)
    {}
};

Upvotes: 0

Views: 65

Answers (1)

newkid
newkid

Reputation: 1458

It means you are essentially converting the data set into a sequence of bytes in a recoverable manner. Why this is helpful is detailed here in the boost documentation.

Upvotes: 2

Related Questions