My Understanding of MFC serialization
来源:互联网 发布:清除上网痕迹软件 编辑:程序博客网 时间:2024/04/29 16:09
First, I am Chinese, but I'd like to write in English, if that really disgut you a lot, please choose to ignore me.
and those who can bear with my sucking English, read on.
Serialization
every object that is serializable must be dynamic creatable first,
in order to be dynamic creatable, an object or the objects of the same class
must have some runtime type information associated with it.
the runtime type information is represented by an instance of the CRuntimeClass in MFC.
DECLARE_DYNAMIC
DECLARE_DYNCREATE
DELCARE_SERIAL
IMPLEMENT_DYNAMIC
IMPLEMENT_DYNCREATE
IMPLEMENT_SERIAL
these sex macros are used associate an instance of CRuntimeClass with the class and
connect the runtime type information of one class with the MFC runtime type maps.
following is a brief overview of the steps in serializing an object.
an object, of used defined types, can be saved in
two ways, either by call its serialize member function, or call the insertion operator.
there is a insertion operator is defined for objects of CObject, since all serializable objects, except
primative types and CStirng, are derived from CObject whether directly or indirectly.
so serializable objects are CObject objects, the operator function will first save the CRuntime Object
associated with the class that the object belongs to. and then call the object's overrided serialize
member function. the key point is that every object takes care of itself(from MSDN).
the macros will create an overloaded extraction operator for the class, but that is just for verification.
and it is optional.
when to use operator , when to use serialize funciton?
the answer is it depends.
the general guidline is that use serialize when you know the type of the object being serialized,
I mean its exactly type, so if CDerived is derived from CBase, a CDerived object is a CBase object, but
they are different here.
use the operator when there are polymorphism.
the last rule is that, if you use serialze to save an object, you must also use serialize to load it.
any body wanna read this kind of stuff pleae go to http://www.aeonity.com/JumboGeng, my blog,
and it is more up to date.
- My Understanding of MFC serialization
- My Understanding of MQSeries
- My understanding of Enum(enumerate)
- My understanding of OAuth 1.0
- My understanding of OAuth 2.0
- My understanding of Object Oriented C++
- My understanding
- The core of cloud computing in my understanding
- my understanding of (lower bound,upper bound) binary search, in C++, thanks to two post
- MFC 串行化(Serialization)
- Understanding of extern "C"
- The Understanding of KMP
- simple understanding of manifest
- [VC++(MFC)]串行化(Serialization)
- 串行化(Serialization)(MFC)
- XML Serialization of Java Objects
- Understanding Bootstrap Of Oracle Database
- Understanding NUll values of Oracle
- 高手的思路[ZT]
- Learn Windows XP In Pictures
- Ida Pro v5.0.0.879 Advanced Full
- 白皮书:移动电子邮件
- 下一代Web服务的基础框架——SOA技术论坛报道
- My Understanding of MFC serialization
- 数据挖掘过程
- 获取当前对象的某一个匹配tagName的父节点对象
- 首批国外专家blog志愿者翻译人员诞生了!
- 高亮度显示所选择表格的某一行
- 个性化皮肤应用
- geoserver显示shapefile中汉字呈乱码问题的可选解决方案
- 在SQL Server中如何进行错误捕捉
- find