Thank you very much!

The header option worked out but the other one is not quite working.

simulated_defects object[10];

boost::archive::xml_oarchive oa(ofs);
oa << BOOST_SERIALIZATION_NVP(object);

This only serializes only object[0] but not the complete array.

Any Suggestions?

Herzliche Grüße,
Dinesh Kumar


2008/11/27 Robert Ramey <ramey@rrsd.com>

"Dinesh Kumar R" <rite2dinesh@gmail.com> wrote in message
news:e752274c0811270508i3f0b6255udfdb31560f6ea74a@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 mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users