cached_adaptive_pool_test.cpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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/detail/config_begin.hpp>
  12. #include <boost/interprocess/managed_shared_memory.hpp>
  13. #include <boost/interprocess/containers/list.hpp>
  14. #include <boost/interprocess/containers/vector.hpp>
  15. #include <boost/interprocess/allocators/cached_adaptive_pool.hpp>
  16. #include "print_container.hpp"
  17. #include "dummy_test_allocator.hpp"
  18. #include "movable_int.hpp"
  19. #include "list_test.hpp"
  20. #include "vector_test.hpp"
  21. using namespace boost::interprocess;
  22. //We will work with wide characters for shared memory objects
  23. //Alias an cached adaptive pool that allocates ints
  24. typedef cached_adaptive_pool
  25. <int, managed_shared_memory::segment_manager>
  26. cached_node_allocator_t;
  27. typedef ipcdetail::cached_adaptive_pool_v1
  28. <int, managed_shared_memory::segment_manager>
  29. cached_node_allocator_v1_t;
  30. namespace boost {
  31. namespace interprocess {
  32. //Explicit instantiations to catch compilation errors
  33. template class cached_adaptive_pool<int, managed_shared_memory::segment_manager>;
  34. template class cached_adaptive_pool<void, managed_shared_memory::segment_manager>;
  35. namespace ipcdetail {
  36. template class ipcdetail::cached_adaptive_pool_v1<int, managed_shared_memory::segment_manager>;
  37. template class ipcdetail::cached_adaptive_pool_v1<void, managed_shared_memory::segment_manager>;
  38. }}}
  39. //Alias list types
  40. typedef list<int, cached_node_allocator_t> MyShmList;
  41. typedef list<int, cached_node_allocator_v1_t> MyShmListV1;
  42. //Alias vector types
  43. typedef vector<int, cached_node_allocator_t> MyShmVector;
  44. typedef vector<int, cached_node_allocator_v1_t> MyShmVectorV1;
  45. int main ()
  46. {
  47. if(test::list_test<managed_shared_memory, MyShmList, true>())
  48. return 1;
  49. if(test::list_test<managed_shared_memory, MyShmListV1, true>())
  50. return 1;
  51. if(test::vector_test<managed_shared_memory, MyShmVector>())
  52. return 1;
  53. if(test::vector_test<managed_shared_memory, MyShmVectorV1>())
  54. return 1;
  55. return 0;
  56. }
  57. #include <boost/interprocess/detail/config_end.hpp>