Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization] XML: Necessity of attribute class_id although class_name is given
From: Frank Stähr (staehr_at_[hidden])
Date: 2014-07-29 04:38:46


Am 28.07.2014 21:28, schrieb Robert Ramey:
> Frank Stähr wrote
>> I would like to know what the purpose of the xml attribute class_id is,
>
> In the case of pointers - to know what kind of object to create

I would not ask if it would be so easy ;-)

Your answer sounds as if every class has its own (fixed) class_id. That
would be ok, too. But I really think its more like a counter for classes
that have not been serialized “up to now”.

>> how it works and in which cases it can be omitted.
>
> archives contain only essential information. Nothing can be omitted without
> breaking the archive

Perhaps in boost, but the class_id is obviously not necessary when a
class_name is given, or? See my example.

>> The problem now is: Although the exact classes are given by
>> human-readable class names (and used!), you cannot omit or change the
>> class_id. If you edit the XML file by hand, it can become invalid (->
>> exception on reading). It seems that the class ids are just ascending
>> non-negative numbers.
>>

So once again:

>> What are the rules for choosing the class ids? Why are they necessary?
>> Is there a trick to remove this attribute or at least to ignore it?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net