Files
moslab-code/doc/source/html/classcxx_1_1Slab.html
2025-09-12 15:55:45 +02:00

272 lines
18 KiB
HTML

<!-- HTML header for doxygen 1.9.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.15.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>L4Re Operating System Framework: cxx::Slab&lt; Type, Slab_size, Max_free, Alloc &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
<link href="l4re-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="L4Re_rgb_logo_quer_hg_h55.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">L4Re Operating System Framework
</div>
<div id="projectbrief">Interface and Usage Documentation</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.15.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search/",'.html');
</script>
<script type="text/javascript">
$(function() { codefold.init(); });
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search',true);
$(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(function(){initNavTree('classcxx_1_1Slab.html','',''); });
</script>
<div id="container">
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="headertitle"><div class="title">cxx::Slab&lt; Type, Slab_size, Max_free, Alloc &gt; Class Template Reference<div class="ingroups"><a class="el" href="group__cxx__api.html">Small C++ Template Library</a></div></div></div>
</div><!--header-->
<div class="contents">
<p><a class="el" href="classcxx_1_1Slab.html" title="Slab allocator for object of type Type.">Slab</a> allocator for object of type <span class="tt">Type</span>.
<a href="#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="slab__alloc_source.html">slab_alloc</a>&gt;</code></p>
<div id="dynsection-0" onclick="return dynsection.toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;"><span class="dynarrow"><span class="arrowhead closed"></span></span>Inheritance diagram for cxx::Slab&lt; Type, Slab_size, Max_free, Alloc &gt;:</div>
<div id="dynsection-0-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-0-content" class="dyncontent" style="display:none;">
<div class="center"><iframe scrolling="no" loading="lazy" frameborder="0" src="classcxx_1_1Slab__inherit__graph.svg" width="315" height="560"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
<div id="dynsection-1" onclick="return dynsection.toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;"><span class="dynarrow"><span class="arrowhead closed"></span></span>Collaboration diagram for cxx::Slab&lt; Type, Slab_size, Max_free, Alloc &gt;:</div>
<div id="dynsection-1-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-1-content" class="dyncontent" style="display:none;">
<div class="center"><iframe scrolling="no" loading="lazy" frameborder="0" src="classcxx_1_1Slab__coll__graph.svg" width="315" height="560"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-pub-methods" class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a9c08c96c3cad689c58ae1412a0b74f97" id="r_a9c08c96c3cad689c58ae1412a0b74f97"><td class="memItemLeft" align="right" valign="top">Type *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a9c08c96c3cad689c58ae1412a0b74f97">alloc</a> () noexcept</td></tr>
<tr class="memdesc:a9c08c96c3cad689c58ae1412a0b74f97"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate an object of type <span class="tt">Type</span>. <br /></td></tr>
<tr class="memitem:abb11cb37c5ec16de67a9f2494037c39f" id="r_abb11cb37c5ec16de67a9f2494037c39f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#abb11cb37c5ec16de67a9f2494037c39f">free</a> (Type *o) noexcept</td></tr>
<tr class="memdesc:abb11cb37c5ec16de67a9f2494037c39f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Free the object addressed by <span class="tt">o</span>. <br /></td></tr>
<tr class="inherit_header pub_methods_classcxx_1_1Base__slab"><td colspan="2" onclick="javascript:dynsection.toggleInherit('pub_methods_classcxx_1_1Base__slab')"><span class="dynarrow"><span class="arrowhead closed"></span></span>Public Member Functions inherited from <a class="el" href="classcxx_1_1Base__slab.html">cxx::Base_slab&lt; sizeof(Type), L4_PAGESIZE, 2, New_allocator &gt;</a></td></tr>
<tr class="memitem:a5b7c524846e7cde26b2e98cf844778b7 inherit pub_methods_classcxx_1_1Base__slab" id="r_a5b7c524846e7cde26b2e98cf844778b7"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcxx_1_1Base__slab.html#a5b7c524846e7cde26b2e98cf844778b7">alloc</a> () noexcept</td></tr>
<tr class="memdesc:a5b7c524846e7cde26b2e98cf844778b7 inherit pub_methods_classcxx_1_1Base__slab"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate a new object. <br /></td></tr>
<tr class="memitem:afe7c2b52fc3f56e683c28ce1e00b657c inherit pub_methods_classcxx_1_1Base__slab" id="r_afe7c2b52fc3f56e683c28ce1e00b657c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcxx_1_1Base__slab.html#afe7c2b52fc3f56e683c28ce1e00b657c">free</a> (void *_o) noexcept</td></tr>
<tr class="memdesc:afe7c2b52fc3f56e683c28ce1e00b657c inherit pub_methods_classcxx_1_1Base__slab"><td class="mdescLeft">&#160;</td><td class="mdescRight">Free the given object (<span class="tt">_o</span>). <br /></td></tr>
<tr class="memitem:aaeb681ef1cc542f1e6dbf1e1c1f38efb inherit pub_methods_classcxx_1_1Base__slab" id="r_aaeb681ef1cc542f1e6dbf1e1c1f38efb"><td class="memItemLeft" align="right" valign="top">unsigned&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcxx_1_1Base__slab.html#aaeb681ef1cc542f1e6dbf1e1c1f38efb">total_objects</a> () const noexcept</td></tr>
<tr class="memdesc:aaeb681ef1cc542f1e6dbf1e1c1f38efb inherit pub_methods_classcxx_1_1Base__slab"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the total number of objects managed by the slab allocator. <br /></td></tr>
<tr class="memitem:a0d151a79c4781dadc59d03f635b2651e inherit pub_methods_classcxx_1_1Base__slab" id="r_a0d151a79c4781dadc59d03f635b2651e"><td class="memItemLeft" align="right" valign="top">unsigned&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcxx_1_1Base__slab.html#a0d151a79c4781dadc59d03f635b2651e">free_objects</a> () const noexcept</td></tr>
<tr class="memdesc:a0d151a79c4781dadc59d03f635b2651e inherit pub_methods_classcxx_1_1Base__slab"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the number of objects which can be allocated before a new empty slab needs to be added to the slab allocator. <br /></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-inherited" class="groupheader"><a id="inherited" name="inherited"></a>
Additional Inherited Members</h2></td></tr>
<tr class="inherit_header pub_types_classcxx_1_1Base__slab"><td colspan="2" onclick="javascript:dynsection.toggleInherit('pub_types_classcxx_1_1Base__slab')"><span class="dynarrow"><span class="arrowhead closed"></span></span>Public Types inherited from <a class="el" href="classcxx_1_1Base__slab.html">cxx::Base_slab&lt; sizeof(Type), L4_PAGESIZE, 2, New_allocator &gt;</a></td></tr>
<tr class="memitem:a1a18ed9f5accef27a92276ef4125d112 inherit pub_types_classcxx_1_1Base__slab" id="r_a1a18ed9f5accef27a92276ef4125d112"><td class="memItemLeft" align="right" valign="top">
typedef <a class="el" href="classcxx_1_1New__allocator.html">New_allocator</a>&lt; Slab_i &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>Slab_alloc</b></td></tr>
<tr class="memdesc:a1a18ed9f5accef27a92276ef4125d112 inherit pub_types_classcxx_1_1Base__slab"><td class="mdescLeft">&#160;</td><td class="mdescRight">Type of the backend allocator. <br /></td></tr>
</table>
<a name="details" id="details"></a><h2 id="header-details" class="groupheader">Detailed Description</h2>
<div class="textblock"><div class="compoundTemplParams">template&lt;typename Type, int Slab_size = L4_PAGESIZE, int Max_free = 2, template&lt; typename A &gt; class Alloc = New_allocator&gt;<br />
class cxx::Slab&lt; Type, Slab_size, Max_free, Alloc &gt;</div><p><a class="el" href="classcxx_1_1Slab.html" title="Slab allocator for object of type Type.">Slab</a> allocator for object of type <span class="tt">Type</span>. </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
<table class="tparams">
<tr><td class="paramname">Type</td><td>The type of the objects to manage. </td></tr>
<tr><td class="paramname">Slab_size</td><td>Size of a slab. </td></tr>
<tr><td class="paramname">Max_free</td><td>The maximum number of free slabs. </td></tr>
<tr><td class="paramname">Alloc</td><td>The allocator for the slabs. </td></tr>
</table>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="slab__alloc_source.html#l00335">335</a> of file <a class="el" href="slab__alloc_source.html">slab_alloc</a>.</p>
</div><a name="doc-func-members" id="doc-func-members"></a><h2 id="header-doc-func-members" class="groupheader">Member Function Documentation</h2>
<a id="a9c08c96c3cad689c58ae1412a0b74f97" name="a9c08c96c3cad689c58ae1412a0b74f97"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9c08c96c3cad689c58ae1412a0b74f97">&#9670;&#160;</a></span>alloc()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Type, int Slab_size = L4_PAGESIZE, int Max_free = 2, template&lt; typename A &gt; class Alloc = New_allocator&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">Type * <a class="el" href="classcxx_1_1Slab.html">cxx::Slab</a>&lt; Type, Slab_size, Max_free, Alloc &gt;::alloc </td>
<td>(</td>
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel noexcept">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Allocate an object of type <span class="tt">Type</span>. </p>
<dl class="section return"><dt>Returns</dt><dd>A pointer to the object just allocated, or 0 on failure.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>The user is responsible for initializing the object. </dd></dl>
<p class="definition">Definition at line <a class="el" href="slab__alloc_source.html#l00355">355</a> of file <a class="el" href="slab__alloc_source.html">slab_alloc</a>.</p>
<p class="reference">References <a class="el" href="slab__alloc_source.html#l00207">cxx::Base_slab&lt; sizeof(Type), Slab_size, Max_free, Alloc &gt;::alloc()</a>.</p>
<div id="dynsection-2" onclick="return dynsection.toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;"><span class="dynarrow"><span class="arrowhead closed"></span></span>Here is the call graph for this function:</div>
<div id="dynsection-2-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-2-content" class="dyncontent" style="display:none;">
<div class="center"><iframe scrolling="no" loading="lazy" frameborder="0" src="classcxx_1_1Slab_a9c08c96c3cad689c58ae1412a0b74f97_cgraph.svg" width="574" height="66"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div>
</div>
<a id="abb11cb37c5ec16de67a9f2494037c39f" name="abb11cb37c5ec16de67a9f2494037c39f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abb11cb37c5ec16de67a9f2494037c39f">&#9670;&#160;</a></span>free()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Type, int Slab_size = L4_PAGESIZE, int Max_free = 2, template&lt; typename A &gt; class Alloc = New_allocator&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classcxx_1_1Slab.html">cxx::Slab</a>&lt; Type, Slab_size, Max_free, Alloc &gt;::free </td>
<td>(</td>
<td class="paramtype">Type *</td> <td class="paramname"><span class="paramname"><em>o</em></span></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span><span class="mlabel noexcept">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Free the object addressed by <span class="tt">o</span>. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">o</td><td>The pointer to the object to free. </td></tr>
</table>
</dd>
</dl>
<dl class="section pre"><dt>Precondition</dt><dd>The object must have been allocated with this allocator. </dd></dl>
<p class="definition">Definition at line <a class="el" href="slab__alloc_source.html#l00366">366</a> of file <a class="el" href="slab__alloc_source.html">slab_alloc</a>.</p>
<p class="reference">References <a class="el" href="slab__alloc_source.html#l00366">free()</a>.</p>
<p class="reference">Referenced by <a class="el" href="slab__alloc_source.html#l00366">free()</a>.</p>
<div id="dynsection-3" onclick="return dynsection.toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;"><span class="dynarrow"><span class="arrowhead closed"></span></span>Here is the call graph for this function:</div>
<div id="dynsection-3-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-3-content" class="dyncontent" style="display:none;">
<div class="center"><iframe scrolling="no" loading="lazy" frameborder="0" src="classcxx_1_1Slab_abb11cb37c5ec16de67a9f2494037c39f_cgraph.svg" width="126" height="60"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
<div id="dynsection-4" onclick="return dynsection.toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;"><span class="dynarrow"><span class="arrowhead closed"></span></span>Here is the caller graph for this function:</div>
<div id="dynsection-4-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-4-content" class="dyncontent" style="display:none;">
<div class="center"><iframe scrolling="no" loading="lazy" frameborder="0" src="classcxx_1_1Slab_abb11cb37c5ec16de67a9f2494037c39f_icgraph.svg" width="126" height="60"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>l4/cxx/<a class="el" href="slab__alloc_source.html">slab_alloc</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="page-nav" class="page-nav-panel">
<div id="page-nav-resize-handle"></div>
<div id="page-nav-tree">
<div id="page-nav-contents">
</div><!-- page-nav-contents -->
</div><!-- page-nav-tree -->
</div><!-- page-nav -->
</div><!-- container -->
<!-- HTML footer for doxygen 1.9.1-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a href="namespacecxx.html">cxx</a></li><li class="navelem"><a href="classcxx_1_1Slab.html">Slab</a></li>
<li class="footer">Generated on <span class="timestamp"></span> for L4Re Operating System Framework by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.15.0 </li>
</ul>
</div>
</body>
</html>