DOMMemoryManager.hpp
Go to the documentation of this file.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(XERCESC_INCLUDE_GUARD_DOMMEMORYMANAGER_HPP)
#define XERCESC_INCLUDE_GUARD_DOMMEMORYMANAGER_HPP
//------------------------------------------------------------------------------------
// Includes
//------------------------------------------------------------------------------------
XERCES_CPP_NAMESPACE_BEGIN
class CDOM_EXPORT DOMMemoryManager
{
protected:
// -----------------------------------------------------------------------
// Hidden constructors
// -----------------------------------------------------------------------
DOMMemoryManager() {};
private:
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
DOMMemoryManager(const DOMMemoryManager &);
DOMMemoryManager & operator = (const DOMMemoryManager &);
public:
// -----------------------------------------------------------------------
// All constructors are hidden, just the destructor is available
// -----------------------------------------------------------------------
virtual ~DOMMemoryManager() {};
// -----------------------------------------------------------------------
// data types
// -----------------------------------------------------------------------
enum NodeObjectType {
ATTR_OBJECT = 0,
ATTR_NS_OBJECT = 1,
CDATA_SECTION_OBJECT = 2,
COMMENT_OBJECT = 3,
DOCUMENT_FRAGMENT_OBJECT = 4,
DOCUMENT_TYPE_OBJECT = 5,
ELEMENT_OBJECT = 6,
ELEMENT_NS_OBJECT = 7,
ENTITY_OBJECT = 8,
ENTITY_REFERENCE_OBJECT = 9,
NOTATION_OBJECT = 10,
PROCESSING_INSTRUCTION_OBJECT = 11,
TEXT_OBJECT = 12
};
// -----------------------------------------------------------------------
// Getter methods
// -----------------------------------------------------------------------
virtual XMLSize_t getMemoryAllocationBlockSize() const = 0;
// -----------------------------------------------------------------------
// Setter methods
// -----------------------------------------------------------------------
virtual void setMemoryAllocationBlockSize(XMLSize_t size) = 0;
// -----------------------------------------------------------------------
// Operations
// -----------------------------------------------------------------------
virtual void* allocate(XMLSize_t amount) = 0;
virtual void* allocate(XMLSize_t amount, DOMMemoryManager::NodeObjectType type) = 0;
virtual void release(DOMNode* object, DOMMemoryManager::NodeObjectType type) = 0;
virtual XMLCh* cloneString(const XMLCh *src) = 0;
};
XERCES_CPP_NAMESPACE_END
#endif
CDOM_EXPORT
#define CDOM_EXPORT
Definition XercesDefs.hpp:166
XERCES_CPP_NAMESPACE_BEGIN
#define XERCES_CPP_NAMESPACE_BEGIN
Definition XercesDefs.hpp:112
XERCES_CPP_NAMESPACE_END
#define XERCES_CPP_NAMESPACE_END
Definition XercesDefs.hpp:113
XMLSize_t
size_t XMLSize_t
Definition Xerces_autoconf_config.hpp:112
XMLCh
char16_t XMLCh
Definition Xerces_autoconf_config.hpp:120
DOMMemoryManager
The DOMMemoryManager interface exposes the memory allocation-related functionalities of a DOMDocument...
Definition DOMMemoryManager.hpp:33
DOMMemoryManager::cloneString
virtual XMLCh * cloneString(const XMLCh *src)=0
Allocate a memory block from the mnaged pool and copy the provided string.
DOMMemoryManager::NodeObjectType
NodeObjectType
Definition DOMMemoryManager.hpp:70
DOMMemoryManager::ELEMENT_OBJECT
@ ELEMENT_OBJECT
Definition DOMMemoryManager.hpp:77
DOMMemoryManager::CDATA_SECTION_OBJECT
@ CDATA_SECTION_OBJECT
Definition DOMMemoryManager.hpp:73
DOMMemoryManager::NOTATION_OBJECT
@ NOTATION_OBJECT
Definition DOMMemoryManager.hpp:81
DOMMemoryManager::DOCUMENT_TYPE_OBJECT
@ DOCUMENT_TYPE_OBJECT
Definition DOMMemoryManager.hpp:76
DOMMemoryManager::ATTR_NS_OBJECT
@ ATTR_NS_OBJECT
Definition DOMMemoryManager.hpp:72
DOMMemoryManager::TEXT_OBJECT
@ TEXT_OBJECT
Definition DOMMemoryManager.hpp:83
DOMMemoryManager::PROCESSING_INSTRUCTION_OBJECT
@ PROCESSING_INSTRUCTION_OBJECT
Definition DOMMemoryManager.hpp:82
DOMMemoryManager::DOCUMENT_FRAGMENT_OBJECT
@ DOCUMENT_FRAGMENT_OBJECT
Definition DOMMemoryManager.hpp:75
DOMMemoryManager::ATTR_OBJECT
@ ATTR_OBJECT
Definition DOMMemoryManager.hpp:71
DOMMemoryManager::COMMENT_OBJECT
@ COMMENT_OBJECT
Definition DOMMemoryManager.hpp:74
DOMMemoryManager::ENTITY_REFERENCE_OBJECT
@ ENTITY_REFERENCE_OBJECT
Definition DOMMemoryManager.hpp:80
DOMMemoryManager::ENTITY_OBJECT
@ ENTITY_OBJECT
Definition DOMMemoryManager.hpp:79
DOMMemoryManager::ELEMENT_NS_OBJECT
@ ELEMENT_NS_OBJECT
Definition DOMMemoryManager.hpp:78
DOMMemoryManager::release
virtual void release(DOMNode *object, DOMMemoryManager::NodeObjectType type)=0
Release a DOM object and place its memory back in the pool.
DOMMemoryManager::~DOMMemoryManager
virtual ~DOMMemoryManager()
Destructor.
Definition DOMMemoryManager.hpp:64
DOMMemoryManager::allocate
virtual void * allocate(XMLSize_t amount)=0
Allocate a memory block of the requested size from the managed pool.
DOMMemoryManager::setMemoryAllocationBlockSize
virtual void setMemoryAllocationBlockSize(XMLSize_t size)=0
Set the size of the chunks of memory allocated by the memory manager.
DOMMemoryManager::DOMMemoryManager
DOMMemoryManager()
Definition DOMMemoryManager.hpp:40
DOMMemoryManager::allocate
virtual void * allocate(XMLSize_t amount, DOMMemoryManager::NodeObjectType type)=0
Allocate a memory block of the requested size from the managed pool of DOM objects.
DOMMemoryManager::getMemoryAllocationBlockSize
virtual XMLSize_t getMemoryAllocationBlockSize() const =0
Returns the size of the chunks of memory allocated by the memory manager.
DOMNode
The DOMNode interface is the primary datatype for the entire Document Object Model.
Definition DOMNode.hpp:139