1 | ////////////////////////////////////////////////////////////////////////////// |
2 | // |
3 | // (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost |
4 | // Software License, Version 1.0. (See accompanying file |
5 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
6 | // |
7 | // See http://www.boost.org/libs/interprocess for documentation. |
8 | // |
9 | ////////////////////////////////////////////////////////////////////////////// |
10 | #define BOOST_CONTAINER_ADAPTIVE_NODE_POOL_CHECK_INVARIANTS |
11 | #include <boost/interprocess/managed_shared_memory.hpp> |
12 | #include <boost/interprocess/containers/list.hpp> |
13 | #include <boost/interprocess/containers/vector.hpp> |
14 | #include <boost/interprocess/allocators/cached_adaptive_pool.hpp> |
15 | #include "print_container.hpp" |
16 | #include "dummy_test_allocator.hpp" |
17 | #include "movable_int.hpp" |
18 | #include "list_test.hpp" |
19 | #include "vector_test.hpp" |
20 | |
21 | using namespace boost::interprocess; |
22 | |
23 | //We will work with wide characters for shared memory objects |
24 | //Alias an cached adaptive pool that allocates ints |
25 | typedef cached_adaptive_pool |
26 | <int, managed_shared_memory::segment_manager> |
27 | cached_node_allocator_t; |
28 | |
29 | typedef ipcdetail::cached_adaptive_pool_v1 |
30 | <int, managed_shared_memory::segment_manager> |
31 | cached_node_allocator_v1_t; |
32 | |
33 | namespace boost { |
34 | namespace interprocess { |
35 | |
36 | //Explicit instantiations to catch compilation errors |
37 | template class cached_adaptive_pool<int, managed_shared_memory::segment_manager>; |
38 | template class cached_adaptive_pool<void, managed_shared_memory::segment_manager>; |
39 | |
40 | namespace ipcdetail { |
41 | |
42 | template class ipcdetail::cached_adaptive_pool_v1<int, managed_shared_memory::segment_manager>; |
43 | template class ipcdetail::cached_adaptive_pool_v1<void, managed_shared_memory::segment_manager>; |
44 | |
45 | }}} |
46 | |
47 | //Alias list types |
48 | typedef list<int, cached_node_allocator_t> MyShmList; |
49 | typedef list<int, cached_node_allocator_v1_t> MyShmListV1; |
50 | |
51 | //Alias vector types |
52 | typedef vector<int, cached_node_allocator_t> MyShmVector; |
53 | typedef vector<int, cached_node_allocator_v1_t> MyShmVectorV1; |
54 | |
55 | int main () |
56 | { |
57 | if(test::list_test<managed_shared_memory, MyShmList, true>()) |
58 | return 1; |
59 | |
60 | if(test::list_test<managed_shared_memory, MyShmListV1, true>()) |
61 | return 1; |
62 | |
63 | if(test::vector_test<managed_shared_memory, MyShmVector>()) |
64 | return 1; |
65 | |
66 | if(test::vector_test<managed_shared_memory, MyShmVectorV1>()) |
67 | return 1; |
68 | |
69 | return 0; |
70 | } |
71 | |