Solved

Serializing with version schemas

Posted on 2002-03-12
6
238 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeatSeparator  java  challenge 13 57
Adapt this command to show who installed 29 108
canBalance challenge 34 80
mapBully challenge 6 127
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

813 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

12 Experts available now in Live!

Get 1:1 Help Now