1#ifndef BOOST_ARCHIVE_BASIC_OARCHIVE_HPP
2#define BOOST_ARCHIVE_BASIC_OARCHIVE_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// basic_oarchive.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 <cstddef> // NULL
20#include <boost/config.hpp>
21#include <boost/noncopyable.hpp>
22#include <boost/scoped_ptr.hpp>
23
24#include <boost/archive/basic_archive.hpp>
25#include <boost/serialization/tracking_enum.hpp>
26#include <boost/archive/detail/helper_collection.hpp>
27#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
28
29namespace boost {
30namespace serialization {
31 class extended_type_info;
32} // namespace serialization
33
34namespace archive {
35namespace detail {
36
37class basic_oarchive_impl;
38class basic_oserializer;
39class basic_pointer_oserializer;
40
41//////////////////////////////////////////////////////////////////////
42// class basic_oarchive - write serialized objects to an output stream
43class BOOST_SYMBOL_VISIBLE basic_oarchive :
44 private boost::noncopyable,
45 public boost::archive::detail::helper_collection
46{
47 friend class basic_oarchive_impl;
48 // hide implementation of this class to minimize header conclusion
49 boost::scoped_ptr<basic_oarchive_impl> pimpl;
50
51 // overload these to bracket object attributes. Used to implement
52 // xml archives
53 virtual void vsave(const version_type t) = 0;
54 virtual void vsave(const object_id_type t) = 0;
55 virtual void vsave(const object_reference_type t) = 0;
56 virtual void vsave(const class_id_type t) = 0;
57 virtual void vsave(const class_id_optional_type t) = 0;
58 virtual void vsave(const class_id_reference_type t) = 0;
59 virtual void vsave(const class_name_type & t) = 0;
60 virtual void vsave(const tracking_type t) = 0;
61protected:
62 BOOST_ARCHIVE_DECL basic_oarchive(unsigned int flags = 0);
63 BOOST_ARCHIVE_DECL boost::archive::detail::helper_collection &
64 get_helper_collection();
65 virtual BOOST_ARCHIVE_DECL ~basic_oarchive();
66public:
67 // note: NOT part of the public interface
68 BOOST_ARCHIVE_DECL void register_basic_serializer(
69 const basic_oserializer & bos
70 );
71 BOOST_ARCHIVE_DECL void save_object(
72 const void *x,
73 const basic_oserializer & bos
74 );
75 BOOST_ARCHIVE_DECL void save_pointer(
76 const void * t,
77 const basic_pointer_oserializer * bpos_ptr
78 );
79 void save_null_pointer(){
80 vsave(BOOST_SERIALIZATION_NULL_POINTER_TAG);
81 }
82 // real public interface starts here
83 BOOST_ARCHIVE_DECL void end_preamble(); // default implementation does nothing
84 BOOST_ARCHIVE_DECL boost::serialization::library_version_type get_library_version() const;
85 BOOST_ARCHIVE_DECL unsigned int get_flags() const;
86};
87
88} // namespace detail
89} // namespace archive
90} // namespace boost
91
92#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
93
94#endif //BOOST_ARCHIVE_BASIC_OARCHIVE_HPP
95

source code of boost/libs/serialization/include/boost/archive/detail/basic_oarchive.hpp