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/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
21using namespace boost::interprocess;
22
23//We will work with wide characters for shared memory objects
24//Alias an adaptive pool that allocates ints
25typedef adaptive_pool
26 <int, managed_shared_memory::segment_manager> shmem_node_allocator_t;
27
28typedef ipcdetail::adaptive_pool_v1
29 <int, managed_shared_memory::segment_manager> shmem_node_allocator_v1_t;
30
31namespace boost {
32namespace interprocess {
33
34//Explicit instantiations to catch compilation errors
35template class adaptive_pool<int, managed_shared_memory::segment_manager>;
36template class adaptive_pool<void, managed_shared_memory::segment_manager>;
37
38namespace ipcdetail {
39
40template class ipcdetail::adaptive_pool_v1<int, managed_shared_memory::segment_manager>;
41template class ipcdetail::adaptive_pool_v1<void, managed_shared_memory::segment_manager>;
42
43}}}
44
45//Alias list types
46typedef list<int, shmem_node_allocator_t> MyShmList;
47typedef list<int, shmem_node_allocator_v1_t> MyShmListV1;
48
49//Alias vector types
50typedef vector<int, shmem_node_allocator_t> MyShmVector;
51typedef vector<int, shmem_node_allocator_v1_t> MyShmVectorV1;
52
53int main ()
54{
55 if(test::list_test<managed_shared_memory, MyShmList, true>())
56 return 1;
57
58 if(test::list_test<managed_shared_memory, MyShmListV1, true>())
59 return 1;
60
61 if(test::vector_test<managed_shared_memory, MyShmVector>())
62 return 1;
63
64 if(test::vector_test<managed_shared_memory, MyShmVectorV1>())
65 return 1;
66
67 return 0;
68}
69

source code of boost/libs/interprocess/test/adaptive_pool_test.cpp