IBAMR  IBAMR version 0.20.
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | List of all members
SAMRAI::tbox::Allocator Class Reference

#include <tbox/Allocator.h>

Public Member Functions

template<typename TYPE >
TYPE * allocate (const std::size_t block_size)
 

Static Public Member Functions

static Allocator & getAllocator ()
 
template<typename TYPE >
static std::size_t getNumberOfAllocations ()
 
template<typename TYPE >
static void deallocate (TYPE *const block, const std::size_t block_size)
 

Private Member Functions

 Allocator ()
 
 Allocator (const Allocator &)=delete
 
Allocator & operator= (const Allocator &)=delete
 
 ~Allocator ()
 

Static Private Member Functions

template<typename TYPE >
static std::size_t & count ()
 
static std::pair< bool, void * > internal_allocate (std::size_t n_bytes)
 
static void internal_deallocate (void *buffer, std::size_t n_bytes)
 

Detailed Description

Internal allocation class. Responsible for managing a memory pool for all Array instances.

Constructor & Destructor Documentation

◆ Allocator() [1/2]

SAMRAI::tbox::Allocator::Allocator ( )
private

Constructor. As there is only one Allocator at a time this is private.

◆ Allocator() [2/2]

SAMRAI::tbox::Allocator::Allocator ( const Allocator &  )
privatedelete

◆ ~Allocator()

SAMRAI::tbox::Allocator::~Allocator ( )
private

Member Function Documentation

◆ getAllocator()

static Allocator& SAMRAI::tbox::Allocator::getAllocator ( )
static

◆ operator=()

Allocator& SAMRAI::tbox::Allocator::operator= ( const Allocator &  )
privatedelete

◆ count()

template<typename TYPE >
static std::size_t& SAMRAI::tbox::Allocator::count ( )
inlinestaticprivate

◆ internal_allocate()

static std::pair<bool, void *> SAMRAI::tbox::Allocator::internal_allocate ( std::size_t  n_bytes)
staticprivate

Internal allocation function.

Returns
A pair whose first value indicates whether or not the memory was allocated (i.e., true for a new allocation, false for reusing an existing allocation), and whose second value is a pointer to at least n_bytes of storage.

◆ internal_deallocate()

static void SAMRAI::tbox::Allocator::internal_deallocate ( void *  buffer,
std::size_t  n_bytes 
)
staticprivate

Internal deallocation function.

The second size must be the same as the value provided to internal_allocate().

◆ getNumberOfAllocations()

template<typename TYPE >
static std::size_t SAMRAI::tbox::Allocator::getNumberOfAllocations ( )
inlinestatic

◆ allocate()

template<typename TYPE >
TYPE* SAMRAI::tbox::Allocator::allocate ( const std::size_t  block_size)
inline

Return a block of memory with enough space for block_size elements of type TYPE. This block may either be newly allocated (via std::malloc()) or taken from a pool of previously allocated data.

This function is not static to ensure it is only called after Allocator() called.

◆ deallocate()

template<typename TYPE >
static void SAMRAI::tbox::Allocator::deallocate ( TYPE *const  block,
const std::size_t  block_size 
)
inlinestatic

Return an allocated block to the allocator.

This function is static since it may be run after ~Allocator() is run.


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