Boost logo

Boost Users :

From: Marc Wäckerlin (marc_at_[hidden])
Date: 2007-01-22 05:17:35


Brian Stempel wrote:
> I am wanting to serialize some C++ data structures
> into a binary stream, and I'm wanting to send that
> binary stream to an embedded python interpreter, where
> it can unpack the data and make use of it.

I have exactly the same problem: I need several kind of my own defined
streamer. One is to write binary data 1:1, as Brian would like to do; my
other idea is: Use the operator& syntax to stream either into a file, or
into an SQL database, depending on the streamer (in my idea, the
SQL-streamer would be similar to the existing XML-archive, but the XML-tags
would here name tables and column names).

Now I started by reading the "Serialization Archive Class Reference" on
http://boost.org/libs/serialization/doc/archive_reference.html, which
describes how to implement my own archive.

Unfortunately, if I copy the code from the "simplest possible output
archive" there into a header file, then write a code file that does nothing
except including that header, the result is not compilable (GNU g++ 4.1.2).

First problem:

friend class boost::archive::load_access is undefined, so I have to add a
forward declaration:
namespace boost {
  namespace archive {
    class load_access;
  }
}

Second problem (see attached test.cpp):

> g++ test.cpp
/usr/include/boost/archive/detail/interface_iarchive.hpp: In member
function ‘const boost::archive::detail::basic_pointer_iserializer*
boost::archive::detail::interface_iarchive<Archive>::register_type(T*)’:
/usr/include/boost/archive/detail/interface_iarchive.hpp:54:
error: ‘instantiate_pointer_iserializer’ is not a member
of ‘boost::archive::detail’
/usr/include/boost/archive/detail/interface_iarchive.hpp:58: error: invalid
use of undefined type ‘const struct
boost::archive::detail::basic_pointer_iserializer’
/usr/include/boost/archive/detail/basic_iarchive.hpp:41: error: forward
declaration of ‘const struct
boost::archive::detail::basic_pointer_iserializer’

What's missing?

Thank you
Regards
Marc



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