]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // (C) Copyright 2005 Matthias Troyer |
2 | ||
3 | // Use, modification and distribution is subject to the Boost Software | |
4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
5 | // http://www.boost.org/LICENSE_1_0.txt) | |
6 | ||
7 | // Authors: Matthias Troyer | |
8 | ||
9 | #ifndef BOOST_MPI_DETAIL_IGNORE_OPRIMITIVE_HPP | |
10 | #define BOOST_MPI_DETAIL_IGNORE_OPRIMITIVE_HPP | |
11 | ||
12 | #include <boost/config.hpp> | |
13 | #include <boost/mpi/datatype.hpp> | |
14 | #include <boost/serialization/array.hpp> | |
15 | ||
16 | namespace boost { namespace mpi { namespace detail { | |
17 | ||
18 | /// @brief a minimal output archive, which ignores any save | |
19 | /// | |
20 | /// This class implements a minimal output archive, probably an output archive | |
21 | /// archetype, doing nothing at any save. It's use, besides acting as an | |
22 | /// archetype is as a base class to implement special archives that ignore | |
23 | /// saving of most types | |
24 | ||
25 | class ignore_oprimitive | |
26 | { | |
27 | public: | |
28 | /// a trivial default constructor | |
29 | ignore_oprimitive() | |
30 | {} | |
31 | ||
32 | /// don't do anything when saving binary data | |
33 | void save_binary(const void *, std::size_t ) | |
34 | { | |
35 | } | |
36 | ||
37 | /// don't do anything when saving arrays | |
38 | template<class T> | |
39 | void save_array(serialization::array_wrapper<T> const&, unsigned int ) | |
40 | { | |
41 | } | |
42 | ||
43 | typedef is_mpi_datatype<mpl::_1> use_array_optimization; | |
44 | ||
45 | ||
46 | #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS | |
47 | friend class archive::save_access; | |
48 | protected: | |
49 | #else | |
50 | public: | |
51 | #endif | |
52 | ||
53 | /// don't do anything when saving primitive types | |
54 | template<class T> | |
55 | void save(const T &) | |
56 | { | |
57 | } | |
58 | }; | |
59 | ||
60 | } } } // end namespace boost::mpi::detail | |
61 | ||
62 | #endif // BOOST_MPI_DETAIL_IGNORE_OPRIMITIVE_HPP |