wavelength 1.0.0
Loading...
Searching...
No Matches
MemHandle Class Reference

Movable block of a handle heap, reached through a handle the block points back to. More...

#include <memhandle.h>

Public Member Functions

 MemHandle (HandleBlock *pBlock)
 Attach the handle to a block with no locks.
void * Lock ()
 Count a lock and report the data.
void Unlock ()
 Undo one Lock().
void * Resize (int nBytes)
 Shrink the block in place through MemRealloc().
HandleBlock * GetBlock () const
void SetBlock (HandleBlock *pBlock)

Static Public Member Functions

static void * operator new (size_t)
 Allocate a handle from the pool of 4-byte blocks.
static void operator delete (void *pBlock)
 Return a handle to the pool of 4-byte blocks.
static MemHandle * Alloc (int nBytes, const char *pszTag)
 Allocate a block and a handle for it.
static void Free (MemHandle *pHandle)
 Free a handle and its block.

Detailed Description

Movable block of a handle heap, reached through a handle the block points back to.

The class is not polymorphic. The name is inferred from the allocation tag "MemHandle".

Constructor & Destructor Documentation

◆ MemHandle()

MemHandle::MemHandle ( HandleBlock * pBlock)
explicit

Attach the handle to a block with no locks.

Parameters
pBlockThe block.
Ghidra address:
NTSC-U/C: 0x0029ae60
Ghidra address:
PAL: 0x002a4a80

Member Function Documentation

◆ operator new()

void * MemHandle::operator new ( size_t )
inlinestatic

Allocate a handle from the pool of 4-byte blocks.

Returns
The block.

◆ operator delete()

void MemHandle::operator delete ( void * pBlock)
inlinestatic

Return a handle to the pool of 4-byte blocks.

Parameters
pBlockThe block.

◆ Alloc()

MemHandle * MemHandle::Alloc ( int nBytes,
const char * pszTag )
static

Allocate a block and a handle for it.

The block takes the size rounded up to 16 bytes, with its header.

Parameters
nBytesThe bytes of data.
pszTagThe allocation tag.
Returns
The handle.
Ghidra address:
NTSC-U/C: 0x0029aeb0
Ghidra address:
PAL: 0x002a4ad0

◆ Free()

void MemHandle::Free ( MemHandle * pHandle)
static

Free a handle and its block.

A null handle is ignored.

Parameters
pHandleThe handle.
Ghidra address:
NTSC-U/C: 0x0029af40
Ghidra address:
PAL: 0x002a4b60

◆ Lock()

void * MemHandle::Lock ( )

Count a lock and report the data.

Returns
The data of the block.
Ghidra address:
NTSC-U/C: 0x0029ae78
Ghidra address:
PAL: 0x002a4a98

◆ Unlock()

void MemHandle::Unlock ( )

Undo one Lock().

Ghidra address:
NTSC-U/C: 0x0029ae98
Ghidra address:
PAL: 0x002a4ab8

◆ Resize()

void * MemHandle::Resize ( int nBytes)

Shrink the block in place through MemRealloc().

Parameters
nBytesThe bytes of data.
Returns
The block MemRealloc() reports.
Ghidra address:
NTSC-U/C: 0x0029af10
Ghidra address:
PAL: 0x002a4b30

◆ GetBlock()

HandleBlock * MemHandle::GetBlock ( ) const
inline
Returns
The block.

◆ SetBlock()

void MemHandle::SetBlock ( HandleBlock * pBlock)
inline
Parameters
pBlockThe block.

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