CxxUtils::pointer_list_base::allocator Class Reference

Very simple allocator for use with pointer_list. More...

#include <pointer_list.h>

Inheritance diagram for CxxUtils::pointer_list_base::allocator:
CxxUtils::pointer_list< NELT >::allocator

List of all members.

Classes

struct  chunk
 One memory allocation chunk.

Public Member Functions

 allocator (size_t nelt, size_t nblock, unsigned long end_mask, unsigned long end_offs)
 Constructor.
 ~allocator ()
 Destructor. Deletes all blocks from this allocator.
list_blockallocate ()
 Allocate a new block.
size_t nelt () const
size_t nchunks () const
 Return the current number of allocated chunks.
bool at_end (const void *p) const
 Test if P is pointing at the end-pointer of a block.

Detailed Description

Very simple allocator for use with pointer_list.

We allocate large chunks and divide them up into list_block's. We don't support deleting individual elements; instead, everything is deleted when the allocator is. The chunks are chained together to allow for this.

The total size of a block should be a power of two, and blocks must be aligned to this boundary.


Constructor & Destructor Documentation

CxxUtils::pointer_list_base::allocator::allocator ( size_t  nelt,
size_t  nblock,
unsigned long  end_mask,
unsigned long  end_offs 
)

Constructor.

Parameters:
nelt Number of pointers per block (excluding the end pointer). Must be one less than a power of two.
nblock Number of blocks to allocate per chunk.
end_mask Mask to use for end-of-block test.
end_offs Offset to use for end-of-block test.
nelt Number of pointers per block. (excluding the end pointer).
nblock Number of blocks to allocate per chunk.
end_mask Mask to use for end-of-block test.
end_offs Offset to use for end-of-block test.

Member Function Documentation

bool CxxUtils::pointer_list_base::allocator::at_end ( const void *  p  )  const [inline]

Test if P is pointing at the end-pointer of a block.

Test to see if we're looking at the end of a block.

Parameters:
p The pointer to test.
size_t CxxUtils::pointer_list_base::allocator::nchunks (  )  const [inline]

Return the current number of allocated chunks.

Current number of allocated chunks.

size_t CxxUtils::pointer_list_base::allocator::nelt (  )  const [inline]

Return the number of pointers per block (excluding the end-pointer).


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 15 Apr 2017 for RootCore Packages by  doxygen 1.6.1