#ifndef _DATA_HPP_ #define _DATA_HPP_ #include #include namespace boost { namespace serialization { class access; } namespace archive { class binary_iarchive; class binary_oarchive; } } class Point { int _x; int _y; friend class boost::serialization::access; // template void serialize(boost::archive::binary_iarchive & ar, const unsigned int /* file_version */); void serialize(boost::archive::binary_oarchive & ar, const unsigned int /* file_version */); public: Point() {} Point(int x, int y); virtual ~Point() {} int x() const { return _x; } int y() const { return _y; } virtual void dump(std::ostream&) const; friend std::ostream& operator<<(std::ostream&, const Point&); }; BOOST_SERIALIZATION_SHARED_PTR(Point) class Point3D : public Point { int _z; friend class boost::serialization::access; // template void serialize(boost::archive::binary_iarchive & ar, const unsigned int /* file_version */); void serialize(boost::archive::binary_oarchive & ar, const unsigned int /* file_version */); public: Point3D() {} Point3D(int x, int y, int z); int z() const { return _z; } void dump(std::ostream&) const; friend std::ostream& operator<<(std::ostream&, const Point3D&); }; BOOST_SERIALIZATION_SHARED_PTR(Point3D) class Line { Point _org; boost::shared_ptr _dest; friend class boost::serialization::access; template void serialize(Archive & ar, const unsigned int /* file_version */){ ar & _org & _dest; } public: Line() {} Line(const Point &org, boost::shared_ptr dest); const Point& org() const { return _org; } boost::shared_ptr dest() const { return _dest; } friend std::ostream& operator<<(std::ostream&, const Line&); }; #endif /* _DATA_HPP_ */