<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>Crystal Space 1.2.1: CS::Memory::AllocatorNew< T > Class Template Reference (Crystal Space 1.2.1 Public API Reference)</title> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="head"> <tr height="59"> <td class="head" width="202" valign="bottom" style="padding-left:0;"><a href="http://www.crystalspace3d.org/"><img src="csblur.png" width="236" height="59" alt="CrystalSpace" border="0"></a></td> <td class="head"><h2>Public API Reference</h2></td> </tr> <tr height="11"> <td colspan="2" class="headshadow" valign="top" style="padding-left:0;"><img src="csblurb.png" width="236" height="11" alt="" border="0"></td> </tr> </table> <div class="content"> <!-- Generated by Doxygen 1.5.3 --> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="classes.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="classes.html"><span>Alphabetical List</span></a></li> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> <div class="nav"> <a class="el" href="namespaceCS.html">CS</a>::<a class="el" href="namespaceCS_1_1Memory.html">Memory</a>::<a class="el" href="classCS_1_1Memory_1_1AllocatorNew.html">AllocatorNew</a></div> <h1>CS::Memory::AllocatorNew< T > Class Template Reference</h1><!-- doxytag: class="CS::Memory::AllocatorNew" -->A default memory allocator that allocates using new T[]. <a href="#_details">More...</a> <p> <code>#include <<a class="el" href="allocator_8h-source.html">csutil/allocator.h</a>></code> <p> <p> <a href="classCS_1_1Memory_1_1AllocatorNew-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="classCS_1_1Memory_1_1AllocatorNew.html#ff293dfae0db84989bb3f5a7cc869ebc">Alloc</a> (const size_t n)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Allocate a block of memory of size <code>n</code>. <a href="#ff293dfae0db84989bb3f5a7cc869ebc"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCS_1_1Memory_1_1AllocatorNew.html#411c7db4183f7a676744e42690a4f896">Free</a> (void *p)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Free the block <code>p</code>. <a href="#411c7db4183f7a676744e42690a4f896"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="classCS_1_1Memory_1_1AllocatorNew.html#975b45b1341665712bc187aa87f9b625">Realloc</a> (void *p, size_t newSize)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Resize the allocated block <code>p</code> to size <code>newSize</code>. <a href="#975b45b1341665712bc187aa87f9b625"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCS_1_1Memory_1_1AllocatorNew.html#e1320d04e6f43c370767ee603d063005">SetMemTrackerInfo</a> (const char *)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Set the information used for memory tracking. <a href="#e1320d04e6f43c370767ee603d063005"></a><br></td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> <h3>template<typename T><br> class CS::Memory::AllocatorNew< T ></h3> A default memory allocator that allocates using new T[]. <p> <dl class="warning" compact><dt><b>Warning:</b></dt><dd>Using this allocator is somewhat dangerous, as an array of Ts to fit the requested size is allocated, and the array is casted to a void*. Using anything but POD types is irresponsible. Don't use this allocator unless you really, <em>really</em> have to - for example, when memory is passed from/to code which uses new[]/delete[] of T for allocation/deallocation. </dd></dl> <dl class="remark" compact><dt><b>Remarks:</b></dt><dd>Reallocatability is inherently unsupported. </dd></dl> <p>Definition at line <a class="el" href="allocator_8h-source.html#l00330">330</a> of file <a class="el" href="allocator_8h-source.html">allocator.h</a>.</p> <hr><h2>Member Function Documentation</h2> <a class="anchor" name="ff293dfae0db84989bb3f5a7cc869ebc"></a><!-- doxytag: member="CS::Memory::AllocatorNew::Alloc" ref="ff293dfae0db84989bb3f5a7cc869ebc" args="(const size_t n)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename T> </div> <table class="memname"> <tr> <td class="memname">void* <a class="el" href="classCS_1_1Memory_1_1AllocatorNew.html">CS::Memory::AllocatorNew</a>< T >::Alloc </td> <td>(</td> <td class="paramtype">const size_t </td> <td class="paramname"> <em>n</em> </td> <td> ) </td> <td width="100%"><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Allocate a block of memory of size <code>n</code>. <p> <p>Definition at line <a class="el" href="allocator_8h-source.html#l00334">334</a> of file <a class="el" href="allocator_8h-source.html">allocator.h</a>.</p> </div> </div><p> <a class="anchor" name="411c7db4183f7a676744e42690a4f896"></a><!-- doxytag: member="CS::Memory::AllocatorNew::Free" ref="411c7db4183f7a676744e42690a4f896" args="(void *p)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename T> </div> <table class="memname"> <tr> <td class="memname">void <a class="el" href="classCS_1_1Memory_1_1AllocatorNew.html">CS::Memory::AllocatorNew</a>< T >::Free </td> <td>(</td> <td class="paramtype">void * </td> <td class="paramname"> <em>p</em> </td> <td> ) </td> <td width="100%"><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Free the block <code>p</code>. <p> <p>Definition at line <a class="el" href="allocator_8h-source.html#l00339">339</a> of file <a class="el" href="allocator_8h-source.html">allocator.h</a>.</p> </div> </div><p> <a class="anchor" name="975b45b1341665712bc187aa87f9b625"></a><!-- doxytag: member="CS::Memory::AllocatorNew::Realloc" ref="975b45b1341665712bc187aa87f9b625" args="(void *p, size_t newSize)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename T> </div> <table class="memname"> <tr> <td class="memname">void* <a class="el" href="classCS_1_1Memory_1_1AllocatorNew.html">CS::Memory::AllocatorNew</a>< T >::Realloc </td> <td>(</td> <td class="paramtype">void * </td> <td class="paramname"> <em>p</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"> <em>newSize</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td width="100%"><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Resize the allocated block <code>p</code> to size <code>newSize</code>. <p> <p>Definition at line <a class="el" href="allocator_8h-source.html#l00344">344</a> of file <a class="el" href="allocator_8h-source.html">allocator.h</a>.</p> <p>References <a class="el" href="cssysdef_8h.html#98cf1ab82994ac8a7c2a25120f6f15d2">CS_ASSERT_MSG</a>.</p> </div> </div><p> <a class="anchor" name="e1320d04e6f43c370767ee603d063005"></a><!-- doxytag: member="CS::Memory::AllocatorNew::SetMemTrackerInfo" ref="e1320d04e6f43c370767ee603d063005" args="(const char *)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename T> </div> <table class="memname"> <tr> <td class="memname">void <a class="el" href="classCS_1_1Memory_1_1AllocatorNew.html">CS::Memory::AllocatorNew</a>< T >::SetMemTrackerInfo </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> </td> <td> ) </td> <td width="100%"><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Set the information used for memory tracking. <p> <p>Definition at line <a class="el" href="allocator_8h-source.html#l00350">350</a> of file <a class="el" href="allocator_8h-source.html">allocator.h</a>.</p> </div> </div><p> <hr>The documentation for this class was generated from the following file:<ul> <li>csutil/<a class="el" href="allocator_8h-source.html">allocator.h</a></ul> <hr size="1"><address><small>Generated for Crystal Space 1.2.1 by <a href="http://www.doxygen.org/index.html">doxygen</a> 1.5.3 </small></address> </div></body> </html>