]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpi/test/gps_position.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / mpi / test / gps_position.hpp
1 #ifndef GPS_POSITION_HPP
2 #define GPS_POSITION_HPP
3
4 // Copyright Matthias Troyer
5 // 2005. Distributed under the Boost Software License, Version
6 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8
9 #include <boost/mpi/datatype_fwd.hpp>
10 #include <boost/mpl/and.hpp>
11 #include <boost/serialization/export.hpp>
12 #include <boost/shared_ptr.hpp>
13
14 class gps_position
15 {
16 private:
17 friend class boost::serialization::access;
18 // When the class Archive corresponds to an output archive, the
19 // & operator is defined similar to <<. Likewise, when the class Archive
20 // is a type of input archive the & operator is defined similar to >>.
21 template<class Archive>
22 void serialize(Archive & ar, const unsigned int version)
23 {
24 ar & degrees & minutes & seconds;
25 }
26 int degrees;
27 int minutes;
28 float seconds;
29 public:
30 gps_position(){};
31 gps_position(int d, int m, float s) :
32 degrees(d), minutes(m), seconds(s)
33 {}
34
35 friend bool operator==(const gps_position& x, const gps_position& y)
36 {
37 return (x.degrees == y.degrees
38 && x.minutes == y.minutes
39 && x.seconds == y.seconds);
40 }
41
42 inline friend bool operator!=(const gps_position& x, const gps_position& y)
43 {
44 return !(x == y);
45 }
46 };
47
48
49 namespace boost { namespace mpi {
50
51 template <>
52 struct is_mpi_datatype<gps_position>
53 : public mpl::and_
54 <
55 is_mpi_datatype<int>,
56 is_mpi_datatype<float>
57 >
58 {};
59
60 } }
61 #endif