_______________________________________________________________________________________________________________________________________________________________________________ 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 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. On 08/27/2010 07:55 PM, Robert Ramey wrote:
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
I have already read it!
so all you have to do is
base_class *m_bc; // where base class is a virtual base class.
ar<< m_dc
I'm already using this for serializing a derived class and it works fine, but it's not the case here.
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.
It keep track of "serialize" method with two parameters and I need an additional parameter!
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.
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.
Start make taking one of your types serialize it make a small test to prove that it works.
I have already done this.
Add the next higher type and repeat
Exactly the methodology I'm using.
make a test which does the above through a pointer and repeat
I have already done this and it works.
add a virtual base class and repeat
I have already serialized several classes in my library with pointer to
the base classes and they are working.
But it's not what I'm asking. What I'm asking is a very special case in
which the serialize don't have enough information to deal with my void*
in std::pair
Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Thanks, Pooyan.