epoc32/include/stdapis/boost/serialization/binary_object.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/serialization/binary_object.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,88 @@
     1.4 +#ifndef BOOST_SERIALIZATION_BINARY_OBJECT_HPP
     1.5 +#define BOOST_SERIALIZATION_BINARY_OBJECT_HPP
     1.6 +
     1.7 +// MS compatible compilers support #pragma once
     1.8 +#if defined(_MSC_VER) && (_MSC_VER >= 1020)
     1.9 +# pragma once
    1.10 +#endif
    1.11 +
    1.12 +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
    1.13 +// nvp.hpp: interface for serialization system.
    1.14 +
    1.15 +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . 
    1.16 +// Use, modification and distribution is subject to the Boost Software
    1.17 +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
    1.18 +// http://www.boost.org/LICENSE_1_0.txt)
    1.19 +
    1.20 +//  See http://www.boost.org for updates, documentation, and revision history.
    1.21 +
    1.22 +#include <cassert>
    1.23 +
    1.24 +#include <cstddef> // std::size_t
    1.25 +#include <boost/config.hpp>
    1.26 +#if defined(BOOST_NO_STDC_NAMESPACE)
    1.27 +namespace std{ 
    1.28 +    using ::size_t; 
    1.29 +} // namespace std
    1.30 +#endif
    1.31 +
    1.32 +#include <boost/preprocessor/stringize.hpp>
    1.33 +#include <boost/serialization/tracking.hpp>
    1.34 +#include <boost/serialization/level.hpp>
    1.35 +#include <boost/serialization/split_member.hpp>
    1.36 +#include <boost/serialization/nvp.hpp>
    1.37 +
    1.38 +namespace boost {
    1.39 +namespace serialization {
    1.40 +
    1.41 +struct binary_object {
    1.42 +    /* const */ void * const m_t;
    1.43 +    const std::size_t m_size;
    1.44 +    template<class Archive>
    1.45 +    void save(Archive & ar, const unsigned int /* file_version */) const {
    1.46 +        ar.save_binary(m_t, m_size);
    1.47 +    }
    1.48 +    template<class Archive>
    1.49 +    void load(Archive & ar, const unsigned int /* file_version */) const {
    1.50 +        ar.load_binary(const_cast<void *>(m_t), m_size);
    1.51 +    }
    1.52 +    BOOST_SERIALIZATION_SPLIT_MEMBER()
    1.53 +    binary_object(/* const */ void * const t, std::size_t size) :
    1.54 +        m_t(t),
    1.55 +        m_size(size)
    1.56 +    {}
    1.57 +    binary_object(const binary_object & rhs) :
    1.58 +        m_t(rhs.m_t),
    1.59 +        m_size(rhs.m_size)
    1.60 +    {}
    1.61 +};
    1.62 +
    1.63 +// just a little helper to support the convention that all serialization
    1.64 +// wrappers follow the naming convention make_xxxxx
    1.65 +inline 
    1.66 +#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
    1.67 +const
    1.68 +#endif
    1.69 +binary_object 
    1.70 +make_binary_object(/* const */ void * t, std::size_t size){
    1.71 +    return binary_object(t, size);
    1.72 +}
    1.73 +
    1.74 +} // namespace serialization
    1.75 +} // boost
    1.76 +
    1.77 +// don't need versioning info for this type
    1.78 +BOOST_CLASS_IMPLEMENTATION(
    1.79 +    binary_object, 
    1.80 +    boost::serialization::object_serializable
    1.81 +)
    1.82 +
    1.83 +// don't track binary objects - usually they will be created on the stack
    1.84 +// and tracking algorithm (which uses the object address) might get
    1.85 +// confused.  note that these address will likely be members of some
    1.86 +// other structure which itself is tracked, so as a practical matter
    1.87 +// suppressing tracking shouldn't cause any redundancy.
    1.88 +
    1.89 +BOOST_CLASS_TRACKING(binary_object, boost::serialization::track_never) 
    1.90 +
    1.91 +#endif // BOOST_SERIALIZATION_BINARY_OBJECT_HPP