FEI Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
18  std::map<size_t,fei_Pool*> fei_mem_pools;
19 
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 
32 
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 
std::map< size_t, fei_Pool * > fei_mem_pools
fei_Pool * get_fei_mem_pool(size_t n)
static fei_map_holder fmh