Serialising templates with smart pointers....
I have the following: _*1. An interface:*_ class IDeviceClientRequest { public: /** Empty virtual destructor. */ virtual ~IDeviceClientRequest() {} /** Virtual methods to invoke on the smart pointer. */ virtual EClientMessageIdentifier getMessageId() = 0; }; // IDeviceClientRequest _*2. A template class:*_ template<class Request> class CDeviceClientRequest : public IDeviceClientRequest { public: // ... I have excluded the majority of the code for conciseness // ... private: /** * Serialize or de-serialize the object. * * @param archive * When the class Archive corresponds to an output archive, the * & operator is defined similar to <<. Likewise, when the class Archive * is a type of input archive the & operator is defined similar to >>. * @param version * Version identifier for backwards compatibility between objects. */ friend class boost::serialization::access; template<class Archive> void serialize(Archive &archive, const unsigned int version) { archive & m_iMessageId & m_oData; } }; // CDeviceClientRequest _*3. A method to serialize from a file:*_ // Server receieves a request. void devices::comms::CDeviceCommunication::receiveRequest( std::unique_ptrdevices::request::IDeviceClientRequest& request) { // Open the file for read. std::ifstream file(getFilename().c_str()); // Use boost to serialize the object from the file. boost::archive::binary_iarchive archive(file); archive >> *request; // Close the file. file.close(); } What do I need to add to the interface class to stop the following compile error: error C2039: 'serialize' : is not a member of 'devices::request::IDeviceClientRequest' Thanks, -- Marcus A.T MacWilliam, Senior Software Engineer. 1Spatial Ltd. Tel: +44 (0)1223 420414, ext 2289, Mob: +44 (0)7803 706597. E-Mail: marcus.macwilliam@1spatial.com Skype:marcus.macwilliam Tennyson House, 7 Cambridge Business Park, Cambridge, CB4 0WZ. Registered in England No. 4785688, VAT Reg. No. 135539408. Website: http://www.1spatial.com/ E-mail: info@1spatial.com
participants (1)
-
Marcus MacWilliam