blob: ee2f153f684a1b452907de2fa8e5883e07717f0c [file] [log] [blame]
<HTML><HEAD><TITLE>Xalan-C++ API Documentation</TITLE></HEAD>
<BODY>
<h2 align="center">Xalan-C++ API Documentation</h2>
<h3 align="center">The Xalan C++ XSLT Processor Version 1.10</h3>
</BODY>
<!-- Generated by Doxygen 1.2.8.1 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center>
<hr><h1>ArenaBlock.hpp</h1><a href="ArenaBlock_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">/*</font>
00002 <font class="comment"> * Copyright 1999-2004 The Apache Software Foundation.</font>
00003 <font class="comment"> *</font>
00004 <font class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</font>
00005 <font class="comment"> * you may not use this file except in compliance with the License.</font>
00006 <font class="comment"> * You may obtain a copy of the License at</font>
00007 <font class="comment"> *</font>
00008 <font class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</font>
00009 <font class="comment"> *</font>
00010 <font class="comment"> * Unless required by applicable law or agreed to in writing, software</font>
00011 <font class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</font>
00012 <font class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</font>
00013 <font class="comment"> * See the License for the specific language governing permissions and</font>
00014 <font class="comment"> * limitations under the License.</font>
00015 <font class="comment"> */</font>
00016
00017 <font class="preprocessor">#if !defined(ARENABLOCK_INCLUDE_GUARD_1357924680)</font>
<a name="l00018"></a><a class="code" href="ArenaBlock_8hpp.html#a0">00018</a> <font class="preprocessor"></font><font class="preprocessor">#define ARENABLOCK_INCLUDE_GUARD_1357924680</font>
00019 <font class="preprocessor"></font>
00020
00021
00022 <font class="preprocessor">#include &lt;<a class="code" href="ArenaBlockBase_8hpp.html">xalanc/PlatformSupport/ArenaBlockBase.hpp</a>&gt;</font>
00023
00024
00025
00026
00027 XALAN_CPP_NAMESPACE_BEGIN
00028
00029
00030 <font class="keyword">template</font>&lt;<font class="keyword">class </font><a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>,
00031 <font class="preprocessor">#if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)</font>
00032 <font class="preprocessor"></font> <font class="keyword">class </font>SizeType&gt;
00033 <font class="preprocessor">#else</font>
00034 <font class="preprocessor"></font> <font class="keyword">class </font>SizeType = size_t&gt;
00035 #endif
<a name="l00036"></a><a class="code" href="classArenaBlock.html">00036</a> class <a class="code" href="classArenaBlock.html">ArenaBlock</a> : <font class="keyword">public</font> <a class="code" href="classArenaBlockBase.html">ArenaBlockBase</a>&lt;ObjectType, SizeType&gt;
00037 {
00038 <font class="keyword">public</font>:
00039
<a name="l00040"></a><a class="code" href="classArenaBlock.html#s0">00040</a> <font class="keyword">typedef</font> <a class="code" href="classArenaBlockBase.html">ArenaBlockBase&lt;ObjectType, SizeType&gt;</a> <a class="code" href="classstd_1_1unary__function.html">BaseClassType</a>;
00041
<a name="l00042"></a><a class="code" href="classArenaBlock.html#s1">00042</a> <font class="keyword">typedef</font> <a class="code" href="classArenaBlock.html">ArenaBlock&lt;ObjectType, SizeType&gt;</a> <a class="code" href="classXalanDeque.html">ThisType</a>;
00043
<a name="l00044"></a><a class="code" href="classArenaBlock.html#s2">00044</a> <font class="keyword">typedef</font> <font class="keyword">typename</font> BaseClassType::size_type size_type;
00045
00046 <font class="comment">/*</font>
00047 <font class="comment"> * Construct an ArenaBlock of the specified size</font>
00048 <font class="comment"> * of objects.</font>
00049 <font class="comment"> *</font>
00050 <font class="comment"> * @param theManager The memory manager instance for the block.</font>
00051 <font class="comment"> * @param theBlockSize The size of the block (the number of objects it can contain).</font>
00052 <font class="comment"> */</font>
<a name="l00053"></a><a class="code" href="classArenaBlock.html#a0">00053</a> <a class="code" href="classArenaBlock.html#a0">ArenaBlock</a>(
00054 MemoryManagerType&amp; theManager,
00055 size_type theBlockSize) :
00056 <a class="code" href="classstd_1_1unary__function.html">BaseClassType</a>(theManager, theBlockSize)
00057 {
00058 }
00059
<a name="l00060"></a><a class="code" href="classArenaBlock.html#a1">00060</a> <a class="code" href="classArenaBlock.html#a1">~ArenaBlock</a>()<font class="keyword"></font>
00061 <font class="keyword"> </font>{
00062 assert( this-&gt;m_objectCount &lt;= this-&gt;m_blockSize );
00063
00064 <font class="keywordflow">for</font> ( size_type i = 0; i &lt; this-&gt;m_objectCount ; ++i )
00065 {
00066 <a class="code" href="XalanMemoryManagement_8hpp.html#a10">XalanDestroy</a>(this-&gt;m_objectBlock[i]);
00067 }
00068 }
00069
00070 <font class="keyword">static</font> <a class="code" href="classXalanDeque.html">ThisType</a>*
<a name="l00071"></a><a class="code" href="classArenaBlock.html#d0">00071</a> <a class="code" href="classArenaBlock.html#d0">create</a>(
00072 MemoryManagerType&amp; theManager,
00073 size_type theBlockSize)<font class="keyword"></font>
00074 <font class="keyword"> </font>{
00075 <a class="code" href="classXalanDeque.html">ThisType</a>* theInstance;
00076
00077 <font class="keywordflow">return</font> <a class="code" href="XalanMemoryManagement_8hpp.html#a17">XalanConstruct</a>(
00078 theManager,
00079 theInstance,
00080 theManager,
00081 theBlockSize);
00082 }
00083
00084 <font class="comment">/*</font>
00085 <font class="comment"> * Allocate a block. Once the object is constructed, you must call</font>
00086 <font class="comment"> * commitAllocation().</font>
00087 <font class="comment"> *</font>
00088 <font class="comment"> * @return a pointer to the new block.</font>
00089 <font class="comment"> */</font>
00090 <a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>*
<a name="l00091"></a><a class="code" href="classArenaBlock.html#a2">00091</a> <a class="code" href="classArenaBlock.html#a2">allocateBlock</a>()<font class="keyword"></font>
00092 <font class="keyword"> </font>{
00093 <font class="comment">// Any space left?</font>
00094 <font class="keywordflow">if</font> (this-&gt;m_objectCount == this-&gt;m_blockSize)
00095 {
00096 <font class="keywordflow">return</font> 0;
00097 }
00098 <font class="keywordflow">else</font>
00099 {
00100 assert(this-&gt;m_objectBlock != 0);
00101
00102 <font class="keywordflow">return</font> this-&gt;m_objectBlock + this-&gt;m_objectCount;
00103 }
00104 }
00105
00106 <font class="comment">/*</font>
00107 <font class="comment"> * Commit the previous allocation.</font>
00108 <font class="comment"> *</font>
00109 <font class="comment"> * @param theBlock the address that was returned by allocateBlock()</font>
00110 <font class="comment"> */</font>
00111 <font class="keywordtype">void</font>
00112 <font class="preprocessor">#if defined (NDEBUG)</font>
00113 <font class="preprocessor"></font> <a class="code" href="classArenaBlock.html#a3">commitAllocation</a>(<a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>* <font class="comment">/* theBlock */</font>)
00114 <font class="preprocessor">#else</font>
<a name="l00115"></a><a class="code" href="classArenaBlock.html#a3">00115</a> <font class="preprocessor"></font> <a class="code" href="classArenaBlock.html#a3">commitAllocation</a>(<a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>* theBlock)
00116 <font class="preprocessor">#endif</font>
00117 <font class="preprocessor"></font> {
00118 assert(theBlock == this-&gt;m_objectBlock + this-&gt;m_objectCount);
00119 assert(this-&gt;m_objectCount &lt; this-&gt;m_blockSize);
00120
00121 ++this-&gt;m_objectCount;
00122 }
00123
00124 <font class="comment">/*</font>
00125 <font class="comment"> * Determine if this block owns the specified object. Note</font>
00126 <font class="comment"> * that even if the object address is within our block, this</font>
00127 <font class="comment"> * call will return false if no object currently occupies the</font>
00128 <font class="comment"> * block. See also ownsBlock().</font>
00129 <font class="comment"> *</font>
00130 <font class="comment"> * @param theObject the address of the object.</font>
00131 <font class="comment"> * @return true if we own the object, false if not.</font>
00132 <font class="comment"> */</font>
00133 <font class="keywordtype">bool</font>
<a name="l00134"></a><a class="code" href="classArenaBlock.html#a4">00134</a> <a class="code" href="classArenaBlock.html#a4">ownsObject</a>(<font class="keyword">const</font> <a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>* theObject)<font class="keyword"> const</font>
00135 <font class="keyword"> </font>{
00136 <font class="keywordflow">return</font> this-&gt;<a class="code" href="classArenaBlockBase.html#b2">isInBorders</a>(theObject, this-&gt;m_objectCount);
00137 }
00138
00139 <font class="keyword">private</font>:
00140
00141 <font class="comment">// Not implemented...</font>
00142 <a class="code" href="classArenaBlock.html#a0">ArenaBlock</a>(<font class="keyword">const</font> <a class="code" href="classArenaBlock.html">ArenaBlock&lt;ObjectType, SizeType&gt;</a>&amp;);
00143
00144 <a class="code" href="classArenaBlock.html">ArenaBlock&lt;ObjectType, SizeType&gt;</a>&amp;
00145 operator=(<font class="keyword">const</font> <a class="code" href="classArenaBlock.html">ArenaBlock&lt;ObjectType, SizeType&gt;</a>&amp;);
00146
00147 <font class="keywordtype">bool</font>
00148 <a class="code" href="ElemAttributeSet_8hpp.html#a1">operator==</a>(<font class="keyword">const</font> <a class="code" href="classArenaBlock.html">ArenaBlock&lt;ObjectType, SizeType&gt;</a>&amp;) <font class="keyword">const</font>;
00149 };
00150
00151
00152
00153 XALAN_CPP_NAMESPACE_END
00154
00155
00156
00157 <font class="preprocessor">#endif // !defined(ARENABLOCK_INCLUDE_GUARD_1357924680)</font>
</font></pre></div><p align="center"><a href="diagramnotes.html">Interpreting class diagrams</a></p>
<p><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">
<i><A href="http://www.stack.nl/~dimitri/doxygen/">Doxygen</A> and
<A href="http://www.research.att.com/sw/tools/graphviz/">GraphViz</A> are used to generate this API documentation from the Xalan-C header files.</I></FONT></p>
<TABLE border="0" cellpadding="0" cellspacing="0" width="820"><TR><TD bgcolor="#0086b2"><IMG height="1" src="../resources/dot.gif" width="1" alt="dot"></TD></TR></TABLE>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="80%">
<TR>
<TD WIDTH="80%" VALIGN="TOP">
<P ALIGN="CENTER"><B>Xalan-C++ XSLT Processor Version 1.10</B><BR>
Copyright &copy; 1999-2004 The Apache Software Foundation. All Rights Reserved.</i></p>
</TD>
</TR>
<TR>
<TD WIDTH="100%">
<P ALIGN="CENTER"><IMG SRC="ApacheLogo.jpg" WIDTH="387" HEIGHT="100" ALIGN="BOTTOM" BORDER="0" ALT="Apache Logo">
</TD>
</TR>
</TABLE>