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(XALANQNAMEBYVALUEALLOCATOR_INCLUDE_GUARD_12455133) 00020 #define XALANQNAMEBYVALUEALLOCATOR_INCLUDE_GUARD_12455133 00021 00022 00023 00024 // Base include file. Must be first. 00025 #include <xalanc/XPath/XPathDefinitions.hpp> 00026 00027 00028 00029 #include <xalanc/XPath/XalanQNameByValue.hpp> 00030 00031 00032 00033 #include <xalanc/PlatformSupport/ArenaAllocator.hpp> 00034 00035 00036 00037 XALAN_CPP_NAMESPACE_BEGIN 00038 00039 00040 00041 class XALAN_XPATH_EXPORT XalanQNameByValueAllocator 00042 { 00043 public: 00044 00045 typedef XalanQNameByValue data_type; 00046 typedef data_type::NamespacesStackType NamespacesStackType; 00047 00048 #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS) 00049 typedef ArenaBlock<data_type> ArenaBlockType; 00050 typedef ArenaAllocator<data_type, 00051 ArenaBlockType> ArenaAllocatorType; 00052 #else 00053 typedef ArenaAllocator<data_type> ArenaAllocatorType; 00054 #endif 00055 00056 typedef ArenaAllocatorType::size_type size_type; 00057 00058 /** 00059 * Construct an instance that will allocate blocks of the specified size. 00060 * 00061 * @param theBlockSize The block size. 00062 */ 00063 XalanQNameByValueAllocator( 00064 MemoryManager& theManager, 00065 size_type theBlockCount); 00066 00067 ~XalanQNameByValueAllocator(); 00068 00069 /** 00070 * Create an instance. 00071 * 00072 * @param theSource The source of the copy. 00073 * 00074 * @return A pointer to the new instance. 00075 */ 00076 data_type* 00077 create(const XalanQNameByValue& theSource); 00078 00079 /** 00080 * Create an instance. 00081 * 00082 * @param theNamespace namespace string 00083 * @param theLocalPart local part string 00084 * 00085 * @return A pointer to the new instance. 00086 */ 00087 data_type* 00088 create( 00089 const XalanDOMString& theNamespaceURI, 00090 const XalanDOMString& theLocalPart); 00091 00092 /** 00093 * Create an instance. 00094 * 00095 * @param qname QName string 00096 * @param namespaces namespace vector stack to use 00097 * @param locator The Locator instance for error reporting, if any 00098 * @param fUseDefault If true, then elements with no prefix will have the default namespace URI, if there is one. 00099 * 00100 * @return A pointer to the new instance. 00101 */ 00102 data_type* 00103 create( 00104 const XalanDOMString& qname, 00105 const NamespacesStackType& namespaces, 00106 const Locator* locator = 0, 00107 bool fUseDefault = false); 00108 00109 /** 00110 * Create an instance. 00111 * 00112 * @param qname QName string 00113 * @param namespaces namespace vector stack to use 00114 * @param locator The Locator instance for error reporting, if any 00115 * @param fUseDefault If true, then elements with no prefix will have the default namespace URI, if there is one. 00116 * 00117 * @return A pointer to the new instance. 00118 */ 00119 data_type* 00120 create( 00121 const XalanDOMChar* qname, 00122 const NamespacesStackType& namespaces, 00123 const Locator* locator = 0, 00124 bool fUseDefault = false); 00125 00126 /** 00127 * Create an instance. 00128 * 00129 * @param qname QName string 00130 * @param theResolver prefix resolver to use 00131 * @param locator The Locator instance for error reporting, if any 00132 * 00133 * @return A pointer to the new instance. 00134 */ 00135 data_type* 00136 create( 00137 const XalanDOMString& qname, 00138 const PrefixResolver* theResolver = 0, 00139 const Locator* locator = 0); 00140 00141 /** 00142 * Determine if an object is owned by the allocator... 00143 */ 00144 bool 00145 ownsObject(const data_type* theObject) 00146 { 00147 return m_allocator.ownsObject(theObject); 00148 } 00149 00150 /** 00151 * Delete all objects from the allocator. 00152 */ 00153 void 00154 reset() 00155 { 00156 m_allocator.reset(); 00157 } 00158 00159 /** 00160 * Get the number of ArenaBlocks currently allocated. 00161 * 00162 * @return The number of blocks. 00163 */ 00164 size_type 00165 getBlockCount() const 00166 { 00167 return m_allocator.getBlockCount(); 00168 } 00169 00170 /** 00171 * Get size of an ArenaBlock, that is, the number 00172 * of objects in each block. 00173 * 00174 * @return The size of the block 00175 */ 00176 size_type 00177 getBlockSize() const 00178 { 00179 return m_allocator.getBlockSize(); 00180 } 00181 00182 private: 00183 00184 // Not implemented... 00185 XalanQNameByValueAllocator(const XalanQNameByValueAllocator&); 00186 00187 XalanQNameByValueAllocator& 00188 operator=(const XalanQNameByValueAllocator&); 00189 00190 // Data members... 00191 ArenaAllocatorType m_allocator; 00192 }; 00193 00194 00195 00196 XALAN_CPP_NAMESPACE_END 00197 00198 00199 00200 #endif // XALANQNAMEBYVALUEALLOCATOR_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 |
|