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(XALANELEMEMPTYALLOCATOR_INCLUDE_GUARD_12455133) 00020 #define XALANELEMEMPTYALLOCATOR_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/XSLT/ElemEmpty.hpp> 00030 00031 00032 00033 #include <xalanc/PlatformSupport/ReusableArenaAllocator.hpp> 00034 00035 00036 00037 XALAN_CPP_NAMESPACE_BEGIN 00038 00039 00040 00041 class XALAN_XSLT_EXPORT XalanElemEmptyAllocator 00042 { 00043 public: 00044 00045 typedef ElemEmpty data_type; 00046 00047 typedef ReusableArenaAllocator<data_type> ArenaAllocatorType; 00048 00049 typedef ArenaAllocatorType::size_type size_type; 00050 00051 /** 00052 * Construct an instance that will allocate blocks of the specified size. 00053 * 00054 * @param theBlockSize The block size. 00055 */ 00056 XalanElemEmptyAllocator( 00057 MemoryManager& theManager, 00058 size_type theBlockCount); 00059 00060 ~XalanElemEmptyAllocator(); 00061 00062 /** 00063 * Construct an instance 00064 * 00065 * @param constructionContext The current construction context 00066 * @param stylesheetTree The stylesheet containing element 00067 * @param lineNumber The line number in the document 00068 * @param columnNumber The column number in the document 00069 * @param elementName The name of element. Can be 0. 00070 * 00071 * @return A pointer to the new instance. 00072 */ 00073 data_type* 00074 create( 00075 StylesheetConstructionContext& constructionContext, 00076 Stylesheet& stylesheetTree, 00077 XalanFileLoc lineNumber, 00078 XalanFileLoc columnNumber, 00079 const XalanDOMString* elementName = 0); 00080 00081 /** 00082 * Construct an instance 00083 * 00084 * @param constructionContext The current construction context 00085 * @param stylesheetTree The stylesheet containing element 00086 * @param elementName The name of element. Can be 0. 00087 */ 00088 data_type* 00089 create( 00090 StylesheetConstructionContext& constructionContext, 00091 Stylesheet& stylesheetTree, 00092 const XalanDOMString* elementName = 0); 00093 00094 /** 00095 * Destroy an instance previously created. 00096 * 00097 * @param theObject A pointer to the instance to destroy. 00098 * 00099 * @return true if the instance was destroyed, false if not. 00100 */ 00101 bool 00102 destroy(data_type* theObject) 00103 { 00104 return m_allocator.destroyObject(theObject); 00105 } 00106 00107 /** 00108 * Determine if an object is owned by the allocator... 00109 */ 00110 bool 00111 ownsObject(const data_type* theObject) 00112 { 00113 return m_allocator.ownsObject(theObject); 00114 } 00115 00116 /** 00117 * Delete all objects from the allocator. 00118 */ 00119 void 00120 reset() 00121 { 00122 m_allocator.reset(); 00123 } 00124 00125 /** 00126 * Get the number of ArenaBlocks currently allocated. 00127 * 00128 * @return The number of blocks. 00129 */ 00130 size_type 00131 getBlockCount() const 00132 { 00133 return m_allocator.getBlockCount(); 00134 } 00135 00136 /** 00137 * Get size of an ArenaBlock, that is, the number 00138 * of objects in each block. 00139 * 00140 * @return The size of the block 00141 */ 00142 size_type 00143 getBlockSize() const 00144 { 00145 return m_allocator.getBlockSize(); 00146 } 00147 00148 private: 00149 00150 // Not implemented... 00151 XalanElemEmptyAllocator(const XalanElemEmptyAllocator&); 00152 00153 XalanElemEmptyAllocator& 00154 operator=(const XalanElemEmptyAllocator&); 00155 00156 // Data members... 00157 ArenaAllocatorType m_allocator; 00158 }; 00159 00160 00161 00162 XALAN_CPP_NAMESPACE_END 00163 00164 00165 00166 #endif // XALANELEMEMPTYALLOCATOR_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 |
|