]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpi/test/pointer_test.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / mpi / test / pointer_test.cpp
1 // Copyright (C) 2005, 2006 Douglas Gregor.
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
8 // a test of pointer serialization
9 #include <boost/mpi.hpp>
10 #include <boost/test/minimal.hpp>
11 #include <boost/serialization/shared_ptr.hpp>
12
13 class A
14 {
15 public:
16 int i;
17 template<class Archive>
18 void serialize(Archive & ar, const unsigned int version)
19 {
20 ar & i;
21 }
22 };
23
24 int test_main(int argc, char* argv[])
25 {
26 boost::mpi::environment env(argc, argv);
27 boost::mpi::communicator world;
28
29 if(world.rank() == 0)
30 {
31 boost::shared_ptr<A> p(new A);
32 p->i = 42;
33 world.send(1, 0, p);
34 }
35 else if(world.rank() == 1)
36 {
37 boost::shared_ptr<A> p;
38 world.recv(0, 0, p);
39 std::cout << p->i << std::endl;
40 BOOST_CHECK(p->i==42);
41 }
42 return 0;
43 }
44