Panda3D
|
A single block as returned from SimpleAllocator::alloc(). More...
#include "simpleAllocator.h"
Public Member Functions | |
~SimpleAllocatorBlock () | |
The block automatically frees itself when it destructs. | |
void | free () |
Releases the allocated space. | |
SimpleAllocator * | get_allocator () const |
Returns the SimpleAllocator object that owns this block. | |
size_t | get_max_size () const |
Returns the maximum size this block can be reallocated to, as limited by the following block. | |
SimpleAllocatorBlock * | get_next_block () const |
Returns a pointer to the next allocated block in the chain, or NULL if there are no more allocated blocks. | |
size_t | get_size () const |
Returns the size of this block. | |
size_t | get_start () const |
Returns the starting point of this block. | |
bool | is_free () const |
Returns true if the block has been freed, false if it is still valid. | |
void | output (ostream &out) const |
bool | realloc (size_t size) |
Changes the size of this block to the specified size. | |
Protected Member Functions | |
SimpleAllocatorBlock (SimpleAllocator *alloc, size_t start, size_t size) | |
A SimpleAllocatorBlock must be constructed via the SimpleAllocator::alloc() call. | |
void | do_free () |
Releases the allocated space. | |
size_t | do_get_max_size () const |
Returns the maximum size this block can be reallocated to, as limited by the following block. | |
bool | do_realloc (size_t size) |
Changes the size of this block to the specified size. | |
Friends | |
class | SimpleAllocator |
A single block as returned from SimpleAllocator::alloc().
Definition at line 95 of file simpleAllocator.h.
SimpleAllocatorBlock::SimpleAllocatorBlock | ( | SimpleAllocator * | alloc, |
size_t | start, | ||
size_t | size | ||
) | [inline, protected] |
A SimpleAllocatorBlock must be constructed via the SimpleAllocator::alloc() call.
Definition at line 170 of file simpleAllocator.I.
SimpleAllocatorBlock::~SimpleAllocatorBlock | ( | ) | [inline] |
The block automatically frees itself when it destructs.
Definition at line 185 of file simpleAllocator.I.
References free().
void SimpleAllocatorBlock::do_free | ( | ) | [inline, protected] |
Releases the allocated space.
Assumes the lock is already held.
Definition at line 296 of file simpleAllocator.I.
References SimpleAllocator::mark_contiguous(), and LinkedListNode::remove_from_list().
Referenced by free().
size_t SimpleAllocatorBlock::do_get_max_size | ( | ) | const [inline, protected] |
Returns the maximum size this block can be reallocated to, as limited by the following block.
Assumes the lock is already held.
Definition at line 315 of file simpleAllocator.I.
Referenced by do_realloc(), and get_max_size().
bool SimpleAllocatorBlock::do_realloc | ( | size_t | size | ) | [inline, protected] |
Changes the size of this block to the specified size.
Returns true if the change is accepted, false if there was not enough room.
Assumes the lock is already held.
Definition at line 335 of file simpleAllocator.I.
References do_get_max_size(), and SimpleAllocator::mark_contiguous().
Referenced by realloc().
void SimpleAllocatorBlock::free | ( | ) | [inline] |
Releases the allocated space.
Definition at line 195 of file simpleAllocator.I.
References do_free().
Referenced by ~SimpleAllocatorBlock().
SimpleAllocator * SimpleAllocatorBlock::get_allocator | ( | ) | const [inline] |
Returns the SimpleAllocator object that owns this block.
Returns NULL if the block has been freed.
Definition at line 209 of file simpleAllocator.I.
Referenced by SimpleAllocator::do_alloc(), and VertexDataBlock::get_page().
size_t SimpleAllocatorBlock::get_max_size | ( | ) | const [inline] |
Returns the maximum size this block can be reallocated to, as limited by the following block.
Definition at line 255 of file simpleAllocator.I.
References do_get_max_size().
SimpleAllocatorBlock * SimpleAllocatorBlock::get_next_block | ( | ) | const [inline] |
Returns a pointer to the next allocated block in the chain, or NULL if there are no more allocated blocks.
Reimplemented in VertexDataBlock.
Definition at line 282 of file simpleAllocator.I.
size_t SimpleAllocatorBlock::get_size | ( | ) | const [inline] |
Returns the size of this block.
It is an error to call this if the block has been freed.
Definition at line 232 of file simpleAllocator.I.
Referenced by VertexDataSaveFile::read_data().
size_t SimpleAllocatorBlock::get_start | ( | ) | const [inline] |
Returns the starting point of this block.
It is an error to call this if the block has been freed.
Definition at line 220 of file simpleAllocator.I.
Referenced by VertexDataBlock::get_pointer(), and VertexDataSaveFile::read_data().
bool SimpleAllocatorBlock::is_free | ( | ) | const [inline] |
Returns true if the block has been freed, false if it is still valid.
Definition at line 244 of file simpleAllocator.I.
bool SimpleAllocatorBlock::realloc | ( | size_t | size | ) | [inline] |
Changes the size of this block to the specified size.
Returns true if the change is accepted, false if there was not enough room.
Definition at line 269 of file simpleAllocator.I.
References do_realloc().