Serialization
-
I am creating a SDI application. The document keeps track of a single instance of a grid class which I need to save the state of. I have derived the grid class from CObject and am using the Serialize member function of the document class. My problem is that it does not seem to save anything of the user-defined grid class. I tried just saving an int value as well to make sure that it was actually serializing properly and it was. I derived my class (Grid) from CObject and placed the line DECLARE_SERIAL( Grid ) in the public section, and finally placed IMPLEMENT_SERIAL(Grid,CObject,1) at the bottom of my document class but no joy. Any ideas as to what I'm doing wrong? Thanks for any help in advance Nick :confused:
-
I am creating a SDI application. The document keeps track of a single instance of a grid class which I need to save the state of. I have derived the grid class from CObject and am using the Serialize member function of the document class. My problem is that it does not seem to save anything of the user-defined grid class. I tried just saving an int value as well to make sure that it was actually serializing properly and it was. I derived my class (Grid) from CObject and placed the line DECLARE_SERIAL( Grid ) in the public section, and finally placed IMPLEMENT_SERIAL(Grid,CObject,1) at the bottom of my document class but no joy. Any ideas as to what I'm doing wrong? Thanks for any help in advance Nick :confused:
Have you implemented the virtual function 'Serialize' in your grid class? To make your grid class reusable, put IMPLEMENT_SERIAL(Grid,CObject,1) in your grid.cpp istead. In your doc class' Serialize call: m_mygrid.Serialize(ar); In your grid class Serialize you need to store and load all grid information. /Niklas