首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 编程语言 > C/C++ > My Understanding of MFC serialization
【标  题】:My Understanding of MFC serialization
【关键字】:My,Understanding,of,MFC,serialization
【来  源】:http://blog.csdn.net/geekmind/archive/2006/07/24/969371.aspx

My Understanding of MFC serialization

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.

在VC++6.0中调用Web Services的方法:【上一篇】
微软笔试题3:【下一篇】
【相关文章】
  • 一个开源的PHP OA groupoffice
  • 使MFC变漂亮一:MFC与Flash交互示例
  • 使MFC变漂亮二:MFC与HTML交互示例
  • 解决phpmyadmin中文乱码
  • 配置Myeclipse下的DB Browser
  • MySQL 不能从远程连接的一个解决方法
  • mysql密码权限问题解决办法
  • Mysql资料
  • Linux下mysql数据库的备份
  • Microsoft IIS ASP Stack Overflow Exploit MS06-034
  • 【随机文章】
  • SQL核心语句(非常实用的几个技巧)
  • servlet2.3规范之四——请求
  • flash组件+PHP+MYSQL的新闻发布系统
  • JBoss jBPM 3.1 User Guide翻译计划之一 --- 第一章 介绍
  • konsole小技巧
  • Alexa排名新高-升7,627位(手机网址之家,www.mobi123.cn)
  • 使用...create datafile ... as ...迁移数据文件到裸设备
  • 悟空传-第十六章
  • 直接用Win2000共享上网
  • 奇迹技能书掉落表~~~!@@
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.