FEI Package Browser (Single Doxygen Collection)
Version of the Day
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
base
fei_Pool_alloc.cpp
Go to the documentation of this file.
1
/*--------------------------------------------------------------------*/
2
/* Copyright 2005 Sandia Corporation. */
3
/* Under the terms of Contract DE-AC04-94AL85000, there is a */
4
/* non-exclusive license for use of this work by or on behalf */
5
/* of the U.S. Government. Export of this program may require */
6
/* a license from the United States Government. */
7
/*--------------------------------------------------------------------*/
8
9
#include "
fei_macros.hpp
"
10
11
#include "
fei_Pool_alloc.hpp
"
12
#include "
fei_Pool.hpp
"
13
14
#include <cstdlib>
15
#include <map>
16
17
struct
fei_map_holder
{
18
std::map<size_t,fei_Pool*>
fei_mem_pools
;
19
20
~fei_map_holder
()
21
{
22
std::map<size_t,fei_Pool*>::iterator
23
iter =
fei_mem_pools
.begin(),
24
iter_end =
fei_mem_pools
.end();
25
for
(; iter != iter_end; ++iter) {
26
delete
iter->second;
27
}
28
}
29
};
30
31
static
fei_map_holder
fmh
;
32
33
fei_Pool
*
get_fei_mem_pool
(
size_t
n)
34
{
35
std::map<size_t,fei_Pool*>::iterator
36
iter = fmh.
fei_mem_pools
.find(n);
37
38
if
(iter == fmh.
fei_mem_pools
.end()) {
39
fei_Pool
* new_pool =
new
fei_Pool
(n);
40
fmh.
fei_mem_pools
.insert(std::make_pair(n,new_pool));
41
return
(new_pool);
42
}
43
44
return
(iter->second);
45
}
46
fei_map_holder
Definition:
fei_Pool_alloc.cpp:17
fei_Pool_alloc.hpp
fei_map_holder::fei_mem_pools
std::map< size_t, fei_Pool * > fei_mem_pools
Definition:
fei_Pool_alloc.cpp:18
fei_map_holder::~fei_map_holder
~fei_map_holder()
Definition:
fei_Pool_alloc.cpp:20
get_fei_mem_pool
fei_Pool * get_fei_mem_pool(size_t n)
Definition:
fei_Pool_alloc.cpp:33
fei_Pool.hpp
fei_Pool
Definition:
fei_Pool.hpp:26
fei_macros.hpp
fmh
static fei_map_holder fmh
Definition:
fei_Pool_alloc.cpp:31
Generated by
1.8.5