Boost logo

Boost Users :

Subject: [Boost-users] Boost Serialization calling a custom serialize method
From: Pooyan Dadvand (pooyan_at_[hidden])
Date: 2010-08-18 08:27:24


Hi,

 

I’m trying to use the boost serialization in our project “Kratos” (a
Multi-physics finite element code) in which I found the following problem, I
have a class Variable which is derived from VariableData as follow:

 

Class VariableData

{

                std::size_t mKey;

public:

.....

};

 

template<class TDataType>

class Variable : public VariableData

{

....

}

 

Now I have a container which holds a pairs, consist of VariableData pointer
to the Variable and a void* pointer to its value:

 

std::vector<std::pair<const VariableData*, void*> >

 

which I want to serialize but as it can be seen I don’t have the pointer to
data in my variable and I might need to implement a costumized version of
Serialized with void* pValue as an additional parameter for VariableData and
Variable classes:

 

template<class TArchiveType>

Variable::serialize(TArchiveType &rArchive, const unsigned int Version,
void* pValue)

{

                rArchive & static_cast<TDataType>(pVAlue);

}

 

 The problem here is the template definition of this method which make it
impossible to be virtual. I note that the library uses
get_extended_type_info for this porposed. But I don’t know how is its
correct way of use. Can anybody give me a hint about how I can handle this
problem?

 

Just to add some restriction:

- I don’t want to add a hierarchy of handlers instead of pair
because it adds another pointer jump to the container and reduce its
performance in normal use of it

- I don’t want to add a version of non template members for each
archive type while it makes a lot of duplications and makes extra dependency
to the archive types in a layer of code which is not expected to have this
dependency

 

Thanks,

 

Pooyan.

 

____________________________________________________________________________
____________________________________________________________________________
_______________________

Dr. Pooyan Dadvand

Member of Kratos team

International Center for Numerical Methods in Engineering - CIMNE
Campus Norte, Edificio C1

c/ Gran Capitán s/n

08034 Barcelona, España

Tel: (+34) 93 401 56 96

Fax: (+34) 93.401.65 17

web: <http://www.cimne.com> www.cimne.com

               <http://www.cimne.com/kratos/> www.cimne.com/kratos/

____________________________________________________________________________
____________________________________________________________________________
_______________________

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.

 

 



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