|
Boost Users : |
Subject: Re: [Boost-users] [Serialization] XML: Necessity of attribute class_id although class_name is given
From: Robert Ramey (ramey_at_[hidden])
Date: 2014-07-28 15:28:15
Frank Stähr wrote
> Hello everybody,
>
> 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
> how it works and in which cases it can be omitted.
archives contain only essential information. Nothing can be omitted without
breaking the archive
> An example: âBaseâ is the (abstract) base class of _GMTF_ and _TTF_, and
> _Hist_ also has got a similar base class.
>
> If a pointer of Hist is a member of GMTF and you want to serialize a
> pointer of Base, you get something like:
> <filter class_id="0" class_name="GMTF">
>
> <m_bufHalfMaxSize>
> 4
> </m_bufHalfMaxSize>
>
> <m_cutDetector class_id="1" class_name="Hist">
> </m_cutDetector>
> </filter>
> Here, the macros
> ⢠BOOST_CLASS_EXPORT_GUID(...),
> ⢠BOOST_CLASS_IMPLEMENTATION(...,
> boost::serialization::object_serializable) and
> ⢠BOOST_CLASS_TRACKING(..., boost::serialization::track_never)
> are used.
>
> 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.
>
> 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?
>
>
> Thanks,
> Frank
>
>
> --
> Frank Stähr
> Technische Universität Berlin
> Communication Systems Group
> Sekr. EN1 Einsteinufer 17
> 10587 Berlin, Germany
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_.boost
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- View this message in context: http://boost.2283326.n4.nabble.com/Serialization-XML-Necessity-of-attribute-class-id-although-class-name-is-given-tp4665615p4665624.html Sent from the Boost - Users mailing list archive at Nabble.com.
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