Memory Block Class


Topics:

Overview
Constants
Functions


Overview

The MemoryBlock class is a general-purpose data structure is use by the Device Cache classes to store data in small fixed length blocks of memory.


Constants

const unsigned MEMORY_BLOCK_SIZE = 1024; // Fixed Block size


Functions

MemoryBlock::MemoryBlock()
MemoryBlock::GetDimLen()
MemoryBlock::Load()
MemoryBlock::length()
MemoryBlock::m_buf()
MemoryBlock::resize()

MemoryBlock::MemoryBlock() - Public member function used to construct a memory block object and null the memory block.

unsigned MemoryBlock::GetDimLen() - Public member function that returns the maximum number of bytes a block can contain.

void MemoryBlock::Load(const void *buf, unsigned bytes) - Public member function used to load data into a buffer. NOTE: The byte size will automatically be truncated if the size of the fixed length block is exceeded.

unsigned MemoryBlock::length() - Public member function that returns the logical length (number of byte actually used) of a memory block.

char *MemoryBlock::m_buf() - Public member function that returns a pointer to the memory block.

const char *MemoryBlock::m_buf() - Public member function that returns a pointer to the memory buffer.

int MemoryBlock::resize(unsigned bytes) - Public member function used to resize the logical length of this block. Returns false if the fixed length is exceeded.


End Of Document