Boost logo

Boost Users :

Subject: Re: [Boost-users] Serialization of a complex data structure
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2010-05-10 10:02:06


Marco Meoni - Sbaush wrote:
> Hi all.
> I understood how to serialize correctly nested structures, defining
> serialize method inside all.
>
> I've a problem with an attribute of a struct. The attribute is border of
> OpenCV CvSeq type.
>
> Here is my code... what can i do to solve this?
>
>
> struct Element{
> unsigned int id;
> double area;
> double perimeter;
> CvRect bounding_box;
> CvSeq* border;
> ...
> ...
> };
>
> namespace boost {
> namespace serialization {
>
> template<class Archive>
> void serialize(Archive & ar, Element & g, const unsigned int version)
> {
> ar & g.id <http://g.id>;
> ar & g.area ;
> ar & g.perimeter ;
> ar & g.bounding_box.width ;
> ar & g.bounding_box.height ;
> ar & g.bounding_box.x ;
> ar & g.bounding_box.y ;
> // ar & g.border; I CAN'T DO THIS...

You need to do the same for CvSeq that you did for Element:

template<class Archive>
void serialize(Archive& ar, CvSeq& aCvSeq , const unsigned int)
{
...

Jeff


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