00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one 00003 * or more contributor license agreements. See the NOTICE file 00004 * distributed with this work for additional information 00005 * regarding copyright ownership. The ASF licenses this file 00006 * to you under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 00019 #if !defined(XALANSOURCETREEDOCUMENTALLOCATOR_INCLUDE_GUARD_12455133) 00020 #define XALANSOURCETREEDOCUMENTALLOCATOR_INCLUDE_GUARD_12455133 00021 00022 00023 00024 // Base include file. Must be first. 00025 #include <xalanc/XSLT/XSLTDefinitions.hpp> 00026 00027 00028 00029 #include <xalanc/PlatformSupport/ReusableArenaAllocator.hpp> 00030 00031 00032 00033 #include <xalanc/XalanSourceTree/XalanSourceTreeDocument.hpp> 00034 00035 00036 00037 XALAN_CPP_NAMESPACE_BEGIN 00038 00039 00040 00041 class XALAN_XSLT_EXPORT XalanSourceTreeDocumentAllocator 00042 { 00043 public: 00044 00045 typedef XalanSourceTreeDocument data_type; 00046 00047 typedef ReusableArenaAllocator<data_type> ArenaAllocatorType; 00048 typedef ArenaAllocatorType::size_type size_type; 00049 00050 enum { eDefaultAttributeAllocatorBlockSize = XalanSourceTreeDocument::eDefaultAttributeAllocatorBlockSize, 00051 eDefaultAttributeNSAllocatorBlockSize = XalanSourceTreeDocument::eDefaultAttributeNSAllocatorBlockSize, 00052 eDefaultCommentAllocatorBlockSize = XalanSourceTreeDocument::eDefaultCommentAllocatorBlockSize, 00053 eDefaultElementAllocatorBlockSize = XalanSourceTreeDocument::eDefaultElementAllocatorBlockSize, 00054 eDefaultElementNSAllocatorBlockSize = XalanSourceTreeDocument::eDefaultElementNSAllocatorBlockSize, 00055 eDefaultPIAllocatorBlockSize = XalanSourceTreeDocument::eDefaultPIAllocatorBlockSize, 00056 eDefaultTextAllocatorBlockSize = XalanSourceTreeDocument::eDefaultTextAllocatorBlockSize, 00057 eDefaultTextIWSAllocatorBlockSize = XalanSourceTreeDocument::eDefaultTextIWSAllocatorBlockSize, 00058 eDefaultNamesStringPoolBlockSize = XalanSourceTreeDocument::eDefaultNamesStringPoolBlockSize, 00059 eDefaultNamesStringPoolBucketCount = XalanSourceTreeDocument::eDefaultNamesStringPoolBucketCount, 00060 eDefaultNamesStringPoolBucketSize = XalanSourceTreeDocument::eDefaultNamesStringPoolBucketSize, 00061 eDefaultValuesStringPoolBlockSize = XalanSourceTreeDocument::eDefaultValuesStringPoolBlockSize, 00062 eDefaultValuesStringPoolBucketCount = XalanSourceTreeDocument::eDefaultValuesStringPoolBucketCount, 00063 eDefaultValuesStringPoolBucketSize = XalanSourceTreeDocument::eDefaultValuesStringPoolBucketSize }; 00064 00065 typedef XalanSourceTreeDocument::block_size_type block_size_type; 00066 typedef XalanSourceTreeDocument::bucket_count_type bucket_count_type; 00067 typedef XalanSourceTreeDocument::bucket_size_type bucket_size_type; 00068 00069 /** 00070 * Construct an instance that will allocate blocks of the specified size. 00071 * 00072 * @param theBlockSize The block size. 00073 */ 00074 XalanSourceTreeDocumentAllocator(MemoryManager& theManager, size_type theBlockCount); 00075 00076 ~XalanSourceTreeDocumentAllocator(); 00077 00078 /** 00079 * Create a XalanSourceTreeDocument object. 00080 * 00081 * @param fPoolAllText If false, text node data that is not whitespace will not be pooled. 00082 * @param theNamesStringPoolBlockSize The block size for allocating strings in the name pool 00083 * @param theNamesStringPoolBucketCount The number of buckets for allocating strings in the name pool 00084 * @param theNamesStringPoolBucketSize The bucket size for allocating strings in the name pool 00085 * @param theValuesStringPoolBlockSize The block size for allocating strings in the values pool 00086 * @param theValuesStringPoolBucketCount The number of buckets for allocating strings in the values pool 00087 * @param theValuesStringPoolBucketSize The bucket size for allocating strings in the values pool 00088 * 00089 * @return pointer to a node 00090 */ 00091 data_type* 00092 create( 00093 bool fPoolAllText = true, 00094 block_size_type theNamesStringPoolBlockSize = eDefaultNamesStringPoolBlockSize, 00095 bucket_count_type theNamesStringPoolBucketCount = eDefaultNamesStringPoolBucketCount, 00096 bucket_size_type theNamesStringPoolBucketSize = eDefaultNamesStringPoolBucketSize, 00097 block_size_type theValuesStringPoolBlockSize = eDefaultValuesStringPoolBlockSize, 00098 bucket_count_type theValuesStringPoolBucketCount = eDefaultValuesStringPoolBucketCount, 00099 bucket_size_type theValuesStringPoolBucketSize = eDefaultValuesStringPoolBucketSize); 00100 00101 /** 00102 * Create a XalanSourceTreeDocument object. 00103 * 00104 * @param fPoolAllText If false, text node data that is not whitespace will not be pooled. 00105 * @param theAttributeBlockSize The block size for allocating attribute nodes 00106 * @param theAttributeNSBlockSize The block size for allocating attribute NS nodes 00107 * @param theCommentBlockSize The block size for allocating comment nodes 00108 * @param theElementBlockSize The block size for allocating element nodes 00109 * @param theElementNSBlockSize The block size for allocating element nodes 00110 * @param theTextBlockSize The block size for allocating text nodes, 00111 * @param theTextIWSBlockSize The block size for allocating text IWS nodes, 00112 * 00113 * @return pointer to a node 00114 */ 00115 data_type* 00116 create( 00117 size_type theAttributeBlockSize, 00118 size_type theAttributeNSBlockSize, 00119 size_type theCommentBlockSize, 00120 size_type theElementBlockSize, 00121 size_type theElementNSBlockSize, 00122 size_type thePIBlockSize, 00123 size_type theTextBlockSize, 00124 size_type theTextIWSBlockSize, 00125 bool fPoolAllText = true); 00126 00127 /** 00128 * Delete a XalanSourceTreeDocument object from allocator. 00129 */ 00130 bool 00131 destroy(data_type* theObject); 00132 00133 /** 00134 * Determine if an object is owned by the allocator... 00135 */ 00136 bool 00137 ownsObject(const data_type* theObject) 00138 { 00139 return m_allocator.ownsObject(theObject); 00140 } 00141 00142 /** 00143 * Delete all XalanSourceTreeDocument objects from allocator. 00144 */ 00145 void 00146 reset(); 00147 00148 /** 00149 * Get the number of ArenaBlocks currently allocated. 00150 * 00151 * @return The number of blocks. 00152 */ 00153 size_type 00154 getBlockCount() const 00155 { 00156 return m_allocator.getBlockCount(); 00157 } 00158 00159 /** 00160 * Get size of an ArenaBlock, that is, the number 00161 * of objects in each block. 00162 * 00163 * @return The size of the block 00164 */ 00165 size_type 00166 getBlockSize() const 00167 { 00168 return m_allocator.getBlockSize(); 00169 } 00170 00171 private: 00172 00173 // Not implemented... 00174 XalanSourceTreeDocumentAllocator(const XalanSourceTreeDocumentAllocator&); 00175 00176 XalanSourceTreeDocumentAllocator& 00177 operator=(const XalanSourceTreeDocumentAllocator&); 00178 00179 // Data members... 00180 ArenaAllocatorType m_allocator; 00181 }; 00182 00183 00184 00185 XALAN_CPP_NAMESPACE_END 00186 00187 00188 00189 #endif // XALANSOURCETREEDOCUMENTALLOCATOR_INCLUDE_GUARD_12455133
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.11 |
|