Solved

Serializing with version schemas

Posted on 2002-03-12
6
237 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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 …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

930 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now