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(XTOKENNUMBERADAPTERALLOCATOR_INCLUDE_GUARD_1357924680) 00020 #define XTOKENNUMBERADAPTERALLOCATOR_INCLUDE_GUARD_1357924680 00021 00022 00023 00024 // Base include file. Must be first. 00025 #include <xalanc/XPath/XPathDefinitions.hpp> 00026 00027 00028 00029 #include <xalanc/XPath/XTokenNumberAdapter.hpp> 00030 00031 00032 00033 #include <xalanc/PlatformSupport/ReusableArenaAllocator.hpp> 00034 00035 00036 00037 XALAN_CPP_NAMESPACE_BEGIN 00038 00039 00040 00041 class XALAN_XPATH_EXPORT XTokenNumberAdapterAllocator 00042 { 00043 public: 00044 00045 typedef XTokenNumberAdapter object_type; 00046 00047 typedef ReusableArenaAllocator<object_type> ArenaAllocatorType; 00048 typedef ArenaAllocatorType::size_type size_type; 00049 00050 /** 00051 * Construct an instance that will allocate blocks of the specified size. 00052 * 00053 * @param theBlockSize The block size. 00054 */ 00055 XTokenNumberAdapterAllocator( 00056 MemoryManager& theMemoryManager, 00057 size_type theBlockCount); 00058 00059 ~XTokenNumberAdapterAllocator(); 00060 00061 /** 00062 * Create an instance from an XToken. 00063 * 00064 * @param theXToken The source XToken 00065 * 00066 * @return A pointer to the new object 00067 */ 00068 object_type* 00069 create(const XToken& theXToken); 00070 00071 /** 00072 * Delete an XStringAdapter object from allocator. 00073 */ 00074 bool 00075 destroy(object_type* theObject); 00076 00077 /** 00078 * Determine if an object is owned by the allocator... 00079 */ 00080 bool 00081 ownsObject(const object_type* theObject) 00082 { 00083 return m_allocator.ownsObject(theObject); 00084 } 00085 00086 /** 00087 * Delete all XStringAdapter objects from allocator. 00088 */ 00089 void 00090 reset(); 00091 00092 /** 00093 * Get size of an ArenaBlock, that is, the number 00094 * of objects in each block. 00095 * 00096 * @return The size of the block 00097 */ 00098 size_type 00099 getBlockCount() const 00100 { 00101 return m_allocator.getBlockCount(); 00102 } 00103 00104 /** 00105 * Get the number of ArenaBlocks currently allocated. 00106 * 00107 * @return The number of blocks. 00108 */ 00109 size_type 00110 getBlockSize() const 00111 { 00112 return m_allocator.getBlockSize(); 00113 } 00114 00115 private: 00116 00117 MemoryManager& 00118 getMemoryManager() 00119 { 00120 return m_allocator.getMemoryManager(); 00121 } 00122 00123 // Not implemented... 00124 XTokenNumberAdapterAllocator(const XTokenNumberAdapterAllocator&); 00125 00126 XTokenNumberAdapterAllocator& 00127 operator=(const XTokenNumberAdapterAllocator&); 00128 00129 // Data members... 00130 ArenaAllocatorType m_allocator; 00131 }; 00132 00133 00134 00135 XALAN_CPP_NAMESPACE_END 00136 00137 00138 00139 #endif // XTOKENNUMBERADAPTERALLOCATOR_INCLUDE_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.11 |
|