CVC3
2.4.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
include
memory_manager_malloc.h
Go to the documentation of this file.
1
/*****************************************************************************/
2
/*!
3
* \file memory_manager_malloc.h
4
*
5
* Author: Sergey Berezin
6
*
7
* Created: Tue Apr 19 14:30:36 2005
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 MemoryManagerMalloc: default implementation of MemoryManager
19
* using malloc().
20
*
21
* Typical use of this class is to create
22
* MemoryManager* mm = new MemoryManager(sizeof(YourClass));
23
* where YourClass has operators new and delete redefined:
24
* void* YourClass::operator new(size_t, MemoryManager* mm)
25
* { return mm->newData(); }
26
* void YourClass::delete(void*) { } // do not deallocate memory here
27
* Then, create objects with obj = new(mm) YourClass(), and destroy them with
28
* delete obj; mm->deleteData(obj);
29
*/
30
/*****************************************************************************/
31
32
#ifndef _cvc3__memory_manager_malloc_h
33
#define _cvc3__memory_manager_malloc_h
34
35
#include "
memory_manager.h
"
36
37
namespace
CVC3 {
38
39
class
MemoryManagerMalloc
:
public
MemoryManager
{
40
public
:
41
// Constructor
42
MemoryManagerMalloc
() { }
43
// Destructor
44
~MemoryManagerMalloc
() { }
45
46
void
*
newData
(
size_t
size) {
47
return
malloc(size);
48
}
49
50
void
deleteData
(
void
* d) {
51
free(d);
52
}
53
};
// end of class MemoryManager
54
55
}
56
57
#endif
CVC3::MemoryManagerMalloc
Definition:
memory_manager_malloc.h:39
CVC3::MemoryManagerMalloc::newData
void * newData(size_t size)
Definition:
memory_manager_malloc.h:46
CVC3::MemoryManagerMalloc::deleteData
void deleteData(void *d)
Definition:
memory_manager_malloc.h:50
memory_manager.h
CVC3::MemoryManagerMalloc::MemoryManagerMalloc
MemoryManagerMalloc()
Definition:
memory_manager_malloc.h:42
CVC3::MemoryManager
Definition:
memory_manager.h:39
CVC3::MemoryManagerMalloc::~MemoryManagerMalloc
~MemoryManagerMalloc()
Definition:
memory_manager_malloc.h:44
Generated on Wed Aug 27 2014 16:11:36 for CVC3 by
1.8.7