Boost logo

Boost Users :

Subject: Re: [Boost-users] BoostSerialization callinga customserialize method
From: Pooyan Dadvand (pooyan_at_[hidden])
Date: 2010-08-27 14:15:33


_______________________________________________________________________________________________________________________________________________________________________________

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 08:50 PM, Robert Ramey wrote:
> Pooyan Dadvand wrote:
>
>
>> 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<VariableData*, void*> and for this reason I need
>> the help of VariableData derived class to give the serialization the
>> necessary type information. Actually I get the following error using
>> the normal serialization method as you suggest:
>>
>> /usr/local/include/boost/archive/detail/oserializer.hpp:465: error:
>> 'void*' is not a pointer-to-object type
>>
> ahh - Ok
>
> std::pair<VariableData*, void*> m_x
> ...
> ar<< m_x
>
> of course won't work- my mistake - since there is no way
> to determine what the true type is.
>
> So how about one of the following?
>
> struct extradata {
> ...
> };
>
> std::pair<VariableData, extradata> m_x
> std::pair<VariableData&, extradata&> m_x
> std::pair<VariableData *, extradata*> m_x
> std::pair<VariableData*, extradata&> m_x
> ...
> ar<< m_x;
>
>
Can you please explain me more the idea of extradata structure? Consider
that my extradata can be a double, ublas::vector, or even
std::vector<weak_ptr<Element> > or any new type of variables. I have:

std::vector<std::pair<VariableData, extradata> > mData
...
ar<< mData;

and each element of vector can have a different type of data with
different size or even have pointers. (It's a heterogeneous container)
In this situation I don't know how to implement the extradata structure
without knowing the type of variable I'm storing in it.

> Robert Ramey
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>

Bests,

Pooyan.



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