Botan  1.10.9
defalloc.h
Go to the documentation of this file.
1 /*
2 * Basic Allocators
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #ifndef BOTAN_BASIC_ALLOC_H__
9 #define BOTAN_BASIC_ALLOC_H__
10 
11 #include <botan/internal/mem_pool.h>
12 
13 namespace Botan {
14 
15 /**
16 * Allocator using malloc
17 */
19  {
20  public:
21  void* allocate(size_t);
22  void deallocate(void*, size_t);
23 
24  std::string type() const { return "malloc"; }
25  };
26 
27 /**
28 * Allocator using malloc plus locking
29 */
31  {
32  public:
33  /**
34  * @param mutex used for internal locking
35  */
37 
38  std::string type() const { return "locking"; }
39  private:
40  void* alloc_block(size_t);
41  void dealloc_block(void*, size_t);
42  };
43 
44 }
45 
46 #endif
std::string type() const
Definition: defalloc.h:24
void deallocate(void *, size_t)
Definition: defalloc.cpp:66
Locking_Allocator(Mutex *mutex)
Definition: defalloc.h:36
void * allocate(size_t)
Definition: defalloc.cpp:55
std::string type() const
Definition: defalloc.h:38