Solved

Serializing with version schemas

Posted on 2002-03-12
6
236 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

757 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

19 Experts available now in Live!

Get 1:1 Help Now