Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

mem/memory.cpp File Reference

#include "memory.h"

Go to the source code of this file.

Functions

void agent_zap (T &x)
void agent_zaparr (T &x)
T* agent_newarr (T **dest, size_t size)
T* agent_new (T **dest)

Variables

const char memid [] = "\100$ Free Agent: memory.cpp, v 0.1 2002/05/29 red0x Exp $"


Detailed Description

C++ Memory Hanlind Wrappers
Include mem/memory.cpp when you need
C++ memory handling functions
DO NOT INCLUDE MEMORY.H, IT WONT LINK
PRPOPERLY.

Definition in file memory.cpp.


Function Documentation

T * agent_new ( T ** dest )
 

Allocate new memory (Template Function)

Parameters:
dest   Double pointer to destination memory
Returns:
Pointer to memory

Definition at line 79 of file memory.cpp.

00080 {
00081     *dest = new T;
00082     return *dest;
00083 }

T * agent_newarr ( T ** dest,
size_t size )
 

Allocate a new array (Template Function)

Parameters:
dest   Double pointer to destination memory
size   Size of array
Returns:
Pointer to memory

Definition at line 61 of file memory.cpp.

00062 {
00063     {assert(size > 0);}
00064     //add a pad, for security
00065     size_t tmpii = size + SAFE_MEM;
00066     *dest = new T[tmpii];
00067     //clear it
00068     memset(*dest, 0, tmpii);
00069     return *dest;
00070 }

void agent_zap ( T & x ) [inline]
 

Delete memory (Template Function)

Parameters:
x   Reference to memory to delete

Definition at line 33 of file memory.cpp.

00034 {
00035     {assert(x != NULL);}
00036     delete x;
00037     x = NULL;
00038 }

void agent_zaparr ( T & x ) [inline]
 

Delete an array (Template Function)

Parameters:
x   Reference to array to delete

Definition at line 46 of file memory.cpp.

00047 {
00048     {assert(x != NULL);}
00049     delete [] x;
00050     x = NULL;
00051 }


Variable Documentation

const char memid = "\100$ Free Agent: memory.cpp, v 0.1 2002/05/29 red0x Exp $" [static]
 

Definition at line 25 of file memory.cpp.


Generated at Thu May 30 15:12:33 2002 for Freeagent by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001