CVC3
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
include
memory_manager.h
Go to the documentation of this file.
1
/*****************************************************************************/
2
/*!
3
* \file memory_manager.h
4
*
5
* Author: Sergey Berezin
6
*
7
* Created: Thu Apr 3 16:47:14 2003
8
*
9
* <hr>
10
*
11
* License to use, copy, modify, sell and/or distribute this software
12
* and its documentation for any purpose is hereby granted without
13
* royalty, subject to the terms and conditions defined in the \ref
14
* LICENSE file provided with this distribution.
15
*
16
* <hr>
17
*
18
* Class MemoryManager: allocates/deallocates memory for objects of a
19
* requested size. Some instanced of this class may be specialized to
20
* a specific object size, and the actual memory may be allocated in
21
* big chunks, for efficiency.
22
*
23
* Typical use of this class is to create
24
* MemoryManager* mm = new MemoryManagerChunks(sizeof(YourClass));
25
* where YourClass has operators new and delete redefined:
26
* void* YourClass::operator new(size_t size, MemoryManager* mm)
27
* { return mm->newData(size); }
28
* void YourClass::delete(void*) { } // do not deallocate memory here
29
* Then, create objects with obj = new(mm) YourClass(), and destroy them with
30
* delete obj; mm->deleteData(obj);
31
*/
32
/*****************************************************************************/
33
34
#ifndef _cvc3__memory_manager_h
35
#define _cvc3__memory_manager_h
36
37
namespace
CVC3 {
38
39
class
MemoryManager
{
40
public
:
41
// Destructor
42
virtual
~MemoryManager
() { }
43
44
virtual
void
*
newData
(
size_t
size) = 0;
45
46
virtual
void
deleteData
(
void
* d) = 0;
47
};
// end of class MemoryManager
48
49
}
50
51
#endif
Generated on Thu May 16 2013 13:25:14 for CVC3 by
1.8.2