File indexing completed on 2025-01-18 09:38:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_INTERPROCESS_MAP_INDEX_HPP
0012 #define BOOST_INTERPROCESS_MAP_INDEX_HPP
0013
0014 #ifndef BOOST_CONFIG_HPP
0015 # include <boost/config.hpp>
0016 #endif
0017 #
0018 #if defined(BOOST_HAS_PRAGMA_ONCE)
0019 # pragma once
0020 #endif
0021
0022 #include <boost/interprocess/detail/config_begin.hpp>
0023 #include <boost/interprocess/detail/workaround.hpp>
0024
0025 #include <boost/intrusive/detail/minimal_pair_header.hpp>
0026 #include <boost/interprocess/containers/map.hpp>
0027 #include <boost/interprocess/allocators/private_adaptive_pool.hpp>
0028 #include <boost/intrusive/detail/minimal_pair_header.hpp> //std::pair
0029 #include <boost/intrusive/detail/minimal_less_equal_header.hpp> //std::less
0030
0031
0032
0033
0034
0035 namespace boost {
0036 namespace interprocess {
0037 namespace ipcdetail{
0038
0039
0040 template <class MapConfig>
0041 struct map_index_aux
0042 {
0043 typedef typename MapConfig::key_type key_type;
0044 typedef typename MapConfig::mapped_type mapped_type;
0045 typedef std::less<key_type> key_less;
0046 typedef std::pair<const key_type, mapped_type> value_type;
0047
0048 typedef private_adaptive_pool
0049 <value_type,
0050 typename MapConfig::
0051 segment_manager_base> allocator_type;
0052
0053 typedef boost::interprocess::map
0054 <key_type, mapped_type,
0055 key_less, allocator_type> index_t;
0056 };
0057
0058 }
0059
0060
0061
0062 template <class MapConfig>
0063 class map_index
0064
0065 : public ipcdetail::map_index_aux<MapConfig>::index_t
0066 {
0067 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
0068 typedef ipcdetail::map_index_aux<MapConfig> index_aux;
0069 typedef typename index_aux::index_t base_type;
0070 typedef typename MapConfig::
0071 segment_manager_base segment_manager_base;
0072 #endif
0073
0074 public:
0075
0076
0077 map_index(segment_manager_base *segment_mngr)
0078 : base_type(typename index_aux::key_less(),
0079 segment_mngr){}
0080
0081
0082
0083 void reserve(typename segment_manager_base::size_type)
0084 { }
0085
0086
0087
0088 void shrink_to_fit()
0089 { base_type::get_stored_allocator().deallocate_free_blocks(); }
0090 };
0091
0092 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
0093
0094
0095
0096
0097 template<class MapConfig>
0098 struct is_node_index
0099 <boost::interprocess::map_index<MapConfig> >
0100 {
0101 static const bool value = true;
0102 };
0103 #endif
0104
0105 }}
0106
0107 #include <boost/interprocess/detail/config_end.hpp>
0108
0109 #endif