| <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>XalanObjectStackCache.hpp</h1><a href="XalanObjectStackCache_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 <font class="preprocessor">#if !defined(XALAN_OBJECTSTACKCACHE_HEADER_GUARD)</font> |
| <a name="l00017"></a><a class="code" href="XalanObjectStackCache_8hpp.html#a0">00017</a> <font class="preprocessor"></font><font class="preprocessor">#define XALAN_OBJECTSTACKCACHE_HEADER_GUARD</font> |
| 00018 <font class="preprocessor"></font> |
| 00019 |
| 00020 |
| 00021 <font class="preprocessor">#include <algorithm></font> |
| 00022 |
| 00023 |
| 00024 |
| 00025 <font class="preprocessor">#include <<a class="code" href="XalanVector_8hpp.html">xalanc/Include/XalanVector.hpp</a>></font> |
| 00026 <font class="preprocessor">#include <<a class="code" href="STLHelper_8hpp.html">xalanc/Include/STLHelper.hpp</a>></font> |
| 00027 <font class="preprocessor">#include <<a class="code" href="XalanAutoPtr_8hpp.html">xalanc/Include/XalanAutoPtr.hpp</a>></font> |
| 00028 <font class="preprocessor">#include <<a class="code" href="XalanObjectCache_8hpp.html">xalanc/Include/XalanObjectCache.hpp</a>></font> |
| 00029 |
| 00030 |
| 00031 |
| 00032 XALAN_CPP_NAMESPACE_BEGIN |
| 00033 |
| 00034 |
| 00035 <font class="keyword">template</font>< |
| 00036 <font class="keyword">class </font><a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>, |
| 00037 <font class="preprocessor">#if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)</font> |
| 00038 <font class="preprocessor"></font><font class="keyword">class </font>CreateFunctorType, |
| 00039 <font class="keyword">class </font><a class="code" href="structDeleteFunctor.html">DeleteFunctorType</a>, |
| 00040 <font class="keyword">class </font>ResetFunctorType> |
| 00041 <font class="preprocessor">#else</font> |
| 00042 <font class="preprocessor"></font><font class="keyword">class </font>CreateFunctorType = <a class="code" href="classDefaultCacheCreateFunctor.html">DefaultCacheCreateFunctor</a><<a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>>, |
| 00043 class <a class="code" href="structDeleteFunctor.html">DeleteFunctorType</a> = <a class="code" href="structDeleteFunctor.html">DeleteFunctor</a><<a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>>, |
| 00044 class ResetFunctorType = <a class="code" href="classDefaultCacheResetFunctor.html">DefaultCacheResetFunctor</a><<a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>> > |
| 00045 #endif |
| <a name="l00046"></a><a class="code" href="classXalanObjectStackCache.html">00046</a> class <a class="code" href="classXalanObjectStackCache.html">XalanObjectStackCache</a> |
| 00047 { |
| 00048 <font class="keyword">public</font>: |
| 00049 |
| <a name="l00050"></a><a class="code" href="classXalanObjectStackCache.html#s0">00050</a> <font class="keyword">typedef</font> XalanVector<ObjectType*> VectorType; |
| 00051 |
| <a name="l00052"></a><a class="code" href="classXalanObjectStackCache.html#s1">00052</a> <font class="keyword">typedef</font> <a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a> <a class="code" href="classXalanSourceTreeAttr.html">CacheObjectType</a>; |
| 00053 |
| 00054 <font class="keyword">explicit</font> |
| <a name="l00055"></a><a class="code" href="classXalanObjectStackCache.html#a0">00055</a> <a class="code" href="classXalanObjectStackCache.html#a0">XalanObjectStackCache</a>(MemoryManagerType& theManager, |
| 00056 <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> initialListSize = 0) : |
| 00057 m_createFunctor(), |
| 00058 m_deleteFunctor(theManager), |
| 00059 m_stack(theManager), |
| 00060 m_numObjectsOnStack(0) |
| 00061 { |
| 00062 m_stack.reserve(initialListSize); |
| 00063 |
| 00064 } |
| 00065 |
| <a name="l00066"></a><a class="code" href="classXalanObjectStackCache.html#a1">00066</a> <a class="code" href="classXalanObjectStackCache.html#a1">~XalanObjectStackCache</a>()<font class="keyword"></font> |
| 00067 <font class="keyword"> </font>{ |
| 00068 <font class="preprocessor">#if !defined(XALAN_NO_STD_NAMESPACE)</font> |
| 00069 <font class="preprocessor"></font> <font class="keyword">using</font> std::for_each; |
| 00070 <font class="preprocessor">#endif</font> |
| 00071 <font class="preprocessor"></font> for_each( |
| 00072 m_stack.begin(), |
| 00073 m_stack.end(), |
| 00074 m_deleteFunctor); |
| 00075 } |
| 00076 |
| 00077 <a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>* |
| <a name="l00078"></a><a class="code" href="classXalanObjectStackCache.html#a2">00078</a> <a class="code" href="classXalanObjectStackCache.html#a2">get</a>()<font class="keyword"></font> |
| 00079 <font class="keyword"> </font>{ |
| 00080 |
| 00081 <font class="keywordflow">if</font> (m_stack.size() == m_numObjectsOnStack) |
| 00082 { |
| 00083 <a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>* <font class="keyword">const</font> theNewObject = <a class="code" href="classXalanObjectStackCache.html#m0">m_createFunctor</a>(m_stack.getMemoryManager()); |
| 00084 m_stack.push_back(theNewObject); |
| 00085 ++m_numObjectsOnStack; |
| 00086 <font class="keywordflow">return</font> theNewObject; |
| 00087 } |
| 00088 <font class="keywordflow">else</font> |
| 00089 { |
| 00090 <font class="keywordflow">return</font> m_stack[m_numObjectsOnStack++]; |
| 00091 } |
| 00092 } |
| 00093 |
| 00094 <a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>* |
| <a name="l00095"></a><a class="code" href="classXalanObjectStackCache.html#a3">00095</a> <a class="code" href="classXalanObjectStackCache.html#a3">top</a>()<font class="keyword"></font> |
| 00096 <font class="keyword"> </font>{ |
| 00097 assert (m_numObjectsOnStack > 0); |
| 00098 |
| 00099 <font class="keywordflow">return</font> m_stack[m_numObjectsOnStack-1]; |
| 00100 } |
| 00101 |
| 00102 <a class="code" href="classXalanSourceTreeAttr.html">ObjectType</a>* |
| <a name="l00103"></a><a class="code" href="classXalanObjectStackCache.html#a4">00103</a> <a class="code" href="classXalanObjectStackCache.html#a4">release</a>()<font class="keyword"></font> |
| 00104 <font class="keyword"> </font>{ |
| 00105 assert(m_numObjectsOnStack > 0); |
| 00106 |
| 00107 <font class="keywordflow">return</font> m_stack[--m_numObjectsOnStack]; |
| 00108 } |
| 00109 |
| 00110 <font class="keywordtype">void</font> |
| <a name="l00111"></a><a class="code" href="classXalanObjectStackCache.html#a5">00111</a> <a class="code" href="classXalanObjectStackCache.html#a5">reset</a>()<font class="keyword"></font> |
| 00112 <font class="keyword"> </font>{ |
| 00113 <font class="keyword">typename</font> VectorType::iterator iterator; |
| 00114 |
| 00115 <font class="keywordflow">for</font> (iterator = m_stack.begin(); iterator < m_stack.end(); iterator++) |
| 00116 { |
| 00117 <a class="code" href="classXalanObjectStackCache.html#m2">m_resetFunctor</a>(*iterator); |
| 00118 } |
| 00119 } |
| 00120 |
| 00121 <font class="comment">// Functors for various operations...</font> |
| <a name="l00122"></a><a class="code" href="classXalanObjectStackCache.html#m0">00122</a> CreateFunctorType m_createFunctor; |
| 00123 |
| <a name="l00124"></a><a class="code" href="classXalanObjectStackCache.html#m1">00124</a> <a class="code" href="structDeleteFunctor.html">DeleteFunctorType</a> m_deleteFunctor; |
| 00125 |
| <a name="l00126"></a><a class="code" href="classXalanObjectStackCache.html#m2">00126</a> ResetFunctorType m_resetFunctor; |
| 00127 |
| 00128 <font class="keyword">private</font>: |
| 00129 |
| 00130 <font class="comment">// There are not defined...</font> |
| 00131 <a class="code" href="classXalanObjectStackCache.html#a0">XalanObjectStackCache</a>(<font class="keyword">const</font> <a class="code" href="classXalanObjectCache.html">XalanObjectCache<ObjectType, CreateFunctorType, DeleteFunctorType, ResetFunctorType></a>& theRHS); |
| 00132 |
| 00133 <a class="code" href="classXalanObjectStackCache.html">XalanObjectStackCache<ObjectType, CreateFunctorType, DeleteFunctorType, ResetFunctorType></a>& |
| 00134 operator=(<font class="keyword">const</font> <a class="code" href="classXalanObjectCache.html">XalanObjectCache<ObjectType, CreateFunctorType, DeleteFunctorType, ResetFunctorType></a>& theRHS); |
| 00135 |
| 00136 |
| 00137 <font class="comment">// Data members...</font> |
| 00138 VectorType m_stack; |
| 00139 |
| 00140 <font class="keyword">typename</font> VectorType::size_type m_numObjectsOnStack; |
| 00141 |
| 00142 }; |
| 00143 |
| 00144 |
| 00145 |
| 00146 |
| 00147 template<class ObjectType> |
| <a name="l00148"></a><a class="code" href="classXalanObjectStackCacheDefault.html">00148</a> <font class="keyword">class </font><a class="code" href="classXalanObjectStackCacheDefault.html">XalanObjectStackCacheDefault</a> : <font class="keyword">public</font> <a class="code" href="classXalanObjectStackCache.html">XalanObjectStackCache</a><ObjectType, DefaultCacheCreateFunctor<ObjectType>, DeleteFunctor<ObjectType>, DefaultCacheResetFunctor<ObjectType> > |
| 00149 { |
| 00150 <font class="keyword">public</font>: |
| 00151 |
| <a name="l00152"></a><a class="code" href="classXalanObjectStackCacheDefault.html#s0">00152</a> <font class="keyword">typedef</font> <a class="code" href="classXalanObjectStackCache.html">XalanObjectStackCache<ObjectType, DefaultCacheCreateFunctor<ObjectType></a>, <a class="code" href="structDeleteFunctor.html">DeleteFunctor<ObjectType></a>, <a class="code" href="classDefaultCacheResetFunctor.html">DefaultCacheResetFunctor<ObjectType></a> > <a class="code" href="classstd_1_1unary__function.html">BaseClassType</a>; |
| 00153 |
| 00154 <font class="keyword">explicit</font> |
| <a name="l00155"></a><a class="code" href="classXalanObjectStackCacheDefault.html#a0">00155</a> <a class="code" href="classXalanObjectStackCacheDefault.html#a0">XalanObjectStackCacheDefault</a>(<font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> initialListSize = 0) : |
| 00156 <a class="code" href="classstd_1_1unary__function.html">BaseClassType</a>(initialListSize) |
| 00157 { |
| 00158 } |
| 00159 }; |
| 00160 |
| 00161 |
| 00162 |
| 00163 XALAN_CPP_NAMESPACE_END |
| 00164 |
| 00165 |
| 00166 |
| 00167 <font class="preprocessor">#endif</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>
|