Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:08:14

0001 #ifndef BOOST_SERIALIZATION_SERIALIZATION_HPP
0002 #define BOOST_SERIALIZATION_SERIALIZATION_HPP
0003 
0004 // MS compatible compilers support #pragma once
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008 
0009 #if defined(_MSC_VER)
0010 #  pragma warning (disable : 4675) // suppress ADL warning
0011 #endif
0012 
0013 #include <boost/config.hpp>
0014 #include <boost/serialization/strong_typedef.hpp>
0015 
0016 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
0017 // serialization.hpp: interface for serialization system.
0018 
0019 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
0020 // Use, modification and distribution is subject to the Boost Software
0021 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0022 // http://www.boost.org/LICENSE_1_0.txt)
0023 
0024 //  See http://www.boost.org for updates, documentation, and revision history.
0025 
0026 //////////////////////////////////////////////////////////////////////
0027 // public interface to serialization.
0028 
0029 /////////////////////////////////////////////////////////////////////////////
0030 // layer 0 - intrusive version
0031 // declared and implemented for each user defined class to be serialized
0032 //
0033 //  template<Archive>
0034 //  serialize(Archive &ar, const unsigned int file_version){
0035 //      ar & base_object<base>(*this) & member1 & member2 ... ;
0036 //  }
0037 
0038 /////////////////////////////////////////////////////////////////////////////
0039 // layer 1 - layer that routes member access through the access class.
0040 // this is what permits us to grant access to private class member functions
0041 // by specifying friend class boost::serialization::access
0042 
0043 #include <boost/serialization/access.hpp>
0044 
0045 /////////////////////////////////////////////////////////////////////////////
0046 // layer 2 - default implementation of non-intrusive serialization.
0047 //
0048 
0049 namespace boost {
0050 namespace serialization {
0051 
0052 BOOST_STRONG_TYPEDEF(unsigned int, version_type)
0053 
0054 // default implementation - call the member function "serialize"
0055 template<class Archive, class T>
0056 inline void serialize(
0057     Archive & ar, T & t, const unsigned int file_version
0058 ){
0059     access::serialize(ar, t, static_cast<unsigned int>(file_version));
0060 }
0061 
0062 // save data required for construction
0063 template<class Archive, class T>
0064 inline void save_construct_data(
0065     Archive & /*ar*/,
0066     const T * /*t*/,
0067     const unsigned int /*file_version */
0068 ){
0069     // default is to save no data because default constructor
0070     // requires no arguments.
0071 }
0072 
0073 // load data required for construction and invoke constructor in place
0074 template<class Archive, class T>
0075 inline void load_construct_data(
0076     Archive & /*ar*/,
0077     T * t,
0078     const unsigned int /*file_version*/
0079 ){
0080     // default just uses the default constructor.  going
0081     // through access permits usage of otherwise private default
0082     // constructor
0083     access::construct(t);
0084 }
0085 
0086 /////////////////////////////////////////////////////////////////////////////
0087 // layer 3 - move call into serialization namespace so that ADL will function
0088 // in the manner we desire.
0089 //
0090 // on compilers which don't implement ADL. only the current namespace
0091 // i.e. boost::serialization will be searched.
0092 //
0093 // on compilers which DO implement ADL
0094 // serialize overrides can be in any of the following
0095 //
0096 // 1) same namepace as Archive
0097 // 2) same namespace as T
0098 // 3) boost::serialization
0099 //
0100 // Due to Martin Ecker
0101 
0102 template<class Archive, class T>
0103 inline void serialize_adl(
0104     Archive & ar,
0105     T & t,
0106     const unsigned int file_version
0107 ){
0108     const version_type v(file_version);
0109     serialize(ar, t, v);
0110 }
0111 
0112 template<class Archive, class T>
0113 inline void save_construct_data_adl(
0114     Archive & ar,
0115     const T * t,
0116     const unsigned int file_version
0117 ){
0118 
0119     const version_type v(file_version);
0120     save_construct_data(ar, t, v);
0121 }
0122 
0123 template<class Archive, class T>
0124 inline void load_construct_data_adl(
0125     Archive & ar,
0126     T * t,
0127     const unsigned int file_version
0128 ){
0129     // see above comment
0130     const version_type v(file_version);
0131     load_construct_data(ar, t, v);
0132 }
0133 
0134 } // namespace serialization
0135 } // namespace boost
0136 
0137 #endif //BOOST_SERIALIZATION_SERIALIZATION_HPP