1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../../../css/manpage.css" type="text/css" />
7<title>Create</title>
8  </head>
9  <body>
10<h1><CODE><a href="../../../nn/Overview.html">nn</a>::<a href="../../../nn/fnd/Overview.html">fnd</a>::<a href="../../../nn/fnd/UnitHeapTemplate/Overview.html">UnitHeapTemplate</a>::Create</CODE> Member Function</h1>
11<h2>Syntax</h2>
12    <div class="section">
13      <pre class="definition">
14static <a href="../../../nn/fnd/UnitHeapTemplate/Overview.html">UnitHeapTemplate</a> * Create(
15     <a href="../../../nn/fnd/HeapBase/Overview.html">HeapBase</a> * parent,
16     size_t unit,
17     void * addr,
18     size_t size,
19     <a href="../../../nn_types/s32.html">s32</a> alignment = DEFAULT_ALIGNMENT,
20     <a href="../../../nn_types/bit32.html">bit32</a> option = 0,
21     <a href="../../../nn_types/bit32.html">bit32</a> placement = HEAP_INFOPLACEMENT_HEAD
22);
23</pre>
24    </div>
25<h2>Parameters</h2>
26    <div class="section">
27      <table class="arguments">
28        <thead>
29          <tr>
30            <td width="15" />
31<th>Name</th>
32<td>Description</td>
33          </tr>
34        </thead>
35        <tr>
36<td>in</td>
37<th>parent</th>
38<td>Specifies the parent heap whose region contains <SPAN class="argument">addr</SPAN>.</td>
39        </tr>
40        <tr>
41<td>in</td>
42<th>unit</th>
43<td>The size of the unit.</td>
44        </tr>
45        <tr>
46<td>in</td>
47<th>addr</th>
48<td>The starting address of the memory used by the unit heap.</td>
49        </tr>
50        <tr>
51<td>in</td>
52<th>size</th>
53<td>The size of the memory used by the unit heap.</td>
54        </tr>
55        <tr>
56<td>in</td>
57<th>alignment</th>
58<td>The alignment of the unit.</td>
59        </tr>
60        <tr>
61<td>in</td>
62<th>option</th>
63<td>Specifies options. (Not yet implemented.)</td>
64        </tr>
65        <tr>
66<td>in</td>
67<th>placement</th>
68<td>Specifies the location where the management region (<CODE>UnitHeap</CODE> object) is located.</td>
69        </tr> </table>
70    </div>
71<h2>Return Values</h2>
72    <div class="section"> </div>
73<h2>Description</h2>
74    <div class="section">
75<p>Creates a unit heap within a heap.</p><p>Heaps that are created with this function must be destroyed using <CODE><a href="../../../nn/fnd/HeapBase/Destroy.html">HeapBase::Destroy</a></CODE>. The actual UnitHeap object is created within the region defined by the values specified for the <SPAN class="argument">addr</SPAN> and <SPAN class="argument">size</SPAN> parameters. This means that the actual size allocated to the heap is the size of the specified region minus <CODE>sizeof(UnitHeap)</CODE>.</p><p>Use the <SPAN class="argument">placement</SPAN> parameter to specify where the UnitHeap object is placed. If you specify <CODE>HEAP_INFOPLACEMENT_HEAD</CODE> for placement, the actual UnitHeap object is placed at the start of the region (the region that starts at <SPAN class="argument">addr</SPAN> and ends at <CODE>addr+sizeof(UnitHeap)</CODE>. If you specify <CODE>HEAP_INFOPLACEMENT_TAIL</CODE> for placement, the actual UnitHeap object is placed at the end of the region (the region that starts at <CODE>addr+size-sizeof(UnitHeap)</CODE> and ends at <CODE>addr+size</CODE>.</p><!-- write here --></div>
76<h2>Revision History</h2>
77    <div class="section">
78      <dl class="history">
79        <dt>2010/01/08</dt>
80<dd>Added the <SPAN class="argument">placement</SPAN> argument, which is used to specify where to place the management region.<br />
81        </dd>
82        <dt>2010/01/07</dt>
83<dd>Initial version.<br />
84        </dd>
85      </dl>
86    </div>
87  <hr><p>CONFIDENTIAL</p></body>
88</html>