OPAL (Object Oriented Parallel Accelerator Library)
2.2.0
OPAL
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
ippl
src
Utility
Pooled.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
/***************************************************************************
3
*
4
* The IPPL Framework
5
*
6
*
7
* Visit http://people.web.psi.ch/adelmann/ for more details
8
*
9
***************************************************************************/
10
11
#ifndef POOLED_H
12
#define POOLED_H
13
14
// include files
15
#include "
Utility/Pool.h
"
16
18
19
template
<
class
T>
20
class
Pooled
21
{
22
public
:
23
#ifndef IPPL_DONT_POOL
24
public
:
25
26
// Here is the reason for the class:
27
// Defining new and delete for the classes that inherit from it.
28
29
// Get some memory from the pool.
30
inline
void
*
operator
new
(size_t) {
return
MyPool
.
alloc
(); }
31
32
// Move a piece of memory back to the pool.
33
inline
void
operator
delete
(
void
*p, size_t) {
if
(p)
MyPool
.
free
(p); }
34
35
private
:
36
37
static
Pool
MyPool
;
// Storage for objects of type T
38
#endif
39
};
40
42
43
#include "
Utility/Pooled.hpp
"
44
45
#endif // POOLED_H
46
47
/***************************************************************************
48
* $RCSfile: Pooled.h,v $ $Author: adelmann $
49
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
50
* IPPL_VERSION_ID: $Id: Pooled.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
51
***************************************************************************/
Pool
Definition:
Pool.h:18
Pooled::MyPool
static Pool MyPool
Definition:
Pooled.h:37
Pooled.hpp
Pool.h
Pool::free
void free(void *b)
Definition:
Pool.h:72
Pool::alloc
void * alloc()
Definition:
Pool.h:54
Pooled
Definition:
Pooled.h:20
Generated on Sat Jan 4 2020 14:47:40 for OPAL (Object Oriented Parallel Accelerator Library) by
1.8.5