|
||||
File indexing completed on 2025-01-18 10:14:52
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 /* 0019 * $Id$ 0020 */ 0021 0022 0023 #if !defined(XERCESC_INCLUDE_GUARD_MEMORYMANAGER_HPP) 0024 #define XERCESC_INCLUDE_GUARD_MEMORYMANAGER_HPP 0025 0026 #include <xercesc/util/XercesDefs.hpp> 0027 #include <stdlib.h> 0028 0029 0030 XERCES_CPP_NAMESPACE_BEGIN 0031 0032 0033 /** 0034 * Configurable memory manager 0035 * 0036 * <p>This interface allows outside applications to plug in their own memory 0037 * manager to be used by Xerces for memory allocation/deallocation.</p> 0038 */ 0039 class XMLPARSER_EXPORT MemoryManager 0040 { 0041 public: 0042 // ----------------------------------------------------------------------- 0043 // Constructors are hidden, only the virtual destructor is exposed 0044 // ----------------------------------------------------------------------- 0045 0046 /** @name Destructor */ 0047 //@{ 0048 0049 /** 0050 * Default destructor 0051 */ 0052 virtual ~MemoryManager() 0053 { 0054 } 0055 //@} 0056 0057 0058 /** 0059 * This method is called to obtain the memory manager that should be 0060 * used to allocate memory used in exceptions. If the same memory 0061 * manager can be used, simply return 'this' from this function. 0062 * Note, however, that if there is a possibility that an exception 0063 * thrown can outlive the memory manager (for example, because the 0064 * memory manager object is allocated on the stack or is managed by 0065 * a stack-bound object), it is recommended that you return 0066 * XMLPlatformUtils::fgMemoryManager. 0067 * 0068 * @return A pointer to the memory manager 0069 */ 0070 virtual MemoryManager* getExceptionMemoryManager() = 0; 0071 0072 0073 // ----------------------------------------------------------------------- 0074 // The virtual memory manager interface 0075 // ----------------------------------------------------------------------- 0076 /** @name The pure virtual methods in this interface. */ 0077 //@{ 0078 0079 /** 0080 * This method allocates requested memory. 0081 * 0082 * @param size The requested memory size 0083 * 0084 * @return A pointer to the allocated memory 0085 */ 0086 virtual void* allocate(XMLSize_t size) = 0; 0087 0088 /** 0089 * This method deallocates memory 0090 * 0091 * @param p The pointer to the allocated memory to be deleted 0092 */ 0093 virtual void deallocate(void* p) = 0; 0094 0095 //@} 0096 0097 0098 protected : 0099 // ----------------------------------------------------------------------- 0100 // Hidden Constructors 0101 // ----------------------------------------------------------------------- 0102 /** @name Constructor */ 0103 //@{ 0104 0105 /** 0106 * Protected default constructor 0107 */ 0108 MemoryManager() 0109 { 0110 } 0111 //@} 0112 0113 0114 0115 private: 0116 // ----------------------------------------------------------------------- 0117 // Unimplemented constructors and operators 0118 // ----------------------------------------------------------------------- 0119 MemoryManager(const MemoryManager&); 0120 MemoryManager& operator=(const MemoryManager&); 0121 }; 0122 0123 XERCES_CPP_NAMESPACE_END 0124 0125 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |