cached_node_allocator_test.cpp 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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/cached_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. //Alias an integer node allocator type
  22. typedef cached_node_allocator
  23. <int, managed_shared_memory::segment_manager>
  24. cached_node_allocator_t;
  25. typedef ipcdetail::cached_node_allocator_v1
  26. <int, managed_shared_memory::segment_manager>
  27. cached_node_allocator_v1_t;
  28. namespace boost {
  29. namespace interprocess {
  30. //Explicit instantiations to catch compilation errors
  31. template class cached_node_allocator<int, managed_shared_memory::segment_manager>;
  32. template class cached_node_allocator<void, managed_shared_memory::segment_manager>;
  33. namespace ipcdetail {
  34. template class ipcdetail::cached_node_allocator_v1<int, managed_shared_memory::segment_manager>;
  35. template class ipcdetail::cached_node_allocator_v1<void, managed_shared_memory::segment_manager>;
  36. }}}
  37. //Alias list types
  38. typedef list<int, cached_node_allocator_t> MyShmList;
  39. typedef list<int, cached_node_allocator_v1_t> MyShmListV1;
  40. //Alias vector types
  41. typedef vector<int, cached_node_allocator_t> MyShmVector;
  42. typedef vector<int, cached_node_allocator_v1_t> MyShmVectorV1;
  43. int main ()
  44. {
  45. if(test::list_test<managed_shared_memory, MyShmList, true>())
  46. return 1;
  47. if(test::list_test<managed_shared_memory, MyShmListV1, true>())
  48. return 1;
  49. if(test::vector_test<managed_shared_memory, MyShmVector>())
  50. return 1;
  51. if(test::vector_test<managed_shared_memory, MyShmVectorV1>())
  52. return 1;
  53. return 0;
  54. }
  55. #include <boost/interprocess/detail/config_end.hpp>