blob: b0a48fa2592ad9f90c89d3addca69e6d54d17898 [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>XalanAllocator.hpp</h1><a href="XalanAllocator_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(XALANALLOCATOR_INCLUDE_GUARD_1357924680)</font>
<a name="l00018"></a><a class="code" href="XalanAllocator_8hpp.html#a0">00018</a> <font class="preprocessor"></font><font class="preprocessor">#define XALANALLOCATOR_INCLUDE_GUARD_1357924680</font>
00019 <font class="preprocessor"></font>
00020
00021
00022 <font class="preprocessor">#include &lt;cstddef&gt;</font>
00023
00024
00025
00026 XALAN_CPP_NAMESPACE_BEGIN
00027
00028
00029
00030 template &lt;class Type&gt;
<a name="l00031"></a><a class="code" href="classXalanAllocator.html">00031</a> <font class="keyword">class </font><a class="code" href="classXalanAllocator.html">XalanAllocator</a>
00032 {
00033 <font class="keyword">public</font>:
<a name="l00034"></a><a class="code" href="classXalanAllocator.html#s0">00034</a> <font class="keyword">typedef</font> size_t size_type;
<a name="l00035"></a><a class="code" href="classXalanAllocator.html#s1">00035</a> <font class="keyword">typedef</font> ptrdiff_t difference_type;
<a name="l00036"></a><a class="code" href="classXalanAllocator.html#s2">00036</a> <font class="keyword">typedef</font> Type* pointer;
<a name="l00037"></a><a class="code" href="classXalanAllocator.html#s3">00037</a> <font class="keyword">typedef</font> <font class="keyword">const</font> Type* const_pointer;
<a name="l00038"></a><a class="code" href="classXalanAllocator.html#s4">00038</a> <font class="keyword">typedef</font> Type&amp; reference;
<a name="l00039"></a><a class="code" href="classXalanAllocator.html#s5">00039</a> <font class="keyword">typedef</font> <font class="keyword">const</font> Type&amp; const_reference;
<a name="l00040"></a><a class="code" href="classXalanAllocator.html#s6">00040</a> <font class="keyword">typedef</font> Type value_type;
00041
00042
<a name="l00043"></a><a class="code" href="classXalanAllocator.html#a0">00043</a> <a class="code" href="classXalanAllocator.html#a0">XalanAllocator</a>(MemoryManagerType&amp; theManager) :
00044 m_memoryManager(theManager)
00045 {
00046 }
00047
00048
<a name="l00049"></a><a class="code" href="classXalanAllocator.html#a1">00049</a> <a class="code" href="classXalanAllocator.html#a1">~XalanAllocator</a>()<font class="keyword"></font>
00050 <font class="keyword"> </font>{
00051 }
00052
00053 MemoryManagerType&amp;
<a name="l00054"></a><a class="code" href="classXalanAllocator.html#a2">00054</a> <a class="code" href="classXalanAllocator.html#a2">getMemoryManager</a>()<font class="keyword"></font>
00055 <font class="keyword"> </font>{
00056 <font class="keywordflow">return</font> m_memoryManager;
00057 }
00058
00059 pointer
<a name="l00060"></a><a class="code" href="classXalanAllocator.html#a3">00060</a> <a class="code" href="classXalanAllocator.html#a3">address</a>(reference x)<font class="keyword"> const</font>
00061 <font class="keyword"> </font>{
00062 <font class="keywordflow">return</font> &amp;x;
00063 }
00064
00065 const_pointer
<a name="l00066"></a><a class="code" href="classXalanAllocator.html#a4">00066</a> <a class="code" href="classXalanAllocator.html#a3">address</a>(const_reference x)<font class="keyword"> const</font>
00067 <font class="keyword"> </font>{
00068 <font class="keywordflow">return</font> &amp;x;
00069 }
00070
00071 pointer
<a name="l00072"></a><a class="code" href="classXalanAllocator.html#a5">00072</a> <a class="code" href="classXalanAllocator.html#a5">allocate</a>(
00073 size_type size,
00074 <font class="keyword">const</font> <font class="keywordtype">void</font>* <font class="comment">/* hint */</font> = 0)<font class="keyword"></font>
00075 <font class="keyword"> </font>{
00076 <font class="keywordflow">return</font> (pointer)m_memoryManager.allocate(size * <font class="keyword">sizeof</font>(Type));
00077 }
00078
00079 <font class="keywordtype">void</font>
<a name="l00080"></a><a class="code" href="classXalanAllocator.html#a6">00080</a> <a class="code" href="classXalanAllocator.html#a6">deallocate</a>(
00081 pointer p,
00082 size_type <font class="comment">/* n */</font>)<font class="keyword"></font>
00083 <font class="keyword"> </font>{
00084 <font class="keywordflow">if</font>( p == 0 )
00085 {
00086 <font class="keywordflow">return</font>;
00087 }
00088
00089 m_memoryManager.deallocate(p);
00090 }
00091
00092 size_type
<a name="l00093"></a><a class="code" href="classXalanAllocator.html#a7">00093</a> <a class="code" href="classXalanAllocator.html#a7">max_size</a>()<font class="keyword"> const</font>
00094 <font class="keyword"> </font>{
00095 <font class="keywordflow">return</font> ~0;
00096 }
00097
00098 <font class="keywordtype">void</font>
<a name="l00099"></a><a class="code" href="classXalanAllocator.html#a8">00099</a> <a class="code" href="classXalanAllocator.html#a8">construct</a>(
00100 pointer p,
00101 <font class="keyword">const</font> Type&amp; val)<font class="keyword"></font>
00102 <font class="keyword"> </font>{
00103 <font class="keyword">new</font> (p) Type(val);
00104 }
00105
00106 <font class="keywordtype">void</font>
<a name="l00107"></a><a class="code" href="classXalanAllocator.html#a9">00107</a> <a class="code" href="classXalanAllocator.html#a9">destroy</a>(pointer p)<font class="keyword"></font>
00108 <font class="keyword"> </font>{
00109 p-&gt;Type::~Type();
00110 }
00111
00112 <font class="keyword">private</font>:
00113 <a class="code" href="classXalanAllocator.html#a0">XalanAllocator</a>(<font class="keyword">const</font> <a class="code" href="classXalanAllocator.html">XalanAllocator&lt;Type&gt;</a>&amp;);
00114
00115 <a class="code" href="classXalanAllocator.html">XalanAllocator&lt;Type&gt;</a>&amp;
00116 operator=(<font class="keyword">const</font> <a class="code" href="classXalanAllocator.html">XalanAllocator&lt;Type&gt;</a>&amp;);
00117
00118 MemoryManagerType&amp; m_memoryManager;
00119 };
00120
00121
00122
00123 XALAN_CPP_NAMESPACE_END
00124
00125
00126
00127 <font class="preprocessor">#endif // XALANALLOCATOR_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>