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(XALANSOURCETREEELEMENTANSALLOCATOR_INCLUDE_GUARD_12455133) 00020 #define XALANSOURCETREEELEMENTANSALLOCATOR_INCLUDE_GUARD_12455133 00021 00022 00023 00024 #include <xalanc/XalanSourceTree/XalanSourceTreeDefinitions.hpp> 00025 00026 00027 00028 #include <xalanc/PlatformSupport/ArenaAllocator.hpp> 00029 00030 00031 00032 #include <xalanc/XalanSourceTree/XalanSourceTreeElementANS.hpp> 00033 00034 00035 00036 XALAN_CPP_NAMESPACE_BEGIN 00037 00038 00039 00040 class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeElementANSAllocator 00041 { 00042 public: 00043 00044 typedef XalanSourceTreeElementANS ObjectType; 00045 00046 typedef ObjectType::IndexType IndexType; 00047 00048 #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS) 00049 typedef ArenaBlock<ObjectType> ArenaBlockType; 00050 00051 typedef ArenaAllocator<ObjectType, 00052 ArenaBlockType> ArenaAllocatorType; 00053 #else 00054 typedef ArenaAllocator<ObjectType> ArenaAllocatorType; 00055 #endif 00056 00057 typedef ArenaAllocatorType::size_type size_type; 00058 00059 /** 00060 * Construct an instance that will allocate blocks of the specified size. 00061 * 00062 * @param theBlockSize The block size. 00063 */ 00064 XalanSourceTreeElementANSAllocator( 00065 MemoryManager& theManager, 00066 size_type theBlockCount); 00067 00068 ~XalanSourceTreeElementANSAllocator(); 00069 00070 /** 00071 * Create an instance. 00072 * 00073 * @param theTagName The tag name of the element 00074 * @param theLocalName The local name of the attribute 00075 * @param theNamespaceURI The namespace URI of the attribute 00076 * @param thePrefix The namespace prefix of the attribute 00077 * @param theOwnerDocument The document that owns the instance 00078 * @param theAttributes An array of pointers to the attribute instances for the element 00079 * @param theAttributeCount The number of attributes. 00080 * @param theParentNode The parent node, if any. 00081 * @param thePreviousSibling The previous sibling, if any. 00082 * @param theNextSibling The next sibling, if any. 00083 * @param theIndex The document-order index of the node. 00084 * 00085 * @return pointer to the instance 00086 */ 00087 ObjectType* 00088 create( 00089 const XalanDOMString& theTagName, 00090 const XalanDOMString& theLocalName, 00091 const XalanDOMString& theNamespaceURI, 00092 const XalanDOMString& thePrefix, 00093 XalanSourceTreeDocument* theOwnerDocument, 00094 XalanSourceTreeAttr** theAttributes, 00095 XalanSize_t theAttributeCount, 00096 XalanNode* theParentNode = 0, 00097 XalanNode* thePreviousSibling = 0, 00098 XalanNode* theNextSibling = 0, 00099 IndexType theIndex = 0); 00100 00101 /** 00102 * Delete all objects from allocator. 00103 */ 00104 void 00105 reset(); 00106 00107 /** 00108 * Get size of an ArenaBlock, that is, the number 00109 * of objects in each block. 00110 * 00111 * @return The size of the block 00112 */ 00113 size_type 00114 getBlockCount() const 00115 { 00116 return m_allocator.getBlockCount(); 00117 } 00118 00119 /** 00120 * Get the number of ArenaBlocks currently allocated. 00121 * 00122 * @return The number of blocks. 00123 */ 00124 size_type 00125 getBlockSize() const 00126 { 00127 return m_allocator.getBlockSize(); 00128 } 00129 00130 private: 00131 00132 // Not implemented... 00133 XalanSourceTreeElementANSAllocator(const XalanSourceTreeElementANSAllocator&); 00134 00135 XalanSourceTreeElementANSAllocator& 00136 operator=(const XalanSourceTreeElementANSAllocator&); 00137 00138 // Data members... 00139 ArenaAllocatorType m_allocator; 00140 }; 00141 00142 00143 00144 XALAN_CPP_NAMESPACE_END 00145 00146 00147 00148 #endif // XALANSOURCETREEELEMENTANSALLOCATOR_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 |
|