1#ifndef BOOST_SERIALIZATION_BINARY_OBJECT_HPP
2#define BOOST_SERIALIZATION_BINARY_OBJECT_HPP
3
4// MS compatible compilers support #pragma once
5#if defined(_MSC_VER)
6# pragma once
7#endif
8
9/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10// nvp.hpp: interface for serialization system.
11
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)
16
17// See http://www.boost.org for updates, documentation, and revision history.
18
19#include <boost/assert.hpp>
20
21#include <cstddef> // std::size_t
22#include <boost/config.hpp>
23#if defined(BOOST_NO_STDC_NAMESPACE)
24namespace std{
25 using ::size_t;
26} // namespace std
27#endif
28
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>
35
36namespace boost {
37namespace serialization {
38
39struct binary_object :
40 public wrapper_traits<nvp<const binary_object> >
41{
42 void const * m_t;
43 std::size_t m_size;
44 template<class Archive>
45 void save(Archive & ar, const unsigned int /* file_version */) const {
46 ar.save_binary(m_t, m_size);
47 }
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);
51 }
52 BOOST_SERIALIZATION_SPLIT_MEMBER()
53 binary_object & operator=(const binary_object & rhs) {
54 m_t = rhs.m_t;
55 m_size = rhs.m_size;
56 return *this;
57 }
58 binary_object(/* const */ void * const t, std::size_t size) :
59 m_t(t),
60 m_size(size)
61 {}
62 binary_object(const binary_object & rhs) :
63 m_t(rhs.m_t),
64 m_size(rhs.m_size)
65 {}
66};
67
68// just a little helper to support the convention that all serialization
69// wrappers follow the naming convention make_xxxxx
70inline
71const binary_object
72make_binary_object(/* const */ void * t, std::size_t size){
73 return binary_object(t, size);
74}
75
76} // namespace serialization
77} // boost
78
79#endif // BOOST_SERIALIZATION_BINARY_OBJECT_HPP
80

source code of boost/boost/serialization/binary_object.hpp