Chris@16: #ifndef BOOST_SERIALIZATION_BINARY_OBJECT_HPP Chris@16: #define BOOST_SERIALIZATION_BINARY_OBJECT_HPP Chris@16: Chris@16: // MS compatible compilers support #pragma once Chris@101: #if defined(_MSC_VER) Chris@16: # pragma once Chris@16: #endif Chris@16: Chris@16: /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 Chris@16: // nvp.hpp: interface for serialization system. Chris@16: Chris@16: // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . Chris@16: // Use, modification and distribution is subject to the Boost Software Chris@16: // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: // See http://www.boost.org for updates, documentation, and revision history. Chris@16: Chris@16: #include Chris@16: Chris@16: #include // std::size_t Chris@16: #include Chris@16: #if defined(BOOST_NO_STDC_NAMESPACE) Chris@16: namespace std{ Chris@16: using ::size_t; Chris@16: } // namespace std Chris@16: #endif Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { Chris@16: namespace serialization { Chris@16: Chris@16: struct binary_object : Chris@16: public wrapper_traits > Chris@16: { Chris@16: void const * m_t; Chris@16: std::size_t m_size; Chris@16: template Chris@16: void save(Archive & ar, const unsigned int /* file_version */) const { Chris@16: ar.save_binary(m_t, m_size); Chris@16: } Chris@16: template Chris@16: void load(Archive & ar, const unsigned int /* file_version */) const { Chris@16: ar.load_binary(const_cast(m_t), m_size); Chris@16: } Chris@16: BOOST_SERIALIZATION_SPLIT_MEMBER() Chris@16: binary_object & operator=(const binary_object & rhs) { Chris@16: m_t = rhs.m_t; Chris@16: m_size = rhs.m_size; Chris@16: return *this; Chris@16: } Chris@16: binary_object(/* const */ void * const t, std::size_t size) : Chris@16: m_t(t), Chris@16: m_size(size) Chris@16: {} Chris@16: binary_object(const binary_object & rhs) : Chris@16: m_t(rhs.m_t), Chris@16: m_size(rhs.m_size) Chris@16: {} Chris@16: }; Chris@16: Chris@16: // just a little helper to support the convention that all serialization Chris@16: // wrappers follow the naming convention make_xxxxx Chris@16: inline Chris@16: #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING Chris@16: const Chris@16: #endif Chris@16: binary_object Chris@16: make_binary_object(/* const */ void * t, std::size_t size){ Chris@16: return binary_object(t, size); Chris@16: } Chris@16: Chris@16: } // namespace serialization Chris@16: } // boost Chris@16: Chris@16: #endif // BOOST_SERIALIZATION_BINARY_OBJECT_HPP