LIBINT  2.6.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
libint2::MemoryBlock< A, S > Class Template Reference

MemoryBlock<Address,Size> describes a block of raw memory addressed via Address and size described by Size. More...

#include <memory.h>

Public Types

typedef A Address
 
typedef S Size
 

Public Member Functions

 MemoryBlock (const Address &address, const Size &size, bool free, const SafePtr< MemoryBlock > &left, const SafePtr< MemoryBlock > &right)
 
 MemoryBlock (const MemoryBlock &other)
 
const MemoryBlockoperator= (const MemoryBlock &other)
 copy A to this
 
Address address () const
 Returns address.
 
Size size () const
 Returns size.
 
bool free () const
 Returns true if the block is free.
 
SafePtr< MemoryBlockleft () const
 Returns the left adjacent block.
 
SafePtr< MemoryBlockright () const
 Returns the right adjacent block.
 
void left (const SafePtr< MemoryBlock > &l)
 Sets the left adjacent block.
 
void right (const SafePtr< MemoryBlock > &r)
 Sets the right adjacent block.
 
void set_address (const Address &address)
 Sets the address.
 
void set_size (const Size &size)
 Sets the size.
 
void set_free (bool free)
 Sets block's free status.
 
const MemoryBlockmerge (const MemoryBlock &other)
 Merge A to this (does not check if merge can happen – can_merge(*this,*A) must be already satisfied). The left/right pointers are not changed.
 

Static Public Member Functions

static bool size_less_than (const SafePtr< MemoryBlock > &i, const SafePtr< MemoryBlock > &j)
 Returns true if the size of *i is less than the size of *j.
 
static bool size_eq (SafePtr< MemoryBlock > i, Size sz)
 Returns true if the size of *i equals sz. More...
 
static bool size_geq (SafePtr< MemoryBlock > i, Size sz)
 Returns true if the size of *i greater or equal than sz. More...
 
static bool address_less_than (const SafePtr< MemoryBlock > &i, const SafePtr< MemoryBlock > &j)
 Returns true if the address of *i is less than the address of *j.
 
static bool address_eq (SafePtr< MemoryBlock > i, Address a)
 Returns true if the address of *i equals a. More...
 
static bool is_free (const SafePtr< MemoryBlock > &i)
 Returns true if *i is free.
 

Detailed Description

template<typename A, typename S>
class libint2::MemoryBlock< A, S >

MemoryBlock<Address,Size> describes a block of raw memory addressed via Address and size described by Size.

Member Function Documentation

◆ address_eq()

template<typename A , typename S >
static bool libint2::MemoryBlock< A, S >::address_eq ( SafePtr< MemoryBlock< A, S > >  i,
Address  a 
)
inlinestatic

Returns true if the address of *i equals a.

Note that the arguments are not passed by reference since this function is designed to be converted to std::pointer_to_binary_function, which adds references to the arguments

Referenced by libint2::MemoryManager::find_block().

◆ size_eq()

template<typename A , typename S >
static bool libint2::MemoryBlock< A, S >::size_eq ( SafePtr< MemoryBlock< A, S > >  i,
Size  sz 
)
inlinestatic

Returns true if the size of *i equals sz.

Note that the arguments are not passed by reference since this function is designed to be converted to std::pointer_to_binary_function, which adds references to the arguments

Referenced by libint2::WorstFitMemoryManager::alloc(), libint2::BestFitMemoryManager::alloc(), libint2::FirstFitMemoryManager::alloc(), and libint2::LastFitMemoryManager::alloc().

◆ size_geq()

template<typename A , typename S >
static bool libint2::MemoryBlock< A, S >::size_geq ( SafePtr< MemoryBlock< A, S > >  i,
Size  sz 
)
inlinestatic

Returns true if the size of *i greater or equal than sz.

Note that the arguments are not passed by reference since this function is designed to be converted to std::pointer_to_binary_function, which adds references to the arguments

Referenced by libint2::FirstFitMemoryManager::alloc(), and libint2::LastFitMemoryManager::alloc().


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