source: NonGTP/Xerces/xerces/include/xercesc/framework/MemoryManager.hpp @ 358

Revision 358, 3.1 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1/*
2 * Copyright 2003,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 /*
18  * $Log: MemoryManager.hpp,v $
19  * Revision 1.3  2004/09/08 13:55:57  peiyongz
20  * Apache License Version 2.0
21  *
22  * Revision 1.2  2003/04/27 17:17:01  jberry
23  * Add include for stdlib to pull in size_t declaration
24  *
25  * Revision 1.1  2003/04/21 15:47:45  knoaman
26  * Initial check-in.
27  *
28  */
29
30
31#if !defined(MEMORYMANAGER_HPP)
32#define MEMORYMANAGER_HPP
33
34#include <xercesc/util/XercesDefs.hpp>
35#include <stdlib.h>
36
37
38XERCES_CPP_NAMESPACE_BEGIN
39
40
41/**
42 *  Configurable memory manager
43 *
44 *  <p>This interface allows outside applications to plug in their own memory
45 *  manager to be used by Xerces for memory allocation/deallocation.</p>
46 */
47class XMLPARSER_EXPORT MemoryManager
48{
49public:
50    // -----------------------------------------------------------------------
51    //  Constructors are hidden, only the virtual destructor is exposed
52    // -----------------------------------------------------------------------
53
54    /** @name Destructor */
55    //@{
56
57    /**
58      * Default destructor
59      */
60    virtual ~MemoryManager()
61    {
62    }
63    //@}
64
65
66    // -----------------------------------------------------------------------
67    //  The virtual memory manager interface
68    // -----------------------------------------------------------------------
69    /** @name The pure virtual methods in this interface. */
70    //@{
71
72    /**
73      * This method allocates requested memory.
74      *
75      * @param size The requested memory size
76      *
77      * @return A pointer to the allocated memory
78      */
79    virtual void* allocate(size_t size) = 0;
80
81    /**
82      * This method deallocates memory
83      *
84      * @param p The pointer to the allocated memory to be deleted
85      */
86    virtual void deallocate(void* p) = 0;
87
88    //@}
89
90
91protected :
92    // -----------------------------------------------------------------------
93    //  Hidden Constructors
94    // -----------------------------------------------------------------------
95    /** @name Constructor */
96    //@{
97
98    /**
99      * Protected default constructor
100      */
101    MemoryManager()
102    {
103    }
104    //@}
105
106
107
108private:
109    // -----------------------------------------------------------------------
110    //  Unimplemented constructors and operators
111    // -----------------------------------------------------------------------
112    MemoryManager(const MemoryManager&);
113    MemoryManager& operator=(const MemoryManager&);
114};
115
116XERCES_CPP_NAMESPACE_END
117
118#endif
Note: See TracBrowser for help on using the repository browser.