6/4/08

What is Serialization ? Explain in detail.

Its a process of storing objects to the disk( persistent ) storage and retrieving stored objects from disk storage.

To add this functionality to a class
1. That class must be derived from CObject.

2. Need to add two macros DECLARE_SERIAL and IMPLEMENT_SERIAL.

1. Once inside the class declaration and another outside the class.
2. Following arguments we need to pass to the IMPLEMENT_SERIAL macro
The class name, the base class name, and the version number

3. CArchive Class is used for storing and retrieving information.

1. By default CArchive class uses CFile to write objects.
2. By default it writes objects in Binary mode.
3. One can determine if CArchive is reading or writing the objects. by calling the IsStoring or IsLoading functions.

1 comment:

shadab said...

It's a very nice and brief article.