Public Types | Public Member Functions | Protected Member Functions | List of all members
rmm::mr::detail::free_list< BlockType, ListType > Class Template Reference

Base class defining an interface for a list of free memory blocks. More...

#include <free_list.hpp>

Public Types

using block_type = BlockType
 
using list_type = ListType
 
using size_type = typename list_type::size_type
 
using iterator = typename list_type::iterator
 
using const_iterator = typename list_type::const_iterator
 

Public Member Functions

 free_list (free_list const &)=delete
 
free_listoperator= (free_list const &)=delete
 
 free_list (free_list &&)=delete
 
free_listoperator= (free_list &&)=delete
 
iterator begin () noexcept
 beginning of the free list
 
const_iterator begin () const noexcept
 beginning of the free list
 
const_iterator cbegin () const noexcept
 beginning of the free list
 
iterator end () noexcept
 end of the free list
 
const_iterator end () const noexcept
 beginning of the free list
 
const_iterator cend () const noexcept
 beginning of the free list
 
size_type size () const noexcept
 The size of the free list in blocks. More...
 
bool is_empty () const noexcept
 checks whether the free_list is empty. More...
 
void erase (const_iterator iter)
 Removes the block indicated by iter from the free list. More...
 
void clear () noexcept
 Erase all blocks from the free_list.
 

Protected Member Functions

void insert (const_iterator pos, block_type const &block)
 Insert a block in the free list before the specified position. More...
 
void splice (const_iterator pos, free_list &&other)
 Inserts a list of blocks in the free list before the specified position. More...
 
void push_back (const block_type &block)
 Appends the given block to the end of the free list. More...
 
void push_back (block_type &&block)
 Appends the given block to the end of the free list. b is moved to the new element. More...
 
void pop_front ()
 Removes the first element of the free list. If there are no elements in the free list, the behavior is undefined. More...
 

Detailed Description

template<typename BlockType, typename ListType = std::list<BlockType>>
class rmm::mr::detail::free_list< BlockType, ListType >

Base class defining an interface for a list of free memory blocks.

Derived classes typically provide additional methods such as the following (see fixed_size_free_list.hpp and coalescing_free_list.hpp). However this is not a required interface.

Template Parameters
list_typethe type of the internal list data structure.

Member Function Documentation

◆ erase()

template<typename BlockType , typename ListType = std::list<BlockType>>
void rmm::mr::detail::free_list< BlockType, ListType >::erase ( const_iterator  iter)
inline

Removes the block indicated by iter from the free list.

Parameters
iterAn iterator referring to the block to erase.

◆ insert()

template<typename BlockType , typename ListType = std::list<BlockType>>
void rmm::mr::detail::free_list< BlockType, ListType >::insert ( const_iterator  pos,
block_type const &  block 
)
inlineprotected

Insert a block in the free list before the specified position.

Parameters
positerator before which the block will be inserted. pos may be the end() iterator.
blockThe block to insert.

◆ is_empty()

template<typename BlockType , typename ListType = std::list<BlockType>>
bool rmm::mr::detail::free_list< BlockType, ListType >::is_empty ( ) const
inlinenoexcept

checks whether the free_list is empty.

Returns
true If there are blocks in the free_list.
false If there are no blocks in the free_list.

◆ pop_front()

template<typename BlockType , typename ListType = std::list<BlockType>>
void rmm::mr::detail::free_list< BlockType, ListType >::pop_front ( )
inlineprotected

Removes the first element of the free list. If there are no elements in the free list, the behavior is undefined.

References and iterators to the erased element are invalidated.

◆ push_back() [1/2]

template<typename BlockType , typename ListType = std::list<BlockType>>
void rmm::mr::detail::free_list< BlockType, ListType >::push_back ( block_type &&  block)
inlineprotected

Appends the given block to the end of the free list. b is moved to the new element.

Parameters
blockThe block to append.

◆ push_back() [2/2]

template<typename BlockType , typename ListType = std::list<BlockType>>
void rmm::mr::detail::free_list< BlockType, ListType >::push_back ( const block_type &  block)
inlineprotected

Appends the given block to the end of the free list.

Parameters
blockThe block to append.

◆ size()

template<typename BlockType , typename ListType = std::list<BlockType>>
size_type rmm::mr::detail::free_list< BlockType, ListType >::size ( ) const
inlinenoexcept

The size of the free list in blocks.

Returns
size_type The number of blocks in the free list.

◆ splice()

template<typename BlockType , typename ListType = std::list<BlockType>>
void rmm::mr::detail::free_list< BlockType, ListType >::splice ( const_iterator  pos,
free_list< BlockType, ListType > &&  other 
)
inlineprotected

Inserts a list of blocks in the free list before the specified position.

Parameters
positerator before which the block will be inserted. pos may be the end() iterator.
otherThe free list to insert.

The documentation for this class was generated from the following file: