| <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> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center> |
| <hr><h1>ArenaBlockBase.hpp</h1><a href="ArenaBlockBase_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(ARENABLOCKBASE_INCLUDE_GUARD_1357924680)</font> |
| <a name="l00018"></a><a class="code" href="ArenaBlockBase_8hpp.html#a0">00018</a> <font class="preprocessor"></font><font class="preprocessor">#define ARENABLOCKBASE_INCLUDE_GUARD_1357924680</font> |
| 00019 <font class="preprocessor"></font> |
| 00020 |
| 00021 <font class="preprocessor">#include <cassert></font> |
| 00022 <font class="preprocessor">#include <functional></font> |
| 00023 <font class="comment">//#include <memory></font> |
| 00024 |
| 00025 <font class="preprocessor">#include <<a class="code" href="XalanMemoryManagement_8hpp.html">xalanc/Include/XalanMemoryManagement.hpp</a>></font> |
| 00026 |
| 00027 |
| 00028 <font class="preprocessor">#if !defined(XALAN_NO_SELECTIVE_TEMPLATE_INSTANTIATION)</font> |
| 00029 <font class="preprocessor"></font><font class="preprocessor">#include <<a class="code" href="XalanAllocator_8hpp.html">xalanc/PlatformSupport/XalanAllocator.hpp</a>></font> |
| 00030 <font class="preprocessor">#endif</font> |
| 00031 <font class="preprocessor"></font> |
| 00032 |
| 00033 XALAN_CPP_NAMESPACE_BEGIN |
| 00034 |
| 00035 |
| 00036 <font class="preprocessor">#if defined(XALAN_NO_SELECTIVE_TEMPLATE_INSTANTIATION)</font> |
| 00037 <font class="preprocessor"></font> |
| 00038 template <class Type> |
| 00039 <font class="keyword">class </font>ArenaBlockAllocator |
| 00040 { |
| 00041 <font class="keyword">public</font>: |
| 00042 |
| 00043 <font class="keyword">typedef</font> <font class="keyword">typename</font> T size_type; |
| 00044 <font class="keyword">typedef</font> ptrdiff_t difference_type; |
| 00045 <font class="keyword">typedef</font> Type* pointer; |
| 00046 <font class="keyword">typedef</font> <font class="keyword">const</font> Type* const_pointer; |
| 00047 <font class="keyword">typedef</font> Type& reference; |
| 00048 <font class="keyword">typedef</font> <font class="keyword">const</font> Type& const_reference; |
| 00049 <font class="keyword">typedef</font> Type value_type; |
| 00050 |
| 00051 ArenaBlockAllocator(MemoryManagerType& theManager) : |
| 00052 m_memoryManager(theManager)<font class="keyword"></font> |
| 00053 <font class="keyword"> </font>{ |
| 00054 } |
| 00055 |
| 00056 ~ArenaBlockAllocator()<font class="keyword"></font> |
| 00057 <font class="keyword"> </font>{ |
| 00058 } |
| 00059 |
| 00060 MemoryManagerType& |
| 00061 getMemoryManager()<font class="keyword"></font> |
| 00062 <font class="keyword"> </font>{ |
| 00063 <font class="keywordflow">return</font> m_memoryManager; |
| 00064 } |
| 00065 |
| 00066 pointer |
| 00067 allocate( |
| 00068 size_type size, |
| 00069 <font class="keyword">const</font> <font class="keywordtype">void</font>* <font class="comment">/* hint */</font> = 0)<font class="keyword"></font> |
| 00070 <font class="keyword"> </font>{ |
| 00071 <font class="keywordflow">return</font> (pointer)m_memoryManager.allocate(size * <font class="keyword">sizeof</font>(Type)); |
| 00072 } |
| 00073 |
| 00074 <font class="keywordtype">void</font> |
| 00075 deallocate( |
| 00076 pointer p, |
| 00077 size_type <font class="comment">/* n */</font>)<font class="keyword"></font> |
| 00078 <font class="keyword"> </font>{ |
| 00079 <font class="keywordflow">if</font>(p != 0) |
| 00080 { |
| 00081 m_memoryManager.deallocate(p); |
| 00082 } |
| 00083 } |
| 00084 |
| 00085 <font class="keyword">private</font>: |
| 00086 |
| 00087 <font class="comment">// not defined</font> |
| 00088 ArenaBlockAllocator(<font class="keyword">const</font> ArenaBlockAllocator<Type>&); |
| 00089 |
| 00090 ArenaBlockAllocator<Type>& |
| 00091 operator=(<font class="keyword">const</font> ArenaBlockAllocator<Type>&); |
| 00092 |
| 00093 MemoryManagerType& m_memoryManager; |
| 00094 }; |
| 00095 <font class="preprocessor">#endif</font> |
| 00096 <font class="preprocessor"></font> |
| 00097 |
| 00098 |
| 00099 <font class="keyword">template</font><<font class="keyword">class </font><a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>, |
| 00100 <font class="preprocessor">#if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)</font> |
| 00101 <font class="preprocessor"></font> <font class="keyword">class </font>SizeType> |
| 00102 <font class="preprocessor">#else</font> |
| 00103 <font class="preprocessor"></font> <font class="keyword">class </font>SizeType = size_t> |
| 00104 #endif |
| <a name="l00105"></a><a class="code" href="classArenaBlockBase.html">00105</a> class <a class="code" href="classArenaBlockBase.html">ArenaBlockBase</a> |
| 00106 { |
| 00107 <font class="keyword">public</font>: |
| 00108 |
| <a name="l00109"></a><a class="code" href="classArenaBlockBase.html#s0">00109</a> <font class="keyword">typedef</font> <a class="code" href="classArenaBlockBase.html">ArenaBlockBase<ObjectType, SizeType></a> <a class="code" href="classXalanDeque.html">ThisType</a>; |
| 00110 |
| 00111 <font class="preprocessor">#if defined(XALAN_NO_SELECTIVE_TEMPLATE_INSTANTIATION)</font> |
| 00112 <font class="preprocessor"></font> <font class="keyword">typedef</font> ArenaBlockAllocator<ObjectType> <a class="code" href="classXalanAllocator.html">AllocatorType</a>; |
| 00113 <font class="preprocessor">#else</font> |
| <a name="l00114"></a><a class="code" href="classArenaBlockBase.html#s1">00114</a> <font class="preprocessor"></font> <font class="keyword">typedef</font> <a class="code" href="classXalanAllocator.html">XalanAllocator<ObjectType></a> <a class="code" href="classXalanAllocator.html">AllocatorType</a>; |
| 00115 <font class="preprocessor">#endif</font> |
| 00116 <font class="preprocessor"></font> |
| <a name="l00117"></a><a class="code" href="classArenaBlockBase.html#s2">00117</a> <font class="keyword">typedef</font> SizeType size_type; |
| 00118 |
| 00119 MemoryManagerType& |
| <a name="l00120"></a><a class="code" href="classArenaBlockBase.html#a0">00120</a> <a class="code" href="classArenaBlockBase.html#a0">getMemoryManager</a>()<font class="keyword"></font> |
| 00121 <font class="keyword"> </font>{ |
| 00122 <font class="keywordflow">return</font> m_allocator.<a class="code" href="classXalanAllocator.html#a2">getMemoryManager</a>(); |
| 00123 } |
| 00124 |
| 00125 <font class="comment">/*</font> |
| 00126 <font class="comment"> * Find out if there is a block available.</font> |
| 00127 <font class="comment"> *</font> |
| 00128 <font class="comment"> * @return true if one is available, false if not.</font> |
| 00129 <font class="comment"> */</font> |
| 00130 <font class="keywordtype">bool</font> |
| <a name="l00131"></a><a class="code" href="classArenaBlockBase.html#a1">00131</a> <a class="code" href="classArenaBlockBase.html#a1">blockAvailable</a>()<font class="keyword"> const</font> |
| 00132 <font class="keyword"> </font>{ |
| 00133 <font class="keywordflow">return</font> m_objectCount < m_blockSize ? <font class="keyword">true</font> : <font class="keyword">false</font>; |
| 00134 } |
| 00135 |
| 00136 <font class="comment">/*</font> |
| 00137 <font class="comment"> * Find out if there are any block is allocated</font> |
| 00138 <font class="comment"> *</font> |
| 00139 <font class="comment"> * @return true if one is available, false if not.</font> |
| 00140 <font class="comment"> */</font> |
| 00141 <font class="keywordtype">bool</font> |
| <a name="l00142"></a><a class="code" href="classArenaBlockBase.html#a2">00142</a> <a class="code" href="classArenaBlockBase.html#a2">isEmpty</a>()<font class="keyword"> const</font> |
| 00143 <font class="keyword"> </font>{ |
| 00144 <font class="keywordflow">return</font> m_objectCount == 0 ? <font class="keyword">true</font> : <font class="keyword">false</font>; |
| 00145 } |
| 00146 |
| 00147 <font class="comment">/*</font> |
| 00148 <font class="comment"> * Get the number of objects currently allocated in the</font> |
| 00149 <font class="comment"> * block.</font> |
| 00150 <font class="comment"> *</font> |
| 00151 <font class="comment"> * @return The number of objects allocated.</font> |
| 00152 <font class="comment"> */</font> |
| 00153 size_type |
| <a name="l00154"></a><a class="code" href="classArenaBlockBase.html#a3">00154</a> <a class="code" href="classArenaBlockBase.html#a3">getCountAllocated</a>()<font class="keyword"> const</font> |
| 00155 <font class="keyword"> </font>{ |
| 00156 <font class="keywordflow">return</font> m_objectCount; |
| 00157 } |
| 00158 |
| 00159 <font class="comment">/*</font> |
| 00160 <font class="comment"> * Get the block size, that is, the number</font> |
| 00161 <font class="comment"> * of objects in each block.</font> |
| 00162 <font class="comment"> *</font> |
| 00163 <font class="comment"> * @return The size of the block</font> |
| 00164 <font class="comment"> */</font> |
| 00165 size_type |
| <a name="l00166"></a><a class="code" href="classArenaBlockBase.html#a4">00166</a> <a class="code" href="classArenaBlockBase.html#a4">getBlockSize</a>()<font class="keyword"> const</font> |
| 00167 <font class="keyword"> </font>{ |
| 00168 <font class="keywordflow">return</font> m_blockSize; |
| 00169 } |
| 00170 |
| 00171 <font class="comment">/*</font> |
| 00172 <font class="comment"> * Determine if this block owns the specified object block.</font> |
| 00173 <font class="comment"> * Note that, unlike ownsObject(), there does not need to</font> |
| 00174 <font class="comment"> * be an object at the address.</font> |
| 00175 <font class="comment"> *</font> |
| 00176 <font class="comment"> * @param theObject the address of the object</font> |
| 00177 <font class="comment"> * @return true if we own the object block, false if not.</font> |
| 00178 <font class="comment"> */</font> |
| 00179 <font class="keywordtype">bool</font> |
| <a name="l00180"></a><a class="code" href="classArenaBlockBase.html#a5">00180</a> <a class="code" href="classArenaBlockBase.html#a5">ownsBlock</a>(<font class="keyword">const</font> <a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>* theObject)<font class="keyword"> const</font> |
| 00181 <font class="keyword"> </font>{ |
| 00182 <font class="keywordflow">return</font> <a class="code" href="classArenaBlockBase.html#b2">isInBorders</a>(theObject, m_blockSize); |
| 00183 } |
| 00184 |
| 00185 <font class="keyword">protected</font>: |
| 00186 |
| <a name="l00187"></a><a class="code" href="classArenaBlockBase.html#b0">00187</a> <a class="code" href="classArenaBlockBase.html#b0">ArenaBlockBase</a>( |
| 00188 MemoryManagerType& theManager, |
| 00189 size_type theBlockSize) : |
| 00190 m_allocator(theManager), |
| 00191 m_objectCount(0), |
| 00192 m_blockSize(theBlockSize), |
| 00193 #if defined(XALAN_NEW_STD_ALLOCATOR) |
| 00194 m_objectBlock(m_allocator.allocate(m_blockSize)) |
| 00195 #else |
| 00196 m_objectBlock(m_allocator.allocate(m_blockSize, 0)) |
| 00197 #endif |
| 00198 { |
| 00199 assert(theBlockSize > 0); |
| 00200 |
| 00201 assert(m_objectBlock != 0); |
| 00202 } |
| 00203 |
| <a name="l00204"></a><a class="code" href="classArenaBlockBase.html#b1">00204</a> <a class="code" href="classArenaBlockBase.html#b1">~ArenaBlockBase</a>()<font class="keyword"></font> |
| 00205 <font class="keyword"> </font>{ |
| 00206 <font class="comment">// Release the memory...</font> |
| 00207 m_allocator.<a class="code" href="classXalanAllocator.html#a6">deallocate</a>(m_objectBlock, m_blockSize); |
| 00208 |
| 00209 } |
| 00210 |
| 00211 <font class="comment">/*</font> |
| 00212 <font class="comment"> * Determine if this block is located between beginning of the array</font> |
| 00213 <font class="comment"> * and the "rightBorder" array member (not included)</font> |
| 00214 <font class="comment"> * @param theObject the address of the object</font> |
| 00215 <font class="comment"> * rightBorder the right </font> |
| 00216 <font class="comment"> * @return true if we own the object block, false if not.</font> |
| 00217 <font class="comment"> */</font> |
| 00218 <font class="keywordtype">bool</font> |
| <a name="l00219"></a><a class="code" href="classArenaBlockBase.html#b2">00219</a> <a class="code" href="classArenaBlockBase.html#b2">isInBorders</a>( |
| 00220 <font class="keyword">const</font> <a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>* theObject, |
| 00221 size_type rightBoundary)<font class="keyword"> const</font> |
| 00222 <font class="keyword"> </font>{ |
| 00223 <font class="keywordflow">if</font> ( rightBoundary > m_blockSize ) |
| 00224 { |
| 00225 rightBoundary = m_blockSize; |
| 00226 } |
| 00227 |
| 00228 <font class="comment">// Use less<>, since it's guaranteed to do pointer</font> |
| 00229 <font class="comment">// comparisons correctly...</font> |
| 00230 XALAN_STD_QUALIFIER less<const ObjectType*> functor; |
| 00231 |
| 00232 <font class="keywordflow">if</font> (functor(theObject, m_objectBlock) == <font class="keyword">false</font> && |
| 00233 functor(theObject, m_objectBlock + rightBoundary) == <font class="keyword">true</font>) |
| 00234 { |
| 00235 <font class="keywordflow">return</font> <font class="keyword">true</font>; |
| 00236 } |
| 00237 <font class="keywordflow">else</font> |
| 00238 { |
| 00239 <font class="keywordflow">return</font> <font class="keyword">false</font>; |
| 00240 } |
| 00241 } |
| 00242 |
| 00243 <font class="comment">/*</font> |
| 00244 <font class="comment"> * Determine the offset into the block for the given address.</font> |
| 00245 <font class="comment"> * Behavior is undefined if the address is not within our</font> |
| 00246 <font class="comment"> * block</font> |
| 00247 <font class="comment"> *</font> |
| 00248 <font class="comment"> * @param theObject the address of the object</font> |
| 00249 <font class="comment"> * @return the offset</font> |
| 00250 <font class="comment"> */</font> |
| 00251 size_type |
| <a name="l00252"></a><a class="code" href="classArenaBlockBase.html#b3">00252</a> <a class="code" href="classArenaBlockBase.html#b3">getBlockOffset</a>(<font class="keyword">const</font> <a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>* theObject)<font class="keyword"> const</font> |
| 00253 <font class="keyword"> </font>{ |
| 00254 assert(<a class="code" href="classArenaBlockBase.html#s2">size_type</a>( (theObject - m_objectBlock) / <font class="keyword">sizeof</font>(<a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>) ) < m_blockSize); |
| 00255 |
| 00256 <font class="keywordflow">return</font> theObject - m_objectBlock; |
| 00257 } |
| 00258 |
| 00259 <font class="comment">/*</font> |
| 00260 <font class="comment"> * Determine the address within our block of the object</font> |
| 00261 <font class="comment"> * at the specified offset.</font> |
| 00262 <font class="comment"> * Behavior is undefined if the offset is greater than the</font> |
| 00263 <font class="comment"> * block size.</font> |
| 00264 <font class="comment"> *</font> |
| 00265 <font class="comment"> * @param theObject the address of the object</font> |
| 00266 <font class="comment"> * @return the offset</font> |
| 00267 <font class="comment"> */</font> |
| 00268 <a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>* |
| <a name="l00269"></a><a class="code" href="classArenaBlockBase.html#b4">00269</a> <a class="code" href="classArenaBlockBase.html#b4">getBlockAddress</a>(size_type theOffset)<font class="keyword"> const</font> |
| 00270 <font class="keyword"> </font>{ |
| 00271 assert(theOffset < m_blockSize); |
| 00272 |
| 00273 <font class="keywordflow">return</font> m_objectBlock + theOffset; |
| 00274 } |
| 00275 |
| 00276 <font class="comment">// data members...</font> |
| <a name="l00277"></a><a class="code" href="classArenaBlockBase.html#n0">00277</a> <a class="code" href="classXalanAllocator.html">AllocatorType</a> m_allocator; |
| 00278 |
| <a name="l00279"></a><a class="code" href="classArenaBlockBase.html#n1">00279</a> size_type m_objectCount; |
| 00280 |
| <a name="l00281"></a><a class="code" href="classArenaBlockBase.html#n2">00281</a> <font class="keyword">const</font> size_type m_blockSize; |
| 00282 |
| <a name="l00283"></a><a class="code" href="classArenaBlockBase.html#n3">00283</a> <a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>* m_objectBlock; |
| 00284 |
| 00285 <font class="keyword">private</font>: |
| 00286 |
| 00287 <font class="comment">// Not implemented...</font> |
| 00288 <a class="code" href="classArenaBlockBase.html#b0">ArenaBlockBase</a>(<font class="keyword">const</font> <a class="code" href="classXalanDeque.html">ThisType</a>&); |
| 00289 |
| 00290 <a class="code" href="classXalanDeque.html">ThisType</a>& |
| 00291 operator=(<font class="keyword">const</font> <a class="code" href="classXalanDeque.html">ThisType</a>&); |
| 00292 |
| 00293 <font class="keywordtype">bool</font> |
| 00294 <a class="code" href="ElemAttributeSet_8hpp.html#a1">operator==</a>(<font class="keyword">const</font> <a class="code" href="classXalanDeque.html">ThisType</a>&) <font class="keyword">const</font>; |
| 00295 }; |
| 00296 |
| 00297 XALAN_CPP_NAMESPACE_END |
| 00298 |
| 00299 |
| 00300 |
| 00301 <font class="preprocessor">#endif // !defined(ARENABLOCKBASE_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 © 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>
|