Solved

Serializing with version schemas

Posted on 2002-03-12
6
239 Views
Last Modified: 2013-11-20
I have a simple question about serializing objects.
following scenario:

having three classes A, B, C
C is derived from B which is derived from A; A itself is derived from CObject:

CObject
|
A
|
B
|
C

Each class has its own Serialize() function. Each class is responsible
for storing/loading its specific member variables.
To store/load the additional variables of the base calss(es), it first
calls Serialize() from the base class.

Now my question:
Is it possible to use versionable schemas here ?
I've tried it and my problem is that only the function in the
"first Serialize()-level" gets the schema number.
All other functions get "-1" for archive number.

I can't believe that the Microsofties didn't take this into their
design goals since this this object oriented programming at a very
basic level ...

I appreciate your comments.
0
Comment
Question by:Pacman
6 Comments
 
LVL 2

Expert Comment

by:christophm
ID: 6857271
Hi Pacman,
The 'version' (when serializing classes / persisting data) is the 'version_of_the_Archive' and is not used as a version level/indicator for different types of objects stored in the archive. I once looked up exactly what goes in a 'document' in the uSoft document/view paradigm and the/a version is stored only once (though the archive may contain objects of many different classes).
good luck - christophm
0
 
LVL 9

Author Comment

by:Pacman
ID: 6859761
The version of the archive ? I never heard of that.
You can write different objects with different schema numbers in one archive. Each object has its own schema number.
0
 
LVL 2

Expert Comment

by:christophm
ID: 6861335
Hi Pacman, - You are correct, I typed without thinking, the version number is part of the object not the Archive.

I just looked in all my reference stuff - I didn't find a black and white answer.  Blaszczak's book (V5) says the version "identifies the version of the object that created the serialized information".  Since "A" and "B" were not serialized (the descendant "C" was) then the serialized object has only the version number of "C".  Also mentioned was that a -1 version (a UINT) was reserved for MFC.  

I agree, it doesn't seem to fit the "OO" plan.  
Sorry to have mispoke - chris-m
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 9

Author Comment

by:Pacman
ID: 6863717
Hi chris,

thank you for your comments.

>> Also mentioned was that a -1 version (a UINT) was reserved for MFC.

Yes, that's if you call GetObjectSchema() twice.
The first time you get the correct schema number.
From then on you always get -1.

Guess I've to store my own schema number.
Pacman
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10401817
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
PAQ - refund points
Please leave any comments here within the next four days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

AndyAinscow
EE Cleanup Volunteer

0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10434973
PAQed, with points refunded (50)

modulo
Community Support Moderator
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Line meaning 9 87
Making an alias 7 101
Way to decrease size of apk file 9 86
Problem to App source 6 70
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question