_______________________________________________________________________________________________________________________________________________________________________________
Dr.
Pooyan Dadvand
International Center for Numerical Methods in
Engineering - CIMNE
Campus Norte, Edificio C1
c/ Gran Capitán
s/n
08034 Barcelona, Spain
Tel: (+34)
93 401 56 96
Fax: (+34)
93 401 65 17
web: www.cimne.com
<http://www.cimne.com>
_______________________________________________________________________________________________________________________________________________________________________________
AVISO
IMPORTANTE
Los
datos de carácter personal contenidos en el mensaje, se registrarán
en un fichero para facilitar la gestión de las comunicaciones de
CIMNE. Se pueden ejercitar los derechos de acceso, rectificación,
cancelación y oposición por escrito, dirigiéndose a nuestras
oficinas de CIMNE, Gran Capitán s/n, Edificio C1 - Campus
Norte UPC, 08034 Barcelona, España.
AVÍS
IMPORTANT
Les
dades de caràcter personal contingudes en aquest missatge es
registraran en un fitxer per facilitar la gestió de les
comunicacions del CIMNE. Es poden exercir els drets d'accés,
rectificació, cancel·lació i oposició, per escrit a les nostres
oficines del CIMNE, Gran Capità s/n, Edifici C1, Campus Nord UPC,
08034 Barcelona, Espanya.
IMPORTANT
NOTICE
All
personal data contained in this mail will be processed confidentially
and stored in a file property of CIMNE in order to manage corporate
communications. You may exercise the right of access, rectification,
deletion and objection by letter sent to CIMNE, Gran Capitán,
Edificio C1 - Campus Norte UPC, 08034 Barcelona, Spain.
Pooyan Dadvand wrote:Do you know any boost tool to get the pointer to the derive class like this: template<class TArchiveType> MyContainer::serialize(TArchiveType &rArchive, const unsigned int Version) { boost_tool_to_get_drived_class_pointer(p_variable_data)->MyCustomSerialize(rArchive, Version, MyData); }I'm not going to tell you how to do this because doing this won't help you ! Reread the section of the documentation which addresses serialization of pointers. It discusses the serialization of an object through a pointer to the virtual base class
so all you have to do is base_class *m_bc; // where base class is a virtual base class. ar << m_dc
It keep track of "serialize" method with two parameters and I need an additional parameter!The serialization library keeps track of the "true" (most derived) class and call the serialize function on THAT class. You don't have to do anything to get what you want.
Of course I'm doing something wrong, for this reason I'm asking the correct way. however I don't see an easy solution to my problem looking to the examples for the very standard cases.I would suggest you look through the tests/examples (there are 50+ in the library!) and find one that does this and study it.Or tell me how the following code in oserializer.hpp can be used for my case<snip> the above example ar << m_dc will in fact use that code. One time we had a similar thread. The final result was "Oh - this is really simple - once you see it!" So if what you want to do is NOT simple, you're doing it wrong.
I have already done this.Start make taking one of your types serialize it make a small test to prove that it works.
Exactly the methodology I'm using.Add the next higher type and repeat
I have already done this and it works.make a test which does the above through a pointer and repeat
I have already serialized several classes in my library with pointer to the base classes and they are working.add a virtual base class and repeat
Robert Ramey _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users