1 #ifndef BOOST_SERIALIZATION_BINARY_OBJECT_HPP
2 #define BOOST_SERIALIZATION_BINARY_OBJECT_HPP
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
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.
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 /* const */ void * const m_t
;
41 const std::size_t m_size
;
42 template<class Archive
>
43 void save(Archive
& ar
, const unsigned int /* file_version */) const {
44 ar
.save_binary(m_t
, m_size
);
46 template<class Archive
>
47 void load(Archive
& ar
, const unsigned int /* file_version */) const {
48 ar
.load_binary(const_cast<void *>(m_t
), m_size
);
50 BOOST_SERIALIZATION_SPLIT_MEMBER()
51 binary_object(/* const */ void * const t
, std::size_t size
) :
55 binary_object(const binary_object
& rhs
) :
61 // just a little helper to support the convention that all serialization
62 // wrappers follow the naming convention make_xxxxx
64 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
68 make_binary_object(/* const */ void * t
, std::size_t size
){
69 return binary_object(t
, size
);
75 struct is_wrapper
<binary_object
>
79 } // namespace serialization
82 // don't need versioning info for this type
83 BOOST_CLASS_IMPLEMENTATION(
85 boost::serialization::object_serializable
88 // don't track binary objects - usually they will be created on the stack
89 // and tracking algorithm (which uses the object address) might get
90 // confused. note that these address will likely be members of some
91 // other structure which itself is tracked, so as a practical matter
92 // suppressing tracking shouldn't cause any redundancy.
94 BOOST_CLASS_TRACKING(binary_object
, boost::serialization::track_never
)
96 #endif // BOOST_SERIALIZATION_BINARY_OBJECT_HPP