• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
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/private_node_allocator.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 integer node allocator type
25 typedef private_node_allocator
26    <int, managed_shared_memory::segment_manager> priv_node_allocator_t;
27 typedef ipcdetail::private_node_allocator_v1
28    <int, managed_shared_memory::segment_manager> priv_node_allocator_v1_t;
29 
30 namespace boost {
31 namespace interprocess {
32 
33 //Explicit instantiations to catch compilation errors
34 template class private_node_allocator<int, managed_shared_memory::segment_manager>;
35 template class private_node_allocator<void, managed_shared_memory::segment_manager>;
36 
37 namespace ipcdetail {
38 
39 template class ipcdetail::private_node_allocator_v1<int, managed_shared_memory::segment_manager>;
40 template class ipcdetail::private_node_allocator_v1<void, managed_shared_memory::segment_manager>;
41 
42 }}}
43 
44 //Alias list types
45 typedef list<int, priv_node_allocator_t>     MyShmList;
46 typedef list<int, priv_node_allocator_v1_t>  MyShmListV1;
47 
48 //Alias vector types
49 typedef vector<int, priv_node_allocator_t>     MyShmVector;
50 typedef vector<int, priv_node_allocator_v1_t>  MyShmVectorV1;
51 
main()52 int main ()
53 {
54    if(test::list_test<managed_shared_memory, MyShmList, true>(false))
55       return 1;
56    if(test::list_test<managed_shared_memory, MyShmListV1, true>(false))
57       return 1;
58    if(test::vector_test<managed_shared_memory, MyShmVector>())
59       return 1;
60    if(test::vector_test<managed_shared_memory, MyShmVectorV1>())
61       return 1;
62    return 0;
63 }
64