Panda3D
Public Member Functions | Friends | List of all members
SimpleAllocatorBlock Class Reference

A single block as returned from SimpleAllocator::alloc(). More...

#include "simpleAllocator.h"

Inheritance diagram for SimpleAllocatorBlock:
LinkedListNode VertexDataBlock VertexDataSaveBlock

Public Member Functions

 SimpleAllocatorBlock (const SimpleAllocatorBlock &copy)=delete
 
 SimpleAllocatorBlock (SimpleAllocatorBlock &&from)
 Transfers ownership from the given SimpleAllocatorBlock to this one. More...
 
 ~SimpleAllocatorBlock ()
 The block automatically frees itself when it destructs. More...
 
void free ()
 Releases the allocated space. More...
 
SimpleAllocatorget_allocator () const
 Returns the SimpleAllocator object that owns this block. More...
 
size_t get_max_size () const
 Returns the maximum size this block can be reallocated to, as limited by the following block. More...
 
SimpleAllocatorBlockget_next_block () const
 Returns a pointer to the next allocated block in the chain, or NULL if there are no more allocated blocks. More...
 
size_t get_size () const
 Returns the size of this block. More...
 
size_t get_start () const
 Returns the starting point of this block. More...
 
bool is_free () const
 Returns true if the block has been freed, false if it is still valid. More...
 
SimpleAllocatorBlockoperator= (const SimpleAllocatorBlock &copy)=delete
 
SimpleAllocatorBlockoperator= (SimpleAllocatorBlock &&from)
 Frees this block and instead takes ownership of the given other block. More...
 
void output (std::ostream &out) const
 
bool realloc (size_t size)
 Changes the size of this block to the specified size. More...
 

Friends

class SimpleAllocator
 

Detailed Description

A single block as returned from SimpleAllocator::alloc().

Definition at line 90 of file simpleAllocator.h.

Constructor & Destructor Documentation

◆ SimpleAllocatorBlock()

SimpleAllocatorBlock::SimpleAllocatorBlock ( SimpleAllocatorBlock &&  from)
inline

Transfers ownership from the given SimpleAllocatorBlock to this one.

Definition at line 154 of file simpleAllocator.I.

◆ ~SimpleAllocatorBlock()

SimpleAllocatorBlock::~SimpleAllocatorBlock ( )
inline

The block automatically frees itself when it destructs.

Definition at line 172 of file simpleAllocator.I.

Member Function Documentation

◆ free()

void SimpleAllocatorBlock::free ( )
inline

Releases the allocated space.

Definition at line 202 of file simpleAllocator.I.

◆ get_allocator()

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 214 of file simpleAllocator.I.

◆ get_max_size()

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 251 of file simpleAllocator.I.

◆ get_next_block()

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.

Definition at line 273 of file simpleAllocator.I.

◆ get_size()

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 233 of file simpleAllocator.I.

◆ get_start()

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 223 of file simpleAllocator.I.

◆ is_free()

bool SimpleAllocatorBlock::is_free ( ) const
inline

Returns true if the block has been freed, false if it is still valid.

Definition at line 242 of file simpleAllocator.I.

◆ operator=()

SimpleAllocatorBlock & SimpleAllocatorBlock::operator= ( SimpleAllocatorBlock &&  from)
inline

Frees this block and instead takes ownership of the given other block.

Definition at line 180 of file simpleAllocator.I.

◆ realloc()

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 262 of file simpleAllocator.I.


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