| 1 | // |
| 2 | // Boost.Pointer Container |
| 3 | // |
| 4 | // Copyright Thorsten Ottosen 2008. Use, modification and |
| 5 | // distribution is subject to the Boost Software License, Version |
| 6 | // 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
| 7 | // http://www.boost.org/LICENSE_1_0.txt) |
| 8 | // |
| 9 | // For more information, see http://www.boost.org/libs/ptr_container/ |
| 10 | // |
| 11 | |
| 12 | #ifndef BOOST_PTR_CONTAINER_SERIALIZE_PTR_CIRCULAR_BUFFER_HPP |
| 13 | #define BOOST_PTR_CONTAINER_SERIALIZE_PTR_CIRCULAR_BUFFER_HPP |
| 14 | |
| 15 | #include <boost/ptr_container/detail/serialize_reversible_cont.hpp> |
| 16 | #include <boost/ptr_container/ptr_circular_buffer.hpp> |
| 17 | |
| 18 | namespace boost |
| 19 | { |
| 20 | |
| 21 | namespace serialization |
| 22 | { |
| 23 | |
| 24 | template<class Archive, class T, class CloneAllocator, class Allocator> |
| 25 | void load(Archive& ar, ptr_circular_buffer<T, CloneAllocator, Allocator>& c, unsigned int version) |
| 26 | { |
| 27 | typedef ptr_circular_buffer<T, CloneAllocator, Allocator> container_type; |
| 28 | typedef BOOST_DEDUCED_TYPENAME container_type::size_type size_type; |
| 29 | |
| 30 | size_type n; |
| 31 | ar >> boost::serialization::make_nvp( ptr_container_detail::count(), n ); |
| 32 | c.reserve(n); |
| 33 | |
| 34 | ptr_container_detail::load_helper(ar, c, n); |
| 35 | } |
| 36 | |
| 37 | template<class Archive, class T, class CloneAllocator, class Allocator> |
| 38 | void serialize(Archive& ar, ptr_circular_buffer<T, CloneAllocator, Allocator>& c, const unsigned int version) |
| 39 | { |
| 40 | core::split_free(ar, c, version); |
| 41 | } |
| 42 | |
| 43 | } // namespace serialization |
| 44 | } // namespace boost |
| 45 | |
| 46 | #endif |
| 47 | |