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(XERCESELEMENTWRAPPERALLOCATOR_INCLUDE_GUARD_12455133) 00020 #define XERCESELEMENTWRAPPERALLOCATOR_INCLUDE_GUARD_12455133 00021 00022 00023 00024 #include <xalanc/XercesParserLiaison/XercesParserLiaisonDefinitions.hpp> 00025 00026 00027 00028 #include <xalanc/PlatformSupport/ArenaAllocator.hpp> 00029 00030 00031 00032 #include <xalanc/XercesParserLiaison/XercesElementWrapper.hpp> 00033 #include <xalanc/XercesParserLiaison/XercesWrapperTypes.hpp> 00034 00035 00036 00037 XALAN_CPP_NAMESPACE_BEGIN 00038 00039 00040 00041 class XALAN_XERCESPARSERLIAISON_EXPORT XercesElementWrapperAllocator 00042 { 00043 public: 00044 00045 typedef XercesElementWrapper ObjectType; 00046 00047 #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS) 00048 typedef ArenaBlock<ObjectType> ArenaBlockType; 00049 00050 typedef ArenaAllocator<ObjectType, 00051 ArenaBlockType> ArenaAllocatorType; 00052 #else 00053 typedef ArenaAllocator<ObjectType> 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 XercesElementWrapperAllocator(MemoryManager& theManager, size_type theBlockCount); 00064 00065 ~XercesElementWrapperAllocator(); 00066 00067 /** 00068 * Create a XercesElementWrapper instance. 00069 * 00070 * @param theXercesElement The Xerces element node 00071 * @param theNavigator The navigator for this instance. 00072 * 00073 * @return pointer to the instance 00074 */ 00075 ObjectType* 00076 create( 00077 const DOMElementType* theXercesElement, 00078 const XercesWrapperNavigator& theNavigator); 00079 00080 /** 00081 * Delete all objects from allocator. 00082 */ 00083 void 00084 reset(); 00085 00086 /** 00087 * Get size of an ArenaBlock, that is, the number 00088 * of objects in each block. 00089 * 00090 * @return The size of the block 00091 */ 00092 size_type 00093 getBlockCount() const 00094 { 00095 return m_allocator.getBlockCount(); 00096 } 00097 00098 /** 00099 * Get the number of ArenaBlocks currently allocated. 00100 * 00101 * @return The number of blocks. 00102 */ 00103 size_type 00104 getBlockSize() const 00105 { 00106 return m_allocator.getBlockSize(); 00107 } 00108 00109 00110 private: 00111 00112 // Not implemented... 00113 XercesElementWrapperAllocator(const XercesElementWrapperAllocator&); 00114 00115 XercesElementWrapperAllocator& 00116 operator=(const XercesElementWrapperAllocator&); 00117 00118 // Data members... 00119 ArenaAllocatorType m_allocator; 00120 }; 00121 00122 00123 00124 XALAN_CPP_NAMESPACE_END 00125 00126 00127 00128 #endif // XERCESELEMENTWRAPPERALLOCATOR_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 |
|