Boost logo

Boost Users :

Subject: [Boost-users] Problem with serialization!
From: alev mutlu (koor230_at_[hidden])
Date: 2010-03-15 10:38:06


Hi,
I can not write serialization function for my structure.
When I compile this I get very strange errors.
Can someone help me please?

#include <boost/mpi/environment.hpp>
#include <boost/mpi/communicator.hpp>
#include <boost/mpi/collectives.hpp>
#include <boost/thread/barrier.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/config.hpp>
#include <string>
#include <iostream>
#include <vector>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/string.hpp>
#define MASTER 0

using namespace std;
namespace mpi = boost::mpi;

struct field {
    string field_name;
    string field_type;
    string field_ref;
    string field_colType;

};

namespace boost {
    namespace serialization{
        template<class Archive>
        void serialize(Archive & ar, field & f, unsigned int version){
            ar & f.field_name;
            ar & f.field_type;
            ar & f.field_ref;
            ar & f.field_colType;
        }
    }
}

int main(int argc, char* argv[])
{
    mpi::environment env(argc, argv);
    mpi::communicator world;
    int m_mySize, w_mySize, kk,i;
    field *relAllValues;
    field *relMyValues;
    vector<field> C;
    w_mySize = arraySize / world.size();
    if (world.rank() == MASTER){
          m_mySize = arraySize / world.size() + arraySize % world.size();
        relMyValues = (field *) malloc(m_mySize);
        allValues = (int *) malloc(arraySize);
    }
      else{
          relMyValues = (field *) malloc(w_mySize);
      }
      if (world.rank() == MASTER){
          scatter(world, C, relMyValues, w_mySize, 0);
      }
      else{
          scatter(world, a, myValues, w_mySize, 0);
      }
}



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