Re: [Quantity-devel] [Echempp-devel] Clarifications about boost::serialization
Brought to you by:
berndspeiser
From: <ber...@t-...> - 2007-04-10 08:29:11
|
Dominik Brugger wrote: > Hi, > > well this is certainly one of the many "feature clashs" that > make C++ so troublesome. The core problem is > instantiation of templates, which occurs *after* the preprocessor > run. For this reason no automatic generation of names > is possible for template classes. > > The only solution I see is the one proposed in the newsgroup, > that is using typeid. This will obviously work as long as we > use the same compiler and portability across different platforms > is not an issue. We could establish an additional mechanism, which is maybe not VERY elegant, but it should work: we add a static const std::string ID to each class to be serialized (we have to add some code anyway ...). This can be related to the Name of the class, in the case of templates, we need also to code in some way the ID of parametrizing classes. I had done this for the old version of XML save/load in ExcitationFunction. Although this will be obsolete soon (when we have introduced the sreialization concept), it might be a model. Now, I have started to do something like this in the context of serialization with the Quantity classes. I will upload this to cvs later this morning. I have coded into this template serialization ID (TSID) the Quantity, the storage unit and the mode of the quantity into one string, which is then given to BOOST_CLASS_EXPORT_GUID - unfortunately not yet automatically. I am afraid - and I agree with the above - that we might have to substitute the preprocessor macros by some template construct ... Another problem which I have in the moment, is that I need to code the `storage type' (i.e., is the Quantity given as int, double, bool, etc) into the TSID. Does anyone know about some code which does convert a POD type into a corresponding string? Also, the TSID construction is not yet complete for some units (the Composed units) and some modes of quantities. Bernd -- ======================================================================= Bernd Speiser Institut für Organische Chemie Auf der Morgenstelle 18 D-72076 Tübingen Germany phone: +49-7071-2976205 (office) +49-7071-2976242 (laboratory) fax: +49-7071-295518 e-mail: ber...@un... Internet: http://www.uni-tuebingen.de/speiser ======================================================================= |