XQuilla/docs/simple-api/XPath2MemoryManager_8hpp-source.html
2020-02-17 22:12:51 +01:00

417 lines
40 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>XQilla Simple API Documentation</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<a style="float:right;" href="http://sourceforge.net/projects/xqilla"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=152021&amp;type=2" border="0" alt="SourceForge.net Logo" /></a>
<!-- Generated by Doxygen 1.5.1 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="classes.html"><span>Classes</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
</ul></div>
<h1>XPath2MemoryManager.hpp</h1><a href="XPath2MemoryManager_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright (c) 2001-2007</span>
<a name="l00003"></a>00003 <span class="comment"> * DecisionSoft Limited. All rights reserved.</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (c) 2004-2007</span>
<a name="l00005"></a>00005 <span class="comment"> * Oracle. All rights reserved.</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="l00008"></a>00008 <span class="comment"> * you may not use this file except in compliance with the License.</span>
<a name="l00009"></a>00009 <span class="comment"> * You may obtain a copy of the License at</span>
<a name="l00010"></a>00010 <span class="comment"> *</span>
<a name="l00011"></a>00011 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
<a name="l00014"></a>00014 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="l00015"></a>00015 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="l00016"></a>00016 <span class="comment"> * See the License for the specific language governing permissions and</span>
<a name="l00017"></a>00017 <span class="comment"> * limitations under the License.</span>
<a name="l00018"></a>00018 <span class="comment"> *</span>
<a name="l00019"></a>00019 <span class="comment"> * $Id: XPath2MemoryManager.hpp,v 1.20 2007/11/28 13:13:22 jpcs Exp $</span>
<a name="l00020"></a>00020 <span class="comment"> */</span>
<a name="l00021"></a>00021
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef __XPATH2MEMORYMANAGER_HPP</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define __XPATH2MEMORYMANAGER_HPP</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;algorithm&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;assert.h&gt;</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;xqilla/framework/XQillaExport.hpp&gt;</span>
<a name="l00029"></a>00029
<a name="l00030"></a>00030 <span class="preprocessor">#include &lt;<a class="code" href="MemoryManager_8hpp.html">xercesc/framework/MemoryManager.hpp</a>&gt;</span>
<a name="l00031"></a>00031
<a name="l00032"></a>00032 XERCES_CPP_NAMESPACE_BEGIN
<a name="l00033"></a>00033 <span class="keyword">class </span>DOMNode;
<a name="l00034"></a>00034 <span class="keyword">class </span>XMLGrammarPool;
<a name="l00035"></a>00035 XERCES_CPP_NAMESPACE_END
<a name="l00036"></a>00036
<a name="l00037"></a>00037 <span class="keyword">class </span><a class="code" href="classVariableStore.html">VariableStore</a>;
<a name="l00038"></a>00038 <span class="keyword">class </span><a class="code" href="classVariableTypeStore.html">VariableTypeStore</a>;
<a name="l00039"></a>00039 <span class="keyword">class </span><a class="code" href="classDynamicContext.html">DynamicContext</a>;
<a name="l00040"></a>00040 <span class="keyword">class </span><a class="code" href="classCollation.html">Collation</a>;
<a name="l00041"></a>00041 <span class="keyword">class </span>CollationHelper;
<a name="l00042"></a>00042 <span class="keyword">class </span>XQillaNSResolver;
<a name="l00043"></a>00043 <span class="keyword">class </span><a class="code" href="classATDecimalOrDerived.html">ATDecimalOrDerived</a>;
<a name="l00044"></a>00044 <span class="keyword">class </span><a class="code" href="classStringPool.html">StringPool</a>;
<a name="l00045"></a>00045
<a name="l00046"></a><a class="code" href="classXPath2MemoryManager.html">00046</a> <span class="keyword">class </span>XQILLA_API <a class="code" href="classXPath2MemoryManager.html">XPath2MemoryManager</a> : <span class="keyword">public</span> XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager
<a name="l00047"></a>00047 {
<a name="l00048"></a>00048 <span class="keyword">public</span>:
<a name="l00049"></a><a class="code" href="classXPath2MemoryManager.html#2a42454955f541092df5332858ff284c">00049</a> <span class="keyword">virtual</span> ~<a class="code" href="classXPath2MemoryManager.html">XPath2MemoryManager</a>() {}
<a name="l00050"></a>00050
<a name="l00052"></a>00052 <span class="keyword">virtual</span> <span class="keywordtype">void</span> reset() = 0;
<a name="l00053"></a>00053
<a name="l00055"></a>00055 <span class="keyword">virtual</span> <span class="keyword">const</span> XMLCh* getPooledString(<span class="keyword">const</span> XMLCh *src) = 0;
<a name="l00056"></a>00056 <span class="keyword">virtual</span> <span class="keyword">const</span> XMLCh* getPooledString(<span class="keyword">const</span> XMLCh *src, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> length) = 0;
<a name="l00057"></a>00057 <span class="keyword">virtual</span> <span class="keyword">const</span> XMLCh* getPooledString(<span class="keyword">const</span> <span class="keywordtype">char</span> *src) = 0;
<a name="l00058"></a>00058
<a name="l00059"></a>00059 <span class="comment">// from MemoryManager</span>
<a name="l00060"></a>00060 <span class="keyword">virtual</span> <span class="keywordtype">void</span>* allocate(size_t numElements) = 0;
<a name="l00061"></a>00061 <span class="keyword">virtual</span> <span class="keywordtype">void</span> deallocate(<span class="keywordtype">void</span>* p) = 0;
<a name="l00062"></a>00062
<a name="l00064"></a>00064 <span class="keyword">virtual</span> <a class="code" href="classCollation.html">Collation</a>* createCollation(CollationHelper* helper) = 0;
<a name="l00065"></a>00065
<a name="l00067"></a>00067 <span class="keyword">virtual</span> XQillaNSResolver* createNSResolver(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *resolverNode) = 0;
<a name="l00068"></a>00068
<a name="l00070"></a>00070 <span class="keyword">virtual</span> <a class="code" href="classVariableTypeStore.html">VariableTypeStore</a>* createVariableTypeStore() = 0;
<a name="l00071"></a>00071
<a name="l00073"></a>00073 <span class="keyword">virtual</span> <a class="code" href="classATDecimalOrDerived.html">ATDecimalOrDerived</a>* createInteger(<span class="keywordtype">int</span> value) = 0;
<a name="l00074"></a>00074
<a name="l00075"></a>00075 <span class="keyword">virtual</span> <span class="keywordtype">void</span> dumpStatistics() <span class="keyword">const </span>= 0;
<a name="l00076"></a>00076 <span class="keyword">virtual</span> size_t getAllocatedObjectCount() <span class="keyword">const </span>= 0;
<a name="l00077"></a>00077 <span class="keyword">virtual</span> size_t getTotalAllocatedMemory() <span class="keyword">const </span>= 0;
<a name="l00078"></a>00078 <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classStringPool.html">StringPool</a> *getStringPool() <span class="keyword">const </span>= 0;
<a name="l00079"></a>00079 };<span class="comment">//XPath2MemoryManager</span>
<a name="l00080"></a>00080
<a name="l00081"></a>00081 <span class="keyword">template</span> &lt;<span class="keyword">class</span> _Tp&gt;
<a name="l00082"></a><a class="code" href="classXQillaAllocator.html">00082</a> <span class="keyword">class </span><a class="code" href="classXQillaAllocator.html">XQillaAllocator</a>
<a name="l00083"></a>00083 {
<a name="l00084"></a>00084 <span class="keyword">public</span>:
<a name="l00085"></a><a class="code" href="classXQillaAllocator.html#276f8d8b17823fd320eb80e37a09c4dd">00085</a> <span class="keyword">typedef</span> size_t <a class="code" href="classXQillaAllocator.html#276f8d8b17823fd320eb80e37a09c4dd">size_type</a>;
<a name="l00086"></a><a class="code" href="classXQillaAllocator.html#89df7c8392d644bcde141dcd602110f4">00086</a> <span class="keyword">typedef</span> ptrdiff_t <a class="code" href="classXQillaAllocator.html#89df7c8392d644bcde141dcd602110f4">difference_type</a>;
<a name="l00087"></a><a class="code" href="classXQillaAllocator.html#81d4c25067e642232a9f16e8996a0cd2">00087</a> <span class="keyword">typedef</span> _Tp* <a class="code" href="classXQillaAllocator.html#81d4c25067e642232a9f16e8996a0cd2">pointer</a>;
<a name="l00088"></a><a class="code" href="classXQillaAllocator.html#cec548af851f23a1984b99cf37614235">00088</a> <span class="keyword">typedef</span> <span class="keyword">const</span> _Tp* <a class="code" href="classXQillaAllocator.html#cec548af851f23a1984b99cf37614235">const_pointer</a>;
<a name="l00089"></a><a class="code" href="classXQillaAllocator.html#4d10ef0e016a60698016ed4bd730817e">00089</a> <span class="keyword">typedef</span> _Tp&amp; <a class="code" href="classXQillaAllocator.html#4d10ef0e016a60698016ed4bd730817e">reference</a>;
<a name="l00090"></a><a class="code" href="classXQillaAllocator.html#d77181acbd0fe45a361f5a7ef75cee7d">00090</a> <span class="keyword">typedef</span> <span class="keyword">const</span> _Tp&amp; <a class="code" href="classXQillaAllocator.html#d77181acbd0fe45a361f5a7ef75cee7d">const_reference</a>;
<a name="l00091"></a><a class="code" href="classXQillaAllocator.html#c1fe0b1a3f5533725c65e9a22fbe1330">00091</a> <span class="keyword">typedef</span> _Tp <a class="code" href="classXQillaAllocator.html#c1fe0b1a3f5533725c65e9a22fbe1330">value_type</a>;
<a name="l00092"></a>00092
<a name="l00093"></a><a class="code" href="structXQillaAllocator_1_1rebind.html">00093</a> <span class="keyword">template</span> &lt;<span class="keyword">class</span> _Tp1&gt; <span class="keyword">struct </span><a class="code" href="structXQillaAllocator_1_1rebind.html">rebind</a> {
<a name="l00094"></a><a class="code" href="structXQillaAllocator_1_1rebind.html#5dc95c37a843ba22e4b0c913984e295b">00094</a> <span class="keyword">typedef</span> <a class="code" href="classXQillaAllocator.html">XQillaAllocator&lt;_Tp1&gt;</a> <a class="code" href="classXQillaAllocator.html">other</a>;
<a name="l00095"></a>00095 };
<a name="l00096"></a>00096
<a name="l00097"></a>00097 <span class="comment">// Should never be used - for compiling on AIX only</span>
<a name="l00098"></a><a class="code" href="classXQillaAllocator.html#f520219abb4c15f9310a39932cfeedae">00098</a> <a class="code" href="classXQillaAllocator.html#f520219abb4c15f9310a39932cfeedae">XQillaAllocator</a>()
<a name="l00099"></a>00099 {
<a name="l00100"></a>00100 assert(<span class="keyword">false</span>);
<a name="l00101"></a>00101 }
<a name="l00102"></a>00102
<a name="l00103"></a><a class="code" href="classXQillaAllocator.html#76a14cd5932cbf00888a2d8ac3453c5d">00103</a> <a class="code" href="classXQillaAllocator.html#f520219abb4c15f9310a39932cfeedae">XQillaAllocator</a>(XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* memMgr)
<a name="l00104"></a>00104 {
<a name="l00105"></a>00105 <a class="code" href="classXQillaAllocator.html#d3f8310a45fd563d33a55e9542100fa9">_memMgr</a>=memMgr;
<a name="l00106"></a>00106 }
<a name="l00107"></a>00107
<a name="l00108"></a>00108 <span class="comment">// define a copy constructor, because we don't want to copy the singleton object</span>
<a name="l00109"></a><a class="code" href="classXQillaAllocator.html#8c8b5274bae995052ab04cf48f6340f8">00109</a> <a class="code" href="classXQillaAllocator.html#f520219abb4c15f9310a39932cfeedae">XQillaAllocator</a>(<span class="keyword">const</span> <a class="code" href="classXQillaAllocator.html">XQillaAllocator&lt;_Tp&gt;</a>&amp; o)
<a name="l00110"></a>00110 {
<a name="l00111"></a>00111 <a class="code" href="classXQillaAllocator.html#d3f8310a45fd563d33a55e9542100fa9">_memMgr</a>=o.<a class="code" href="classXQillaAllocator.html#d3f8310a45fd563d33a55e9542100fa9">_memMgr</a>;
<a name="l00112"></a>00112 }
<a name="l00113"></a>00113
<a name="l00114"></a><a class="code" href="classXQillaAllocator.html#f70c2dfdd0ad6102bd10dbdc34e302aa">00114</a> <a class="code" href="classXQillaAllocator.html#81d4c25067e642232a9f16e8996a0cd2">pointer</a> <a class="code" href="classXQillaAllocator.html#f70c2dfdd0ad6102bd10dbdc34e302aa">allocate</a>(size_t _n, <span class="keyword">const</span> <span class="keywordtype">void</span>* = 0)
<a name="l00115"></a>00115 {
<a name="l00116"></a>00116 <span class="keywordflow">if</span>(_n==1)
<a name="l00117"></a>00117 <span class="keywordflow">return</span> (<a class="code" href="classXQillaAllocator.html#81d4c25067e642232a9f16e8996a0cd2">pointer</a>)<a class="code" href="classXQillaAllocator.html#e64ca33304db228d5eae2397710ef4d0">_singleton</a>;
<a name="l00118"></a>00118 <span class="comment">//std::cout &lt;&lt; "XQillaAllocator::allocate(" &lt;&lt; _n &lt;&lt; ")" &lt;&lt; std::endl;</span>
<a name="l00119"></a>00119 <span class="keywordflow">if</span>(<a class="code" href="classXQillaAllocator.html#d3f8310a45fd563d33a55e9542100fa9">_memMgr</a>)
<a name="l00120"></a>00120 <span class="keywordflow">return</span> _n != 0 ? static_cast&lt;pointer&gt;(<a class="code" href="classXQillaAllocator.html#d3f8310a45fd563d33a55e9542100fa9">_memMgr</a>-&gt;<a class="code" href="classxercesc_1_1MemoryManager.html#f2c4b513a75ee22fbaa4bdc7a5bfdc81">allocate</a>(_n*<span class="keyword">sizeof</span>(_Tp))) : 0;
<a name="l00121"></a>00121 <span class="keywordflow">else</span>
<a name="l00122"></a>00122 <span class="keywordflow">return</span> _n != 0 ? static_cast&lt;pointer&gt;(malloc(_n*<span class="keyword">sizeof</span>(_Tp))) : 0;
<a name="l00123"></a>00123 }
<a name="l00124"></a>00124
<a name="l00125"></a><a class="code" href="classXQillaAllocator.html#7dd8460bfe7d0cb32ddaeae25285cc6e">00125</a> <span class="keywordtype">void</span> <a class="code" href="classXQillaAllocator.html#7dd8460bfe7d0cb32ddaeae25285cc6e">deallocate</a>(<span class="keywordtype">void</span>* _p, size_t _n)
<a name="l00126"></a>00126 {
<a name="l00127"></a>00127 <span class="comment">//std::cout &lt;&lt; "XQillaAllocator::deallocate(" &lt;&lt; _n &lt;&lt; ")" &lt;&lt; std::endl;</span>
<a name="l00128"></a>00128 <span class="keywordflow">if</span>(_p) {
<a name="l00129"></a>00129 <span class="keywordflow">if</span>(_p!=<a class="code" href="classXQillaAllocator.html#e64ca33304db228d5eae2397710ef4d0">_singleton</a>) {
<a name="l00130"></a>00130 <span class="keywordflow">if</span>(<a class="code" href="classXQillaAllocator.html#d3f8310a45fd563d33a55e9542100fa9">_memMgr</a>)
<a name="l00131"></a>00131 _memMgr-&gt;deallocate(_p);
<a name="l00132"></a>00132 <span class="keywordflow">else</span>
<a name="l00133"></a>00133 free(_p);
<a name="l00134"></a>00134 }
<a name="l00135"></a>00135 }
<a name="l00136"></a>00136 }
<a name="l00137"></a>00137
<a name="l00138"></a><a class="code" href="classXQillaAllocator.html#42ebac999fcbd730f22c9135934b2b58">00138</a> <span class="keywordtype">void</span> <a class="code" href="classXQillaAllocator.html#42ebac999fcbd730f22c9135934b2b58">construct</a>(<a class="code" href="classXQillaAllocator.html#81d4c25067e642232a9f16e8996a0cd2">pointer</a> _p, <a class="code" href="classXQillaAllocator.html#d77181acbd0fe45a361f5a7ef75cee7d">const_reference</a> _v)
<a name="l00139"></a>00139 {
<a name="l00140"></a>00140 <span class="keyword">new</span> ((<span class="keywordtype">void</span> *)_p) _Tp(_v);
<a name="l00141"></a>00141 }
<a name="l00142"></a>00142
<a name="l00143"></a><a class="code" href="classXQillaAllocator.html#3a2d8454aacf52e2300d64dc24217149">00143</a> <span class="keywordtype">void</span> <a class="code" href="classXQillaAllocator.html#3a2d8454aacf52e2300d64dc24217149">destroy</a>(<a class="code" href="classXQillaAllocator.html#81d4c25067e642232a9f16e8996a0cd2">pointer</a> _p)
<a name="l00144"></a>00144 {
<a name="l00145"></a>00145 _p-&gt;~_Tp();
<a name="l00146"></a>00146 }
<a name="l00147"></a>00147
<a name="l00148"></a><a class="code" href="classXQillaAllocator.html#6f897adaf0449242275b5c2757055ee0">00148</a> <a class="code" href="classXQillaAllocator.html#276f8d8b17823fd320eb80e37a09c4dd">size_type</a> <a class="code" href="classXQillaAllocator.html#6f897adaf0449242275b5c2757055ee0">max_size</a>()<span class="keyword"> const</span>
<a name="l00149"></a>00149 <span class="keyword"> </span>{
<a name="l00150"></a>00150 <span class="keywordflow">return</span> 0xFFFFFFFF;
<a name="l00151"></a>00151 }
<a name="l00152"></a>00152
<a name="l00153"></a><a class="code" href="classXQillaAllocator.html#ada0faea6e11eb70d2d35664d5b9b5fc">00153</a> <a class="code" href="classXQillaAllocator.html#276f8d8b17823fd320eb80e37a09c4dd">size_type</a> <a class="code" href="classXQillaAllocator.html#6f897adaf0449242275b5c2757055ee0">max_size</a>(<a class="code" href="classXQillaAllocator.html#276f8d8b17823fd320eb80e37a09c4dd">size_type</a>)<span class="keyword"> const</span>
<a name="l00154"></a>00154 <span class="keyword"> </span>{
<a name="l00155"></a>00155 <span class="keywordflow">return</span> 0xFFFFFFFF;
<a name="l00156"></a>00156 }
<a name="l00157"></a>00157
<a name="l00158"></a>00158 <span class="keyword">protected</span>:
<a name="l00159"></a><a class="code" href="classXQillaAllocator.html#e64ca33304db228d5eae2397710ef4d0">00159</a> <span class="keywordtype">char</span> <a class="code" href="classXQillaAllocator.html#e64ca33304db228d5eae2397710ef4d0">_singleton</a>[<span class="keyword">sizeof</span>(_Tp)];
<a name="l00160"></a><a class="code" href="classXQillaAllocator.html#d3f8310a45fd563d33a55e9542100fa9">00160</a> XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* <a class="code" href="classXQillaAllocator.html#d3f8310a45fd563d33a55e9542100fa9">_memMgr</a>;
<a name="l00161"></a>00161 };
<a name="l00162"></a>00162
<a name="l00163"></a>00163 <span class="comment">// ---------------------------------------------------------------------------</span>
<a name="l00164"></a>00164 <span class="comment">//</span>
<a name="l00165"></a>00165 <span class="comment">// Operator new. Global overloaded version, lets any object be allocated on</span>
<a name="l00166"></a>00166 <span class="comment">// the heap owned by a MemoryManager.</span>
<a name="l00167"></a>00167 <span class="comment">//</span>
<a name="l00168"></a>00168 <span class="comment">// ---------------------------------------------------------------------------</span>
<a name="l00169"></a><a class="code" href="XPath2MemoryManager_8hpp.html#167311a5bb3ed59f0f906d097e3a3363">00169</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> * <a class="code" href="XPath2MemoryManager_8hpp.html#167311a5bb3ed59f0f906d097e3a3363">operator new</a>(size_t amt, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* memMgr)
<a name="l00170"></a>00170 {
<a name="l00171"></a>00171 <span class="keywordtype">void</span> *p = memMgr-&gt;allocate(amt);
<a name="l00172"></a>00172 <span class="keywordflow">return</span> p;
<a name="l00173"></a>00173 }
<a name="l00174"></a>00174
<a name="l00175"></a><a class="code" href="XPath2MemoryManager_8hpp.html#e9e5a8b04973d492638fe3eb86f466f7">00175</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="XPath2MemoryManager_8hpp.html#e9e5a8b04973d492638fe3eb86f466f7">operator delete</a>(<span class="keywordtype">void</span>* ptr, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* memMgr)
<a name="l00176"></a>00176 {
<a name="l00177"></a>00177 memMgr-&gt;deallocate(ptr);
<a name="l00178"></a>00178 }
<a name="l00179"></a>00179
<a name="l00180"></a>00180 <span class="keyword">template</span>&lt;<span class="keyword">class</span> TYPE&gt;
<a name="l00181"></a><a class="code" href="classAutoRelease.html">00181</a> <span class="keyword">class </span><a class="code" href="classAutoRelease.html">AutoRelease</a>
<a name="l00182"></a>00182 {
<a name="l00183"></a>00183 <span class="keyword">public</span>:
<a name="l00184"></a><a class="code" href="classAutoRelease.html#686c035fad9b8aa2974261c7251bb672">00184</a> <a class="code" href="classAutoRelease.html#686c035fad9b8aa2974261c7251bb672">AutoRelease</a>(TYPE *p)
<a name="l00185"></a>00185 : p_(p) {}
<a name="l00186"></a><a class="code" href="classAutoRelease.html#9ee0c67d727350665894472e292524e3">00186</a> <a class="code" href="classAutoRelease.html#9ee0c67d727350665894472e292524e3">~AutoRelease</a>()
<a name="l00187"></a>00187 {
<a name="l00188"></a>00188 <span class="keywordflow">if</span>(p_ != 0)
<a name="l00189"></a>00189 p_-&gt;release();
<a name="l00190"></a>00190 }
<a name="l00191"></a>00191
<a name="l00192"></a><a class="code" href="classAutoRelease.html#61fc5eec0dfb72dd283e576f1ea93091">00192</a> TYPE &amp;<a class="code" href="classAutoRelease.html#61fc5eec0dfb72dd283e576f1ea93091">operator*</a>()<span class="keyword"> const</span>
<a name="l00193"></a>00193 <span class="keyword"> </span>{
<a name="l00194"></a>00194 <span class="keywordflow">return</span> *p_;
<a name="l00195"></a>00195 }
<a name="l00196"></a><a class="code" href="classAutoRelease.html#dbfc26433a8a5ddb1fa4b9d90dd0ae2b">00196</a> TYPE *<a class="code" href="classAutoRelease.html#dbfc26433a8a5ddb1fa4b9d90dd0ae2b">operator-&gt;</a>()<span class="keyword"> const</span>
<a name="l00197"></a>00197 <span class="keyword"> </span>{
<a name="l00198"></a>00198 <span class="keywordflow">return</span> p_;
<a name="l00199"></a>00199 }
<a name="l00200"></a><a class="code" href="classAutoRelease.html#d733cb9dd36630acaac8f5e77594a943">00200</a> <a class="code" href="classAutoRelease.html#d733cb9dd36630acaac8f5e77594a943">operator TYPE*</a>()<span class="keyword"> const</span>
<a name="l00201"></a>00201 <span class="keyword"> </span>{
<a name="l00202"></a>00202 <span class="keywordflow">return</span> p_;
<a name="l00203"></a>00203 }
<a name="l00204"></a><a class="code" href="classAutoRelease.html#d8d405ce3e52406a04461a00a2743691">00204</a> TYPE *<a class="code" href="classAutoRelease.html#d8d405ce3e52406a04461a00a2743691">get</a>()<span class="keyword"> const</span>
<a name="l00205"></a>00205 <span class="keyword"> </span>{
<a name="l00206"></a>00206 <span class="keywordflow">return</span> p_;
<a name="l00207"></a>00207 }
<a name="l00208"></a><a class="code" href="classAutoRelease.html#662a4db9c2b1d0a01a9c08d7f375ad28">00208</a> TYPE *<a class="code" href="classAutoRelease.html#662a4db9c2b1d0a01a9c08d7f375ad28">adopt</a>()
<a name="l00209"></a>00209 {
<a name="l00210"></a>00210 TYPE *tmp = p_;
<a name="l00211"></a>00211 p_ = 0;
<a name="l00212"></a>00212 <span class="keywordflow">return</span> tmp;
<a name="l00213"></a>00213 }
<a name="l00214"></a><a class="code" href="classAutoRelease.html#372db34ea6ca4d9b4da4337f5f11cf5d">00214</a> TYPE *<a class="code" href="classAutoRelease.html#372db34ea6ca4d9b4da4337f5f11cf5d">swap</a>(TYPE *p)
<a name="l00215"></a>00215 {
<a name="l00216"></a>00216 TYPE *tmp = p_;
<a name="l00217"></a>00217 p_ = p;
<a name="l00218"></a>00218 <span class="keywordflow">return</span> tmp;
<a name="l00219"></a>00219 }
<a name="l00220"></a><a class="code" href="classAutoRelease.html#9bf8d8491e856723e95e7263e3cec4a3">00220</a> <span class="keywordtype">void</span> <a class="code" href="classAutoRelease.html#9bf8d8491e856723e95e7263e3cec4a3">set</a>(TYPE *p)
<a name="l00221"></a>00221 {
<a name="l00222"></a>00222 <span class="keywordflow">if</span>(p_ != 0)
<a name="l00223"></a>00223 p_-&gt;release();
<a name="l00224"></a>00224 p_ = p;
<a name="l00225"></a>00225 }
<a name="l00226"></a>00226
<a name="l00227"></a>00227 <span class="keyword">private</span>:
<a name="l00228"></a>00228 <a class="code" href="classAutoRelease.html#686c035fad9b8aa2974261c7251bb672">AutoRelease</a>(<span class="keyword">const</span> <a class="code" href="classAutoRelease.html">AutoRelease&lt;TYPE&gt;</a> &amp;);
<a name="l00229"></a>00229 <a class="code" href="classAutoRelease.html">AutoRelease&lt;TYPE&gt;</a> &amp;operator=(<span class="keyword">const</span> <a class="code" href="classAutoRelease.html">AutoRelease&lt;TYPE&gt;</a> &amp;);
<a name="l00230"></a>00230
<a name="l00231"></a>00231 TYPE *p_;
<a name="l00232"></a>00232 };
<a name="l00233"></a>00233
<a name="l00234"></a>00234 <span class="keyword">template</span>&lt;<span class="keyword">class</span> TYPE&gt;
<a name="l00235"></a><a class="code" href="classAutoDelete.html">00235</a> <span class="keyword">class </span><a class="code" href="classAutoDelete.html">AutoDelete</a>
<a name="l00236"></a>00236 {
<a name="l00237"></a>00237 <span class="keyword">public</span>:
<a name="l00238"></a><a class="code" href="classAutoDelete.html#670c852dae170f5c4bea55d3539ba9a8">00238</a> <a class="code" href="classAutoDelete.html#670c852dae170f5c4bea55d3539ba9a8">AutoDelete</a>(TYPE *p)
<a name="l00239"></a>00239 : p_(p) {}
<a name="l00240"></a><a class="code" href="classAutoDelete.html#d5ab2d6d805ba02bac1e1929a5603613">00240</a> <a class="code" href="classAutoDelete.html#d5ab2d6d805ba02bac1e1929a5603613">~AutoDelete</a>()
<a name="l00241"></a>00241 {
<a name="l00242"></a>00242 <span class="keyword">delete</span> p_;
<a name="l00243"></a>00243 }
<a name="l00244"></a>00244
<a name="l00245"></a><a class="code" href="classAutoDelete.html#850874d8da81aac52236756ed9f7c9c4">00245</a> TYPE &amp;<a class="code" href="classAutoDelete.html#850874d8da81aac52236756ed9f7c9c4">operator*</a>()<span class="keyword"> const</span>
<a name="l00246"></a>00246 <span class="keyword"> </span>{
<a name="l00247"></a>00247 <span class="keywordflow">return</span> *p_;
<a name="l00248"></a>00248 }
<a name="l00249"></a><a class="code" href="classAutoDelete.html#1dbde6a753417cc9dd39097fdfce895e">00249</a> TYPE *<a class="code" href="classAutoDelete.html#1dbde6a753417cc9dd39097fdfce895e">operator-&gt;</a>()<span class="keyword"> const</span>
<a name="l00250"></a>00250 <span class="keyword"> </span>{
<a name="l00251"></a>00251 <span class="keywordflow">return</span> p_;
<a name="l00252"></a>00252 }
<a name="l00253"></a><a class="code" href="classAutoDelete.html#12bfa6b3dde315fc283159709d4be9f5">00253</a> <a class="code" href="classAutoDelete.html#12bfa6b3dde315fc283159709d4be9f5">operator TYPE*</a>()<span class="keyword"> const</span>
<a name="l00254"></a>00254 <span class="keyword"> </span>{
<a name="l00255"></a>00255 <span class="keywordflow">return</span> p_;
<a name="l00256"></a>00256 }
<a name="l00257"></a><a class="code" href="classAutoDelete.html#d257e434207019f65a7c85d84fe69efa">00257</a> TYPE *<a class="code" href="classAutoDelete.html#d257e434207019f65a7c85d84fe69efa">get</a>()<span class="keyword"> const</span>
<a name="l00258"></a>00258 <span class="keyword"> </span>{
<a name="l00259"></a>00259 <span class="keywordflow">return</span> p_;
<a name="l00260"></a>00260 }
<a name="l00261"></a><a class="code" href="classAutoDelete.html#1f33c6ac21f2160fa854975c96336491">00261</a> TYPE *<a class="code" href="classAutoDelete.html#1f33c6ac21f2160fa854975c96336491">adopt</a>()
<a name="l00262"></a>00262 {
<a name="l00263"></a>00263 TYPE *tmp = p_;
<a name="l00264"></a>00264 p_ = 0;
<a name="l00265"></a>00265 <span class="keywordflow">return</span> tmp;
<a name="l00266"></a>00266 }
<a name="l00267"></a><a class="code" href="classAutoDelete.html#2960c5bdae56a81340b975f59b5066ce">00267</a> TYPE *<a class="code" href="classAutoDelete.html#2960c5bdae56a81340b975f59b5066ce">swap</a>(TYPE *p)
<a name="l00268"></a>00268 {
<a name="l00269"></a>00269 TYPE *tmp = p_;
<a name="l00270"></a>00270 p_ = p;
<a name="l00271"></a>00271 <span class="keywordflow">return</span> tmp;
<a name="l00272"></a>00272 }
<a name="l00273"></a><a class="code" href="classAutoDelete.html#a00be90ea92eedd9b2e03b1bc527a669">00273</a> <span class="keywordtype">void</span> <a class="code" href="classAutoDelete.html#a00be90ea92eedd9b2e03b1bc527a669">set</a>(TYPE *p)
<a name="l00274"></a>00274 {
<a name="l00275"></a>00275 <span class="keyword">delete</span> p_;
<a name="l00276"></a>00276 p_ = p;
<a name="l00277"></a>00277 }
<a name="l00278"></a>00278
<a name="l00279"></a>00279 <span class="keyword">private</span>:
<a name="l00280"></a>00280 <a class="code" href="classAutoDelete.html#670c852dae170f5c4bea55d3539ba9a8">AutoDelete</a>(<span class="keyword">const</span> <a class="code" href="classAutoDelete.html">AutoDelete&lt;TYPE&gt;</a> &amp;);
<a name="l00281"></a>00281 <a class="code" href="classAutoDelete.html">AutoDelete&lt;TYPE&gt;</a> &amp;operator=(<span class="keyword">const</span> <a class="code" href="classAutoDelete.html">AutoDelete&lt;TYPE&gt;</a> &amp;);
<a name="l00282"></a>00282
<a name="l00283"></a>00283 TYPE *p_;
<a name="l00284"></a>00284 };
<a name="l00285"></a>00285
<a name="l00286"></a>00286 <span class="keyword">template</span>&lt;<span class="keyword">class</span> TYPE&gt;
<a name="l00287"></a><a class="code" href="classAutoDeleteArray.html">00287</a> <span class="keyword">class </span><a class="code" href="classAutoDeleteArray.html">AutoDeleteArray</a>
<a name="l00288"></a>00288 {
<a name="l00289"></a>00289 <span class="keyword">public</span>:
<a name="l00290"></a><a class="code" href="classAutoDeleteArray.html#326eefc335cf22f67e2e83928b6a6245">00290</a> <a class="code" href="classAutoDeleteArray.html#326eefc335cf22f67e2e83928b6a6245">AutoDeleteArray</a>(TYPE *p)
<a name="l00291"></a>00291 : p_(p) {}
<a name="l00292"></a><a class="code" href="classAutoDeleteArray.html#7f0f2786183326c4cc09d25b1879df5b">00292</a> <a class="code" href="classAutoDeleteArray.html#7f0f2786183326c4cc09d25b1879df5b">~AutoDeleteArray</a>()
<a name="l00293"></a>00293 {
<a name="l00294"></a>00294 <span class="keyword">delete</span> [] p_;
<a name="l00295"></a>00295 }
<a name="l00296"></a>00296
<a name="l00297"></a><a class="code" href="classAutoDeleteArray.html#267be85a114eae7c8b0939bc5eb27c4e">00297</a> TYPE &amp;<a class="code" href="classAutoDeleteArray.html#267be85a114eae7c8b0939bc5eb27c4e">operator*</a>()<span class="keyword"> const</span>
<a name="l00298"></a>00298 <span class="keyword"> </span>{
<a name="l00299"></a>00299 <span class="keywordflow">return</span> *p_;
<a name="l00300"></a>00300 }
<a name="l00301"></a><a class="code" href="classAutoDeleteArray.html#3e90b6bc30abacbd71c340809dd89e09">00301</a> TYPE *<a class="code" href="classAutoDeleteArray.html#3e90b6bc30abacbd71c340809dd89e09">operator-&gt;</a>()<span class="keyword"> const</span>
<a name="l00302"></a>00302 <span class="keyword"> </span>{
<a name="l00303"></a>00303 <span class="keywordflow">return</span> p_;
<a name="l00304"></a>00304 }
<a name="l00305"></a><a class="code" href="classAutoDeleteArray.html#a0c4f9422e684d94d2e3d364a8585404">00305</a> <a class="code" href="classAutoDeleteArray.html#a0c4f9422e684d94d2e3d364a8585404">operator TYPE*</a>()<span class="keyword"> const</span>
<a name="l00306"></a>00306 <span class="keyword"> </span>{
<a name="l00307"></a>00307 <span class="keywordflow">return</span> p_;
<a name="l00308"></a>00308 }
<a name="l00309"></a><a class="code" href="classAutoDeleteArray.html#b88aaa530328e51755cf9052801f6793">00309</a> TYPE *<a class="code" href="classAutoDeleteArray.html#b88aaa530328e51755cf9052801f6793">get</a>()<span class="keyword"> const</span>
<a name="l00310"></a>00310 <span class="keyword"> </span>{
<a name="l00311"></a>00311 <span class="keywordflow">return</span> p_;
<a name="l00312"></a>00312 }
<a name="l00313"></a><a class="code" href="classAutoDeleteArray.html#adcd29d03ab17fc8e3ab9856fe18eace">00313</a> TYPE *<a class="code" href="classAutoDeleteArray.html#adcd29d03ab17fc8e3ab9856fe18eace">adopt</a>()
<a name="l00314"></a>00314 {
<a name="l00315"></a>00315 TYPE *tmp = p_;
<a name="l00316"></a>00316 p_ = 0;
<a name="l00317"></a>00317 <span class="keywordflow">return</span> tmp;
<a name="l00318"></a>00318 }
<a name="l00319"></a><a class="code" href="classAutoDeleteArray.html#57ec3c1ed0e042230c5ca7e18ae7c382">00319</a> TYPE *<a class="code" href="classAutoDeleteArray.html#57ec3c1ed0e042230c5ca7e18ae7c382">swap</a>(TYPE *p)
<a name="l00320"></a>00320 {
<a name="l00321"></a>00321 TYPE *tmp = p_;
<a name="l00322"></a>00322 p_ = p;
<a name="l00323"></a>00323 <span class="keywordflow">return</span> tmp;
<a name="l00324"></a>00324 }
<a name="l00325"></a><a class="code" href="classAutoDeleteArray.html#9817f2407fc5ce75839ea01eacd108a6">00325</a> <span class="keywordtype">void</span> <a class="code" href="classAutoDeleteArray.html#9817f2407fc5ce75839ea01eacd108a6">set</a>(TYPE *p)
<a name="l00326"></a>00326 {
<a name="l00327"></a>00327 <span class="keyword">delete</span> [] p_;
<a name="l00328"></a>00328 p_ = p;
<a name="l00329"></a>00329 }
<a name="l00330"></a>00330
<a name="l00331"></a>00331 <span class="keyword">private</span>:
<a name="l00332"></a>00332 <a class="code" href="classAutoDeleteArray.html#326eefc335cf22f67e2e83928b6a6245">AutoDeleteArray</a>(<span class="keyword">const</span> <a class="code" href="classAutoDeleteArray.html">AutoDeleteArray&lt;TYPE&gt;</a> &amp;);
<a name="l00333"></a>00333 <a class="code" href="classAutoDeleteArray.html">AutoDeleteArray&lt;TYPE&gt;</a> &amp;operator=(<span class="keyword">const</span> <a class="code" href="classAutoDeleteArray.html">AutoDeleteArray&lt;TYPE&gt;</a> &amp;);
<a name="l00334"></a>00334
<a name="l00335"></a>00335 TYPE *p_;
<a name="l00336"></a>00336 };
<a name="l00337"></a>00337
<a name="l00338"></a>00338 <span class="keyword">template</span>&lt;<span class="keyword">class</span> TYPE&gt;
<a name="l00339"></a><a class="code" href="classAutoDeallocate.html">00339</a> <span class="keyword">class </span><a class="code" href="classAutoDeallocate.html">AutoDeallocate</a>
<a name="l00340"></a>00340 {
<a name="l00341"></a>00341 <span class="keyword">public</span>:
<a name="l00342"></a><a class="code" href="classAutoDeallocate.html#513ce277d04ae90375bffa5353ce2ec2">00342</a> <a class="code" href="classAutoDeallocate.html#513ce277d04ae90375bffa5353ce2ec2">AutoDeallocate</a>(XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *mmgr, size_t size = <span class="keyword">sizeof</span>(TYPE))
<a name="l00343"></a>00343 : p_(0), mmgr_(mmgr) {
<a name="l00344"></a>00344 p_ = (TYPE*)mmgr_-&gt;<a class="code" href="classxercesc_1_1MemoryManager.html#f2c4b513a75ee22fbaa4bdc7a5bfdc81">allocate</a>(size);
<a name="l00345"></a>00345 }
<a name="l00346"></a><a class="code" href="classAutoDeallocate.html#8fad7fbdef93053789fd7382d7e4d4da">00346</a> <a class="code" href="classAutoDeallocate.html#513ce277d04ae90375bffa5353ce2ec2">AutoDeallocate</a>(TYPE *p, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *mmgr)
<a name="l00347"></a>00347 : p_(p), mmgr_(mmgr) {}
<a name="l00348"></a><a class="code" href="classAutoDeallocate.html#f244dab4381f4490b00a4f6bbdaf9d73">00348</a> <a class="code" href="classAutoDeallocate.html#f244dab4381f4490b00a4f6bbdaf9d73">~AutoDeallocate</a>()
<a name="l00349"></a>00349 {
<a name="l00350"></a>00350 <span class="keywordflow">if</span>(p_ != 0)
<a name="l00351"></a>00351 mmgr_-&gt;<a class="code" href="classxercesc_1_1MemoryManager.html#4fd46b0b3634cf5540170ff3dcdfc414">deallocate</a>((<span class="keywordtype">void</span>*)p_);
<a name="l00352"></a>00352 }
<a name="l00353"></a>00353
<a name="l00354"></a><a class="code" href="classAutoDeallocate.html#1c58cc505706a631c095b2c8f10f0e14">00354</a> TYPE &amp;<a class="code" href="classAutoDeallocate.html#1c58cc505706a631c095b2c8f10f0e14">operator*</a>()<span class="keyword"> const</span>
<a name="l00355"></a>00355 <span class="keyword"> </span>{
<a name="l00356"></a>00356 <span class="keywordflow">return</span> *p_;
<a name="l00357"></a>00357 }
<a name="l00358"></a><a class="code" href="classAutoDeallocate.html#84994f88de965a8418e1bdea9199b604">00358</a> TYPE *<a class="code" href="classAutoDeallocate.html#84994f88de965a8418e1bdea9199b604">operator-&gt;</a>()<span class="keyword"> const</span>
<a name="l00359"></a>00359 <span class="keyword"> </span>{
<a name="l00360"></a>00360 <span class="keywordflow">return</span> p_;
<a name="l00361"></a>00361 }
<a name="l00362"></a><a class="code" href="classAutoDeallocate.html#80cf9145217743c2a7925461cccf0d37">00362</a> <a class="code" href="classAutoDeallocate.html#80cf9145217743c2a7925461cccf0d37">operator TYPE*</a>()<span class="keyword"> const</span>
<a name="l00363"></a>00363 <span class="keyword"> </span>{
<a name="l00364"></a>00364 <span class="keywordflow">return</span> p_;
<a name="l00365"></a>00365 }
<a name="l00366"></a><a class="code" href="classAutoDeallocate.html#c5bb09f289ca6be6a11e79b899873278">00366</a> TYPE *<a class="code" href="classAutoDeallocate.html#c5bb09f289ca6be6a11e79b899873278">get</a>()<span class="keyword"> const</span>
<a name="l00367"></a>00367 <span class="keyword"> </span>{
<a name="l00368"></a>00368 <span class="keywordflow">return</span> p_;
<a name="l00369"></a>00369 }
<a name="l00370"></a><a class="code" href="classAutoDeallocate.html#4dc196c0b9073fc712c34f27a8cd1dd1">00370</a> TYPE *<a class="code" href="classAutoDeallocate.html#4dc196c0b9073fc712c34f27a8cd1dd1">adopt</a>()
<a name="l00371"></a>00371 {
<a name="l00372"></a>00372 TYPE *tmp = p_;
<a name="l00373"></a>00373 p_ = 0;
<a name="l00374"></a>00374 <span class="keywordflow">return</span> tmp;
<a name="l00375"></a>00375 }
<a name="l00376"></a><a class="code" href="classAutoDeallocate.html#ed2758752b4cc2cdb91e6192b6310ef0">00376</a> TYPE *<a class="code" href="classAutoDeallocate.html#ed2758752b4cc2cdb91e6192b6310ef0">swap</a>(TYPE *p)
<a name="l00377"></a>00377 {
<a name="l00378"></a>00378 TYPE *tmp = p_;
<a name="l00379"></a>00379 p_ = p;
<a name="l00380"></a>00380 <span class="keywordflow">return</span> tmp;
<a name="l00381"></a>00381 }
<a name="l00382"></a><a class="code" href="classAutoDeallocate.html#c11b517f7786a4c2066415dbd30b001d">00382</a> <span class="keywordtype">void</span> <a class="code" href="classAutoDeallocate.html#c11b517f7786a4c2066415dbd30b001d">set</a>(TYPE *p)
<a name="l00383"></a>00383 {
<a name="l00384"></a>00384 <span class="keywordflow">if</span>(p_ != 0)
<a name="l00385"></a>00385 mmgr_-&gt;<a class="code" href="classxercesc_1_1MemoryManager.html#4fd46b0b3634cf5540170ff3dcdfc414">deallocate</a>((<span class="keywordtype">void</span>*)p_);
<a name="l00386"></a>00386 p_ = p;
<a name="l00387"></a>00387 }
<a name="l00388"></a>00388
<a name="l00389"></a>00389 <span class="keyword">private</span>:
<a name="l00390"></a>00390 <a class="code" href="classAutoDeallocate.html#513ce277d04ae90375bffa5353ce2ec2">AutoDeallocate</a>(<span class="keyword">const</span> <a class="code" href="classAutoDeallocate.html">AutoDeallocate&lt;TYPE&gt;</a> &amp;);
<a name="l00391"></a>00391 <a class="code" href="classAutoDeallocate.html">AutoDeallocate&lt;TYPE&gt;</a> &amp;operator=(<span class="keyword">const</span> <a class="code" href="classAutoDeallocate.html">AutoDeallocate&lt;TYPE&gt;</a> &amp;);
<a name="l00392"></a>00392
<a name="l00393"></a>00393 TYPE *p_;
<a name="l00394"></a>00394 XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager *mmgr_;
<a name="l00395"></a>00395 };
<a name="l00396"></a>00396
<a name="l00397"></a>00397 <span class="preprocessor">#endif //__XPATH2MEMORYMANAGER_HPP</span>
<a name="l00398"></a>00398 <span class="preprocessor"></span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Wed Dec 12 20:16:43 2007 for XQilla Simple API by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>