00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one or more 00003 * contributor license agreements. See the NOTICE file distributed with 00004 * this work for additional information regarding copyright ownership. 00005 * The ASF licenses this file to You under the Apache License, Version 2.0 00006 * (the "License"); you may not use this file except in compliance with 00007 * the License. You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #if !defined(XERCESC_INCLUDE_GUARD_DOMMEMORYMANAGER_HPP) 00019 #define XERCESC_INCLUDE_GUARD_DOMMEMORYMANAGER_HPP 00020 00021 //------------------------------------------------------------------------------------ 00022 // Includes 00023 //------------------------------------------------------------------------------------ 00024 00025 XERCES_CPP_NAMESPACE_BEGIN 00026 00032 class CDOM_EXPORT DOMMemoryManager 00033 { 00034 protected: 00035 // ----------------------------------------------------------------------- 00036 // Hidden constructors 00037 // ----------------------------------------------------------------------- 00040 DOMMemoryManager() {}; 00042 00043 private: 00044 // ----------------------------------------------------------------------- 00045 // Unimplemented constructors and operators 00046 // ----------------------------------------------------------------------- 00049 DOMMemoryManager(const DOMMemoryManager &); 00050 DOMMemoryManager & operator = (const DOMMemoryManager &); 00052 00053 public: 00054 00055 // ----------------------------------------------------------------------- 00056 // All constructors are hidden, just the destructor is available 00057 // ----------------------------------------------------------------------- 00064 virtual ~DOMMemoryManager() {}; 00066 00067 // ----------------------------------------------------------------------- 00068 // data types 00069 // ----------------------------------------------------------------------- 00070 enum NodeObjectType { 00071 ATTR_OBJECT = 0, 00072 ATTR_NS_OBJECT = 1, 00073 CDATA_SECTION_OBJECT = 2, 00074 COMMENT_OBJECT = 3, 00075 DOCUMENT_FRAGMENT_OBJECT = 4, 00076 DOCUMENT_TYPE_OBJECT = 5, 00077 ELEMENT_OBJECT = 6, 00078 ELEMENT_NS_OBJECT = 7, 00079 ENTITY_OBJECT = 8, 00080 ENTITY_REFERENCE_OBJECT = 9, 00081 NOTATION_OBJECT = 10, 00082 PROCESSING_INSTRUCTION_OBJECT = 11, 00083 TEXT_OBJECT = 12 00084 }; 00085 00087 // ----------------------------------------------------------------------- 00088 // Getter methods 00089 // ----------------------------------------------------------------------- 00095 virtual XMLSize_t getMemoryAllocationBlockSize() const = 0; 00096 00098 00100 // ----------------------------------------------------------------------- 00101 // Setter methods 00102 // ----------------------------------------------------------------------- 00108 virtual void setMemoryAllocationBlockSize(XMLSize_t size) = 0; 00110 00112 // ----------------------------------------------------------------------- 00113 // Operations 00114 // ----------------------------------------------------------------------- 00122 virtual void* allocate(XMLSize_t amount) = 0; 00123 00132 virtual void* allocate(XMLSize_t amount, DOMMemoryManager::NodeObjectType type) = 0; 00133 00140 virtual void release(DOMNode* object, DOMMemoryManager::NodeObjectType type) = 0; 00141 00149 virtual XMLCh* cloneString(const XMLCh *src) = 0; 00151 00152 }; 00153 00154 XERCES_CPP_NAMESPACE_END 00155 00156 #endif 00157