File indexing completed on 2025-01-30 09:33:01
0001 #ifndef BOOST_ARCHIVE_BASIC_BINARY_OARCHIVE_HPP
0002 #define BOOST_ARCHIVE_BASIC_BINARY_OARCHIVE_HPP
0003
0004
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #include <boost/assert.hpp>
0027 #include <boost/config.hpp>
0028 #include <boost/detail/workaround.hpp>
0029
0030 #include <boost/integer.hpp>
0031 #include <boost/integer_traits.hpp>
0032
0033 #include <boost/archive/detail/common_oarchive.hpp>
0034 #include <boost/serialization/string.hpp>
0035 #include <boost/serialization/collection_size_type.hpp>
0036 #include <boost/serialization/item_version_type.hpp>
0037
0038 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
0039
0040 #ifdef BOOST_MSVC
0041 # pragma warning(push)
0042 # pragma warning(disable : 4511 4512)
0043 #endif
0044
0045 namespace boost {
0046 namespace archive {
0047
0048 namespace detail {
0049 template<class Archive> class interface_oarchive;
0050 }
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060 template<class Archive>
0061 class BOOST_SYMBOL_VISIBLE basic_binary_oarchive :
0062 public detail::common_oarchive<Archive>
0063 {
0064 #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
0065 public:
0066 #else
0067 protected:
0068 #if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
0069
0070
0071 friend detail::interface_oarchive<Archive>;
0072 #else
0073 friend class detail::interface_oarchive<Archive>;
0074 #endif
0075 #endif
0076
0077 typedef detail::common_oarchive<Archive> detail_common_oarchive;
0078 template<class T>
0079 void save_override(const T & t){
0080 this->detail_common_oarchive::save_override(t);
0081 }
0082
0083
0084
0085 BOOST_STATIC_ASSERT(sizeof(tracking_type) == sizeof(bool));
0086
0087 BOOST_STATIC_ASSERT(sizeof(class_id_type) == sizeof(int_least16_t));
0088 BOOST_STATIC_ASSERT(sizeof(class_id_reference_type) == sizeof(int_least16_t));
0089
0090 BOOST_STATIC_ASSERT(sizeof(object_id_type) == sizeof(uint_least32_t));
0091 BOOST_STATIC_ASSERT(sizeof(object_reference_type) == sizeof(uint_least32_t));
0092
0093
0094 void save_override(const class_id_optional_type & ){}
0095
0096
0097 #if 0
0098 void save_override(const boost::archive::version_type & t){
0099 library_version_type lvt = this->get_library_version();
0100 if(boost::serialization::library_version_type(7) < lvt){
0101 this->detail_common_oarchive::save_override(t);
0102 }
0103 else
0104 if(boost::serialization::library_version_type(6) < lvt){
0105 const boost::uint_least16_t x = t;
0106 * this->This() << x;
0107 }
0108 else{
0109 const unsigned int x = t;
0110 * this->This() << x;
0111 }
0112 }
0113 void save_override(const boost::serialization::item_version_type & t){
0114 library_version_type lvt = this->get_library_version();
0115 if(boost::serialization::library_version_type(7) < lvt){
0116 this->detail_common_oarchive::save_override(t);
0117 }
0118 else
0119 if(boost::serialization::library_version_type(6) < lvt){
0120 const boost::uint_least16_t x = t;
0121 * this->This() << x;
0122 }
0123 else{
0124 const unsigned int x = t;
0125 * this->This() << x;
0126 }
0127 }
0128
0129 void save_override(class_id_type & t){
0130 library_version_type lvt = this->get_library_version();
0131 if(boost::serialization::library_version_type(7) < lvt){
0132 this->detail_common_oarchive::save_override(t);
0133 }
0134 else
0135 if(boost::serialization::library_version_type(6) < lvt){
0136 const boost::int_least16_t x = t;
0137 * this->This() << x;
0138 }
0139 else{
0140 const int x = t;
0141 * this->This() << x;
0142 }
0143 }
0144 void save_override(class_id_reference_type & t){
0145 save_override(static_cast<class_id_type &>(t));
0146 }
0147
0148 #endif
0149
0150
0151 void save_override(const class_name_type & t){
0152 const std::string s(t);
0153 * this->This() << s;
0154 }
0155
0156 #if 0
0157 void save_override(const serialization::collection_size_type & t){
0158 if (get_library_version() < boost::serialization::library_version_type(6)){
0159 unsigned int x=0;
0160 * this->This() >> x;
0161 t = serialization::collection_size_type(x);
0162 }
0163 else{
0164 * this->This() >> t;
0165 }
0166 }
0167 #endif
0168 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0169 init();
0170
0171 basic_binary_oarchive(unsigned int flags) :
0172 detail::common_oarchive<Archive>(flags)
0173 {}
0174 };
0175
0176 }
0177 }
0178
0179 #ifdef BOOST_MSVC
0180 #pragma warning(pop)
0181 #endif
0182
0183 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
0184
0185 #endif