|
||||
File indexing completed on 2025-01-30 10:27:03
0001 /* 0002 * Licensed to the Apache Software Foundation (ASF) under one or more 0003 * contributor license agreements. See the NOTICE file distributed with 0004 * this work for additional information regarding copyright ownership. 0005 * The ASF licenses this file to You under the Apache License, Version 2.0 0006 * (the "License"); you may not use this file except in compliance with 0007 * the License. You may obtain a copy of the License at 0008 * 0009 * http://www.apache.org/licenses/LICENSE-2.0 0010 * 0011 * Unless required by applicable law or agreed to in writing, software 0012 * distributed under the License is distributed on an "AS IS" BASIS, 0013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0014 * See the License for the specific language governing permissions and 0015 * limitations under the License. 0016 */ 0017 0018 #if !defined(XERCESC_INCLUDE_GUARD_DOMMEMORYMANAGER_HPP) 0019 #define XERCESC_INCLUDE_GUARD_DOMMEMORYMANAGER_HPP 0020 0021 //------------------------------------------------------------------------------------ 0022 // Includes 0023 //------------------------------------------------------------------------------------ 0024 0025 XERCES_CPP_NAMESPACE_BEGIN 0026 0027 /** 0028 * The <code>DOMMemoryManager</code> interface exposes the memory allocation-related 0029 * functionalities of a <code>DOMDocument</code> 0030 */ 0031 0032 class CDOM_EXPORT DOMMemoryManager 0033 { 0034 protected: 0035 // ----------------------------------------------------------------------- 0036 // Hidden constructors 0037 // ----------------------------------------------------------------------- 0038 /** @name Hidden constructors */ 0039 //@{ 0040 DOMMemoryManager() {}; 0041 //@} 0042 0043 private: 0044 // ----------------------------------------------------------------------- 0045 // Unimplemented constructors and operators 0046 // ----------------------------------------------------------------------- 0047 /** @name Unimplemented constructors and operators */ 0048 //@{ 0049 DOMMemoryManager(const DOMMemoryManager &); 0050 DOMMemoryManager & operator = (const DOMMemoryManager &); 0051 //@} 0052 0053 public: 0054 0055 // ----------------------------------------------------------------------- 0056 // All constructors are hidden, just the destructor is available 0057 // ----------------------------------------------------------------------- 0058 /** @name Destructor */ 0059 //@{ 0060 /** 0061 * Destructor 0062 * 0063 */ 0064 virtual ~DOMMemoryManager() {}; 0065 //@} 0066 0067 // ----------------------------------------------------------------------- 0068 // data types 0069 // ----------------------------------------------------------------------- 0070 enum NodeObjectType { 0071 ATTR_OBJECT = 0, 0072 ATTR_NS_OBJECT = 1, 0073 CDATA_SECTION_OBJECT = 2, 0074 COMMENT_OBJECT = 3, 0075 DOCUMENT_FRAGMENT_OBJECT = 4, 0076 DOCUMENT_TYPE_OBJECT = 5, 0077 ELEMENT_OBJECT = 6, 0078 ELEMENT_NS_OBJECT = 7, 0079 ENTITY_OBJECT = 8, 0080 ENTITY_REFERENCE_OBJECT = 9, 0081 NOTATION_OBJECT = 10, 0082 PROCESSING_INSTRUCTION_OBJECT = 11, 0083 TEXT_OBJECT = 12 0084 }; 0085 0086 //@{ 0087 // ----------------------------------------------------------------------- 0088 // Getter methods 0089 // ----------------------------------------------------------------------- 0090 /** 0091 * Returns the size of the chunks of memory allocated by the memory manager 0092 * 0093 * @return the dimension of the chunks of memory allocated by the memory manager 0094 */ 0095 virtual XMLSize_t getMemoryAllocationBlockSize() const = 0; 0096 0097 //@} 0098 0099 //@{ 0100 // ----------------------------------------------------------------------- 0101 // Setter methods 0102 // ----------------------------------------------------------------------- 0103 /** 0104 * Set the size of the chunks of memory allocated by the memory manager 0105 * 0106 * @param size the new size of the chunks; it must be greater than 4KB 0107 */ 0108 virtual void setMemoryAllocationBlockSize(XMLSize_t size) = 0; 0109 //@} 0110 0111 //@{ 0112 // ----------------------------------------------------------------------- 0113 // Operations 0114 // ----------------------------------------------------------------------- 0115 /** 0116 * Allocate a memory block of the requested size from the managed pool 0117 * 0118 * @param amount the size of the new memory block 0119 * 0120 * @return the pointer to the newly allocated block 0121 */ 0122 virtual void* allocate(XMLSize_t amount) = 0; 0123 0124 /** 0125 * Allocate a memory block of the requested size from the managed pool of DOM objects 0126 * 0127 * @param amount the size of the new memory block 0128 * @param type the type of the DOM object that will be stored in the block 0129 * 0130 * @return the pointer to the newly allocated block 0131 */ 0132 virtual void* allocate(XMLSize_t amount, DOMMemoryManager::NodeObjectType type) = 0; 0133 0134 /** 0135 * Release a DOM object and place its memory back in the pool 0136 * 0137 * @param object the pointer to the DOM node 0138 * @param type the type of the DOM object 0139 */ 0140 virtual void release(DOMNode* object, DOMMemoryManager::NodeObjectType type) = 0; 0141 0142 /** 0143 * Allocate a memory block from the mnaged pool and copy the provided string 0144 * 0145 * @param src the string to be copied 0146 * 0147 * @return the pointer to the newly allocated block 0148 */ 0149 virtual XMLCh* cloneString(const XMLCh *src) = 0; 0150 //@} 0151 0152 }; 0153 0154 XERCES_CPP_NAMESPACE_END 0155 0156 #endif 0157 0158 /** 0159 * End of file DOMMemoryManager.hpp 0160 */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |