]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/serialization/include/boost/archive/detail/polymorphic_oarchive_route.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / serialization / include / boost / archive / detail / polymorphic_oarchive_route.hpp
CommitLineData
7c673cae
FG
1#ifndef BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_ROUTE_HPP
2#define BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_ROUTE_HPP
3
4// MS compatible compilers support #pragma once
5#if defined(_MSC_VER)
6# pragma once
7#endif
8
9/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10// polymorphic_oarchive_route.hpp
11
12// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13// Use, modification and distribution is subject to the Boost Software
14// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15// http://www.boost.org/LICENSE_1_0.txt)
16
17// See http://www.boost.org for updates, documentation, and revision history.
18
19#include <string>
20#include <ostream>
21#include <cstddef> // size_t
22
23#include <boost/config.hpp>
24#if defined(BOOST_NO_STDC_NAMESPACE)
25namespace std{
26 using ::size_t;
27} // namespace std
28#endif
29
30#include <boost/cstdint.hpp>
31#include <boost/integer_traits.hpp>
32#include <boost/archive/polymorphic_oarchive.hpp>
33#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
34
35namespace boost {
36namespace serialization {
37 class extended_type_info;
38} // namespace serialization
39namespace archive {
40namespace detail{
41
42class basic_oserializer;
43class basic_pointer_oserializer;
44
45#ifdef BOOST_MSVC
46# pragma warning(push)
47# pragma warning(disable : 4511 4512)
48#endif
49
50template<class ArchiveImplementation>
51class polymorphic_oarchive_route :
52 public polymorphic_oarchive,
53 // note: gcc dynamic cross cast fails if the the derivation below is
54 // not public. I think this is a mistake.
55 public /*protected*/ ArchiveImplementation
56{
57private:
58 // these are used by the serialization library.
59 virtual void save_object(
60 const void *x,
61 const detail::basic_oserializer & bos
62 ){
63 ArchiveImplementation::save_object(x, bos);
64 }
65 virtual void save_pointer(
66 const void * t,
67 const detail::basic_pointer_oserializer * bpos_ptr
68 ){
69 ArchiveImplementation::save_pointer(t, bpos_ptr);
70 }
71 virtual void save_null_pointer(){
72 ArchiveImplementation::save_null_pointer();
73 }
74 // primitive types the only ones permitted by polymorphic archives
75 virtual void save(const bool t){
76 ArchiveImplementation::save(t);
77 }
78 virtual void save(const char t){
79 ArchiveImplementation::save(t);
80 }
81 virtual void save(const signed char t){
82 ArchiveImplementation::save(t);
83 }
84 virtual void save(const unsigned char t){
85 ArchiveImplementation::save(t);
86 }
87 #ifndef BOOST_NO_CWCHAR
88 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
89 virtual void save(const wchar_t t){
90 ArchiveImplementation::save(t);
91 }
92 #endif
93 #endif
94 virtual void save(const short t){
95 ArchiveImplementation::save(t);
96 }
97 virtual void save(const unsigned short t){
98 ArchiveImplementation::save(t);
99 }
100 virtual void save(const int t){
101 ArchiveImplementation::save(t);
102 }
103 virtual void save(const unsigned int t){
104 ArchiveImplementation::save(t);
105 }
106 virtual void save(const long t){
107 ArchiveImplementation::save(t);
108 }
109 virtual void save(const unsigned long t){
110 ArchiveImplementation::save(t);
111 }
112 #if defined(BOOST_HAS_LONG_LONG)
113 virtual void save(const boost::long_long_type t){
114 ArchiveImplementation::save(t);
115 }
116 virtual void save(const boost::ulong_long_type t){
117 ArchiveImplementation::save(t);
118 }
119 #elif defined(BOOST_HAS_MS_INT64)
120 virtual void save(const boost::int64_t t){
121 ArchiveImplementation::save(t);
122 }
123 virtual void save(const boost::uint64_t t){
124 ArchiveImplementation::save(t);
125 }
126 #endif
127 virtual void save(const float t){
128 ArchiveImplementation::save(t);
129 }
130 virtual void save(const double t){
131 ArchiveImplementation::save(t);
132 }
133 virtual void save(const std::string & t){
134 ArchiveImplementation::save(t);
135 }
136 #ifndef BOOST_NO_STD_WSTRING
137 virtual void save(const std::wstring & t){
138 ArchiveImplementation::save(t);
139 }
140 #endif
141 virtual library_version_type get_library_version() const{
142 return ArchiveImplementation::get_library_version();
143 }
144 virtual unsigned int get_flags() const {
145 return ArchiveImplementation::get_flags();
146 }
147 virtual void save_binary(const void * t, std::size_t size){
148 ArchiveImplementation::save_binary(t, size);
149 }
150 // used for xml and other tagged formats default does nothing
151 virtual void save_start(const char * name){
152 ArchiveImplementation::save_start(name);
153 }
154 virtual void save_end(const char * name){
155 ArchiveImplementation::save_end(name);
156 }
157 virtual void end_preamble(){
158 ArchiveImplementation::end_preamble();
159 }
160 virtual void register_basic_serializer(const detail::basic_oserializer & bos){
161 ArchiveImplementation::register_basic_serializer(bos);
162 }
163 virtual helper_collection &
164 get_helper_collection(){
165 return ArchiveImplementation::get_helper_collection();
166 }
167public:
168 // this can't be inheriteded because they appear in mulitple
169 // parents
170 typedef mpl::bool_<false> is_loading;
171 typedef mpl::bool_<true> is_saving;
172 // the << operator
173 template<class T>
174 polymorphic_oarchive & operator<<(T & t){
175 return polymorphic_oarchive::operator<<(t);
176 }
177 // the & operator
178 template<class T>
179 polymorphic_oarchive & operator&(T & t){
180 return polymorphic_oarchive::operator&(t);
181 }
182 // register type function
183 template<class T>
184 const basic_pointer_oserializer *
185 register_type(T * t = NULL){
186 return ArchiveImplementation::register_type(t);
187 }
188 // all current archives take a stream as constructor argument
189 template <class _Elem, class _Tr>
190 polymorphic_oarchive_route(
191 std::basic_ostream<_Elem, _Tr> & os,
192 unsigned int flags = 0
193 ) :
194 ArchiveImplementation(os, flags)
195 {}
196 virtual ~polymorphic_oarchive_route(){};
197};
198
199} // namespace detail
200} // namespace archive
201} // namespace boost
202
203#ifdef BOOST_MSVC
204#pragma warning(pop)
205#endif
206
207#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
208
209#endif // BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_DISPATCH_HPP