source: NonGTP/Boost/boost/archive/detail/basic_oarchive.hpp @ 857

Revision 857, 3.8 KB checked in by igarcia, 19 years ago (diff)
Line 
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) && (_MSC_VER >= 1020)
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 <boost/config.hpp>
20#include <boost/detail/workaround.hpp>
21
22// can't use this - much as I'd like to as borland doesn't support it
23// #include <boost/scoped_ptr.hpp>
24
25#include <boost/archive/basic_archive.hpp>
26#include <boost/serialization/tracking_enum.hpp>
27
28#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
29
30namespace boost {
31template<class T>
32class shared_ptr;
33
34namespace serialization {
35    class extended_type_info;
36} // namespace serialization
37
38namespace archive {
39namespace detail {
40
41class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive_impl;
42class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer;
43class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer;
44//////////////////////////////////////////////////////////////////////
45// class basic_oarchive - write serialized objects to an output stream
46class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive
47{
48    friend class basic_oarchive_impl;
49    // hide implementation of this class to minimize header conclusion
50    // in client code. note: borland can't use scoped_ptr
51    //boost::scoped_ptr<basic_oarchive_impl> pimpl;
52    basic_oarchive_impl * pimpl;
53
54    // overload these to bracket object attributes. Used to implement
55    // xml archives
56    virtual void vsave(const version_type t) =  0;
57    virtual void vsave(const object_id_type t) =  0;
58    virtual void vsave(const object_reference_type t) =  0;
59    virtual void vsave(const class_id_type t) =  0;
60    virtual void vsave(const class_id_optional_type t) = 0;
61    virtual void vsave(const class_id_reference_type t) =  0;
62    virtual void vsave(const class_name_type & t) = 0;
63    virtual void vsave(const tracking_type t) = 0;
64protected:
65    basic_oarchive(unsigned int flags);
66    // account for bogus gcc warning
67    #if defined(__GNUC__)
68    virtual
69    #endif
70    ~basic_oarchive();
71public:
72    // note: NOT part of the public interface
73    void register_basic_serializer(const basic_oserializer & bos);
74    void
75    lookup_basic_helper(
76        const boost::serialization::extended_type_info * const eti,
77        shared_ptr<void> & sph
78    );
79    void
80    insert_basic_helper(
81        const boost::serialization::extended_type_info * const eti,
82        shared_ptr<void> & sph
83    );
84    void save_object(
85        const void *x,
86        const basic_oserializer & bos
87    );
88    void save_pointer(
89        const void * t,
90        const basic_pointer_oserializer * bpos_ptr
91    );
92    void save_null_pointer(){
93        vsave(NULL_POINTER_TAG);
94    }
95    // real public interface starts here
96    void end_preamble(); // default implementation does nothing
97    unsigned int get_library_version() const;
98    unsigned int get_flags() const;
99};
100
101} // namespace detail
102} // namespace archive
103} // namespace boost
104
105// required by smart_cast for compilers not implementing
106// partial template specialization
107BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(
108    boost::archive::detail::basic_oarchive
109)
110
111#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
112
113#endif //BOOST_ARCHIVE_BASIC_OARCHIVE_HPP
Note: See TracBrowser for help on using the repository browser.