Listing 1
// shapes.h #include <SerDef.h> #include <vector> #include <boost/shared_ptr.hpp> class Point { DECLARE_SIMPLE_SERIALIZABLE (Point); public: // ... Point() { m_pt[0] = m_pt[1] = 0.0; } private: double m_pt[2]; }; class Shape : public SER_DECL AbstractSerializable { DECLARE_ABSTRACT_SERIALIZABLE (Shape, AbstractSerializable); // ... public: virtual void draw() = 0; private: int m_shapeId; }; class Circle : public Shape { DECLARE_SERIALIZABLE (Circle, Shape); public: Circle() : m_radius (1.0) {} virtual void draw() { /* ... */ } // ... private: Point m_center; double m_radius; }; class BunchOfShapes { DECLARE_SIMPLE_SERIALIZABLE (BunchOfShapes); // ... std::vector<boost::shared_ptr<Shape> > m_shapes; };