private_node_allocator_test.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #include <boost/interprocess/detail/config_begin.hpp>
  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. using namespace boost::interprocess;
  21. //We will work with wide characters for shared memory objects
  22. //Alias an integer node allocator type
  23. typedef private_node_allocator
  24. <int, managed_shared_memory::segment_manager> priv_node_allocator_t;
  25. typedef ipcdetail::private_node_allocator_v1
  26. <int, managed_shared_memory::segment_manager> priv_node_allocator_v1_t;
  27. namespace boost {
  28. namespace interprocess {
  29. //Explicit instantiations to catch compilation errors
  30. template class private_node_allocator<int, managed_shared_memory::segment_manager>;
  31. template class private_node_allocator<void, managed_shared_memory::segment_manager>;
  32. namespace ipcdetail {
  33. template class ipcdetail::private_node_allocator_v1<int, managed_shared_memory::segment_manager>;
  34. template class ipcdetail::private_node_allocator_v1<void, managed_shared_memory::segment_manager>;
  35. }}}
  36. //Alias list types
  37. typedef list<int, priv_node_allocator_t> MyShmList;
  38. typedef list<int, priv_node_allocator_v1_t> MyShmListV1;
  39. //Alias vector types
  40. typedef vector<int, priv_node_allocator_t> MyShmVector;
  41. typedef vector<int, priv_node_allocator_v1_t> MyShmVectorV1;
  42. int main ()
  43. {
  44. if(test::list_test<managed_shared_memory, MyShmList, true>(false))
  45. return 1;
  46. if(test::list_test<managed_shared_memory, MyShmListV1, true>(false))
  47. return 1;
  48. if(test::vector_test<managed_shared_memory, MyShmVector>())
  49. return 1;
  50. if(test::vector_test<managed_shared_memory, MyShmVectorV1>())
  51. return 1;
  52. return 0;
  53. }
  54. #include <boost/interprocess/detail/config_end.hpp>