Boost logo

Boost Users :

Subject: Re: [Boost-users] Turn off the Header
From: Robert Ramey (ramey_at_[hidden])
Date: 2008-11-27 11:23:38


"Dinesh Kumar R" <rite2dinesh_at_[hidden]> wrote in message
news:e752274c0811270508i3f0b6255udfdb31560f6ea74a_at_mail.gmail.com...
Hi Guyz,

Can you please tell me how to turn off the following in Boost Serailization?
I dont need the following in my document.
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="3">

Use "no_header" flag when you open the archive.

How do I Serialize an array of Object?

eg:
class simulated_defects
{
    friend class boost::serialization::access;
  // friend std::ostream & operator<<(std::ostream &os, const
simulated_defects &gp);

public:
    int defect_num[10];
    int defect_pos;
    int defect_area;
    float defect_type;

    template<class Archive>
    void serialize(Archive & ar, const unsigned int /* file_version */){
        ar & BOOST_SERIALIZATION_NVP(defect_num)
            & BOOST_SERIALIZATION_NVP(defect_pos)
            & BOOST_SERIALIZATION_NVP(defect_area)
            & BOOST_SERIALIZATION_NVP(defect_type);
    }
};

simulated_defects object[10]; to serialize array of object , I need a
wrapper to define this object inside a class and then serailize, is there
any straight forward method? If i use loop to serialize the Headers at the
top of xml file is inserted at start of each loop?

use:

simulated_defects objectst[10];
...

ar << objects;

Robert Ramey


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