-
Notifications
You must be signed in to change notification settings - Fork 130
Expand file tree
/
Copy pathnode_allocator_test.cpp
More file actions
90 lines (74 loc) · 3.4 KB
/
node_allocator_test.cpp
File metadata and controls
90 lines (74 loc) · 3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/interprocess for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/container/list.hpp>
#include <boost/container/vector.hpp>
#include <boost/interprocess/allocators/node_allocator.hpp>
#include "movable_int.hpp"
#include "list_test.hpp"
#include "vector_test.hpp"
using namespace boost::interprocess;
typedef test::overaligned_copyable_int oint_t;
//We will work with wide characters for shared memory objects
//Alias an integer node allocator type
typedef node_allocator
<int, managed_shared_memory::segment_manager> shmem_node_allocator_t;
typedef ipcdetail::node_allocator_v1
<int, managed_shared_memory::segment_manager> shmem_node_allocator_v1_t;
typedef node_allocator
< oint_t, managed_shared_memory::segment_manager> shmem_onode_allocator_t;
typedef ipcdetail::node_allocator_v1
< oint_t, managed_shared_memory::segment_manager> shmem_onode_allocator_v1_t;
namespace boost {
namespace interprocess {
//Explicit instantiations to catch compilation errors
template class node_allocator<int, managed_shared_memory::segment_manager>;
template class node_allocator<oint_t, managed_shared_memory::segment_manager>;
template class node_allocator<void, managed_shared_memory::segment_manager>;
namespace ipcdetail {
template class ipcdetail::node_allocator_v1<int, managed_shared_memory::segment_manager>;
template class ipcdetail::node_allocator_v1<oint_t, managed_shared_memory::segment_manager>;
template class ipcdetail::node_allocator_v1<void, managed_shared_memory::segment_manager>;
}}}
//Alias list types
typedef boost::container::list<int, shmem_node_allocator_t> MyShmList;
typedef boost::container::list<int, shmem_node_allocator_v1_t> MyShmListV1;
typedef boost::container::list<oint_t, shmem_onode_allocator_t> MyOShmList;
typedef boost::container::list<oint_t, shmem_onode_allocator_v1_t> MyOShmListV1;
typedef boost::container::vector<oint_t, shmem_onode_allocator_t> MyOShmVector;
typedef boost::container::vector<oint_t, shmem_onode_allocator_v1_t> MyOShmVectorV1;
//Alias vector types
typedef boost::container::vector<int, shmem_node_allocator_t> MyShmVector;
typedef boost::container::vector<int, shmem_node_allocator_v1_t> MyShmVectorV1;
int main ()
{/*
if(test::list_test<managed_shared_memory, MyShmList, true>())
return 1;
if(test::list_test<managed_shared_memory, MyShmListV1, true>())
return 1;
if(test::list_test<managed_shared_memory, MyOShmList, true>())
return 1;*/
if(test::list_test<managed_shared_memory, MyOShmListV1, true>())
return 1;
/*
if(test::list_test<managed_shared_memory, MyShmList, true>())
return 1;
if(test::list_test<managed_shared_memory, MyShmListV1, true>())
return 1;
if(test::vector_test<managed_shared_memory, MyShmVector>())
return 1;
if(test::vector_test<managed_shared_memory, MyShmVectorV1>())
return 1;
if(test::vector_test<managed_shared_memory, MyOShmVector>())
return 1;*/
if(test::vector_test<managed_shared_memory, MyOShmVectorV1>())
return 1;
return 0;
}