1 #ifndef BOOST_SERIALIZATION_BINARY_OBJECT_HPP
2 #define BOOST_SERIALIZATION_BINARY_OBJECT_HPP
4 // MS compatible compilers support #pragma once
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // nvp.hpp: interface for serialization system.
12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13 // Use, modification and distribution is subject to the Boost Software
14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
17 // See http://www.boost.org for updates, documentation, and revision history.
19 #include <boost/assert.hpp>
21 #include <cstddef> // std::size_t
22 #include <boost/config.hpp>
23 #if defined(BOOST_NO_STDC_NAMESPACE)
29 #include <boost/preprocessor/stringize.hpp>
30 #include <boost/serialization/tracking.hpp>
31 #include <boost/serialization/level.hpp>
32 #include <boost/serialization/split_member.hpp>
33 #include <boost/serialization/nvp.hpp>
34 #include <boost/serialization/wrapper.hpp>
37 namespace serialization {
39 struct binary_object :
40 public wrapper_traits<nvp<const binary_object> >
44 template<class Archive>
45 void save(Archive & ar, const unsigned int /* file_version */) const {
46 ar.save_binary(m_t, m_size);
48 template<class Archive>
49 void load(Archive & ar, const unsigned int /* file_version */) const {
50 ar.load_binary(const_cast<void *>(m_t), m_size);
52 BOOST_SERIALIZATION_SPLIT_MEMBER()
53 binary_object & operator=(const binary_object & rhs) {
58 binary_object(/* const */ void * const t, std::size_t size) :
62 binary_object(const binary_object & rhs) :
68 // just a little helper to support the convention that all serialization
69 // wrappers follow the naming convention make_xxxxx
72 make_binary_object(/* const */ void * t, std::size_t size){
73 return binary_object(t, size);
76 } // namespace serialization
79 #endif // BOOST_SERIALIZATION_BINARY_OBJECT_HPP