1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2005-2011. 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)
7 // See http://www.boost.org/libs/interprocess for documentation.
9 //////////////////////////////////////////////////////////////////////////////
11 #ifndef BOOST_INTERPROCESS_MULTI_SIMPLE_SEQ_FIT_HPP
12 #define BOOST_INTERPROCESS_MULTI_SIMPLE_SEQ_FIT_HPP
18 #include <boost/interprocess/detail/config_begin.hpp>
19 #include <boost/interprocess/detail/workaround.hpp>
21 #include <boost/interprocess/interprocess_fwd.hpp>
22 #include <boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp>
23 #include <boost/interprocess/intersegment_ptr.hpp>
26 Describes sequential fit algorithm used to allocate objects in shared memory.
31 namespace interprocess {
33 /*!This class implements the simple sequential fit algorithm with a simply
34 linked list of free buffers.*/
35 template<class MutexFamily, class VoidPtr>
36 class multi_simple_seq_fit
37 : public ipcdetail::simple_seq_fit_impl<MutexFamily, VoidPtr>
39 typedef ipcdetail::simple_seq_fit_impl<MutexFamily, VoidPtr> base_t;
41 /*!Constructor. "size" is the total size of the managed memory segment,
42 "extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(multi_simple_seq_fit)
43 offset that the allocator should not use at all.*/
44 multi_simple_seq_fit (size_type size, size_type extra_hdr_bytes)
45 : base_t(size, extra_hdr_bytes){}
47 /*!Allocates bytes from existing segments. If there is no memory, it uses
48 the growing functor associated with the group to allocate a new segment.
49 If this fails, returns 0.*/
50 void* allocate (size_type nbytes)
51 { return base_t::multi_allocate(nbytes); }
54 } //namespace interprocess {
58 #include <boost/interprocess/detail/config_end.hpp>
60 #endif //#ifndef BOOST_INTERPROCESS_MULTI_SIMPLE_SEQ_FIT_HPP