Hi:

I am writing some serialization code that uses IOStreams as a filter.

The following is the class I am trying to serialize.

class MIDISurface

{

public:

       // surface variables

std::wstring strSurfaceName;

 

};

The string header file is included.

I then have a template function as follows:

template <class SerializingType>

void SaveData(SerializingType Data, boost::filesystem::path FileName, bool EncryptData)

{

//Check file existance.

if (boost::filesystem::exists(FileName))

//Delete file

boost::filesystem::remove(FileName);

//Now create a WOfstream to serialize the data.

std::wofstream OutputStream(FileName.generic_wstring());

//Create a filtering_stream to allow us to encrypt the data if necessary.

boost::iostreams::wfiltering_stream<boost::iostreams::output> FilteringStream(FileName.generic_wstring());

if (EncryptData)

       //FilteringStream.push(test); //add the encryption filter defined in Encryption.hpp.

FilteringStream.push(OutputStream);

boost::archive::xml_woarchive Archive(FilteringStream); //create an archive and assign the filtering stream.

Archive << BOOST_SERIALIZATION_NVP(Data);

}

I am including the following headers.

//Standard c++ headers.

#include <fstream>

#include <stdlib.h>

#include <string>

#include <boost/iostreams/traits.hpp>

//boost filesystem headers.

#include <boost/config.hpp>

#define BOOST_FILESYSTEM_VERSION 3

#include <boost/filesystem/operations.hpp>

#include <boost/filesystem/path.hpp>

 

//Boost xml serialization headers.

#include <boost/archive/xml_wiarchive.hpp>

#include <boost/archive/xml_woarchive.hpp>

 

//Data type boost serialization headers.

#include <boost/config.hpp>

#include <boost/serialization/string.hpp>

#include <boost/Serialization/Vector.hpp>

#include <boost/Serialization/Map.hpp>

#include <boost/Serialization/nvp.hpp>

//boost io streams header.

#include <boost/iostreams/detail/config/wide_streams.hpp>

#include <boost/iostreams/concepts.hpp>

#include <boost/iostreams/detail/ios.hpp>  // BOOST_IOS.

#include <boost/iostreams/filter/stdio.hpp>

#include <boost/iostreams/operations.hpp>

#include <boost/iostreams/filtering_stream.hpp>

I am using boost 1.47, from the installer from boost pro computing.

Can anyone point in the direction of the solution.

Any help appreciated.

Sean