TestObjects.hpp 1.02 KB
Newer Older
Matthieu Dorier's avatar
Matthieu Dorier committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
#ifndef __HEPNOS_TEST_OBJECTS_H
#define __HEPNOS_TEST_OBJECTS_H

#include <boost/serialization/access.hpp>
#include <boost/serialization/string.hpp>

class TestObjectA {

    friend class boost::serialization::access;

    public:

    int& x() { return _x; }
    double& y() { return _y; }

    bool operator==(const TestObjectA& other) const {
        return _x == other._x && _y == other._y;
    }

    private:

    int    _x;
    double _y;

    template<typename Archive>
    void serialize(Archive& ar, const unsigned int version) {
        ar & _x;
        ar & _y;
    }
};

class TestObjectB {

    friend class boost::serialization::access;

    public:

    int& a() { return _a; }
    std::string& b() { return _b; }

    bool operator==(const TestObjectB& other) const {
        return _a == other._a && _b == other._b;
    }

    private:

    int         _a;
    std::string _b;

    template<typename Archive>
    void serialize(Archive& ar, const unsigned int version) {
        ar & _a;
        ar & _b;
    }
};

#endif