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(XPATHALLOCATOR_INCLUDE_GUARD_135792455) 00020 #define XPATHALLOCATOR_INCLUDE_GUARD_135792455 00021 00022 00023 00024 // Base include file. Must be first. 00025 #include <xalanc/XPath/XPathDefinitions.hpp> 00026 00027 00028 00029 #include <xalanc/PlatformSupport/ArenaAllocator.hpp> 00030 00031 00032 00033 #include <xalanc/XPath/XPath.hpp> 00034 00035 00036 00037 XALAN_CPP_NAMESPACE_BEGIN 00038 00039 00040 00041 class XALAN_XPATH_EXPORT XPathAllocator 00042 { 00043 public: 00044 00045 typedef XPath object_type; 00046 00047 #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS) 00048 typedef ArenaBlock<object_type> ArenaBlockType; 00049 00050 typedef ArenaAllocator<object_type, 00051 ArenaBlockType> ArenaAllocatorType; 00052 #else 00053 typedef ArenaAllocator<object_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 XPathAllocator(MemoryManager& theManager, size_type theBlockCount); 00064 00065 ~XPathAllocator(); 00066 00067 /** 00068 * Create an XPath object using the allocator. 00069 * 00070 * @return a pointer to an XPath 00071 */ 00072 object_type* 00073 create(); 00074 00075 /** 00076 * Determine if an object is owned by the allocator... 00077 */ 00078 bool 00079 ownsObject(const object_type* theObject) 00080 { 00081 return m_allocator.ownsObject(theObject); 00082 } 00083 00084 /** 00085 * Delete all XPath objects allocated. 00086 */ 00087 void 00088 reset(); 00089 00090 /** 00091 * Get the number of objects in each block. 00092 * 00093 * @return The size of the block 00094 */ 00095 size_type 00096 getBlockCount() const 00097 { 00098 return m_allocator.getBlockCount(); 00099 } 00100 00101 /** 00102 * Get the number of blocks currently allocated. 00103 * 00104 * @return The number of blocks. 00105 */ 00106 size_type 00107 getBlockSize() const 00108 { 00109 return m_allocator.getBlockSize(); 00110 } 00111 00112 private: 00113 00114 // Not implemented... 00115 XPathAllocator(const XPathAllocator&); 00116 00117 XPathAllocator& 00118 operator=(const XPathAllocator&); 00119 00120 // Data members... 00121 ArenaAllocatorType m_allocator; 00122 }; 00123 00124 00125 00126 XALAN_CPP_NAMESPACE_END 00127 00128 00129 00130 #endif // XNUMBERALLOCATOR_INCLUDE_GUARD_135792455
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.11 |
|