diff options
author | lloyd <[email protected]> | 2006-06-25 09:07:11 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-06-25 09:07:11 +0000 |
commit | 97529e8854a2e89bc839e013efd2b9b05479c148 (patch) | |
tree | b21d973df70c7734779904e5f8772a7f449f1356 /include | |
parent | abdd958c0f4b1d880feec5e79230219005e43670 (diff) |
Have allocator objects 'know' their own names, rather than keeping them
around as ancillary strings.
Diffstat (limited to 'include')
-rw-r--r-- | include/allocate.h | 2 | ||||
-rw-r--r-- | include/defalloc.h | 2 | ||||
-rw-r--r-- | include/libstate.h | 2 | ||||
-rw-r--r-- | include/modules.h | 3 |
4 files changed, 6 insertions, 3 deletions
diff --git a/include/allocate.h b/include/allocate.h index a3f59cf1b..d30e4e0bc 100644 --- a/include/allocate.h +++ b/include/allocate.h @@ -20,6 +20,8 @@ class Allocator virtual void* allocate(u32bit) = 0; virtual void deallocate(void*, u32bit) = 0; + virtual std::string type() const = 0; + virtual void init() {} virtual void destroy() {} diff --git a/include/defalloc.h b/include/defalloc.h index ef675d3a8..eb6fd9871 100644 --- a/include/defalloc.h +++ b/include/defalloc.h @@ -17,6 +17,7 @@ class Malloc_Allocator : public Pooling_Allocator { public: Malloc_Allocator() : Pooling_Allocator(64*1024, false) {} + std::string type() const { return "malloc"; } private: void* alloc_block(u32bit); void dealloc_block(void*, u32bit); @@ -29,6 +30,7 @@ class Locking_Allocator : public Pooling_Allocator { public: Locking_Allocator() : Pooling_Allocator(64*1024, true) {} + std::string type() const { return "locking"; } private: void* alloc_block(u32bit); void dealloc_block(void*, u32bit); diff --git a/include/libstate.h b/include/libstate.h index 531824670..d242e5967 100644 --- a/include/libstate.h +++ b/include/libstate.h @@ -31,7 +31,7 @@ class Library_State friend class Engine_Iterator; Allocator* get_allocator(const std::string& = "") const; - void add_allocator(const std::string&, Allocator*); + void add_allocator(Allocator*); void set_prng(RandomNumberGenerator*); void randomize(byte[], u32bit); diff --git a/include/modules.h b/include/modules.h index 499782c69..e09c18e9b 100644 --- a/include/modules.h +++ b/include/modules.h @@ -8,7 +8,6 @@ #include <vector> #include <string> -#include <map> namespace Botan { @@ -30,7 +29,7 @@ class Mutex_Factory* get_mutex_factory(); class Timer* get_timer(); std::vector<EntropySource*> get_entropy_sources(); std::vector<Engine*> get_engines(); -std::map<std::string, Allocator*> get_allocators(); +std::vector<Allocator*> get_allocators(); } |