// ObjType.hpp #ifndef ObjType_H #define ObjType_H // Base class for all types to be used in object streams. // // Each such object must have a unique name which provides its // identity. #include #include "ref_count/RefCounter.hpp" #include "ptr/Ptr.h" #include "ptr/LocalSharedDeletePolicy.h" class ObjType; class ObjData; // Shared management pointer to ObjType. typedef Ptr ObjPtr; // Creator of ObjType from ObjData. typedef ObjPtr (*ObjCreator) (const ObjData&); class ObjType : public RefCounter { public: // typedefs // Type name. typedef std::string TypeName; public: // static functions // Return the type name for this object. // The name should be unique. // This should be overridden in all subclasses. // The method is not implemented to encourage subclasses to do so. static TypeName get_type_name(); // Return the of the creator for this object. // The creator should be unique. // This should be overridden in all subclasses. // The method is not implemented to encourage subclasses to do so. static ObjCreator get_creator(); public: // Destructor. virtual ~ObjType(); // Output interface. // Subclasses are responsible for implementing this method which // records the data which is to be written out. virtual ObjData write_data() const =0; }; #endif