aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate/libstate.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-08-13 15:13:21 +0000
committerlloyd <[email protected]>2010-08-13 15:13:21 +0000
commit3da3b04e1ba1577b3d0e1b4b9b3f4b24381fc433 (patch)
tree8a4b3a3b8e830ffcbd41f41859db4ab4fd972fb2 /src/libstate/libstate.h
parent2cae6ec17984ad016f973d5925860278e575b3f4 (diff)
parent789cee0888bbede838a2a3cf6221677c9f172872 (diff)
propagate from branch 'net.randombit.botan' (head 0a3348f52bf558bc2282e1066c2913a72a1aeda5)
to branch 'net.randombit.botan.c++0x' (head 552c20ae8874f12da779fc25ea368e36e71cbfe8)
Diffstat (limited to 'src/libstate/libstate.h')
-rw-r--r--src/libstate/libstate.h41
1 files changed, 15 insertions, 26 deletions
diff --git a/src/libstate/libstate.h b/src/libstate/libstate.h
index aa957c8c9..49908a1e3 100644
--- a/src/libstate/libstate.h
+++ b/src/libstate/libstate.h
@@ -13,16 +13,15 @@
#include <botan/algo_factory.h>
#include <botan/rng.h>
+#include <mutex>
#include <string>
#include <vector>
#include <map>
namespace Botan {
-class Mutex;
-
-/**
-* Global state container aka the buritto at the center of it all
+/*
+* Global State Container Base
*/
class BOTAN_DLL Library_State
{
@@ -30,10 +29,10 @@ class BOTAN_DLL Library_State
Library_State();
~Library_State();
- /**
- * @param thread_safe should a mutex be used for serialization
- */
- void initialize(bool thread_safe);
+ Library_State(const Library_State&) = delete;
+ Library_State& operator=(const Library_State&) = delete;
+
+ void initialize();
/**
* @return global Algorithm_Factory
@@ -49,7 +48,7 @@ class BOTAN_DLL Library_State
* @param name the name of the allocator
* @return allocator matching this name, or NULL
*/
- Allocator* get_allocator(const std::string& name = "") const;
+ Allocator* get_allocator(const std::string& name = "");
/**
* Add a new allocator to the list of available ones
@@ -70,7 +69,7 @@ class BOTAN_DLL Library_State
* @result the value of the parameter
*/
std::string get(const std::string& section,
- const std::string& key) const;
+ const std::string& key);
/**
* Check whether a certain parameter is set or not.
@@ -80,7 +79,7 @@ class BOTAN_DLL Library_State
* false otherwise
*/
bool is_set(const std::string& section,
- const std::string& key) const;
+ const std::string& key);
/**
* Set a configuration parameter.
@@ -109,30 +108,20 @@ class BOTAN_DLL Library_State
* @param alias the alias to resolve.
* @return what the alias stands for
*/
- std::string deref_alias(const std::string& alias) const;
-
- /**
- * @return newly created Mutex (free with delete)
- */
- Mutex* get_mutex() const;
+ std::string deref_alias(const std::string&);
private:
static RandomNumberGenerator* make_global_rng(Algorithm_Factory& af,
- Mutex* mutex);
+ std::mutex& mutex);
void load_default_config();
- Library_State(const Library_State&) {}
- Library_State& operator=(const Library_State&) { return (*this); }
-
- class Mutex_Factory* mutex_factory;
-
- Mutex* global_rng_lock;
+ std::mutex global_rng_lock;
RandomNumberGenerator* global_rng_ptr;
- Mutex* config_lock;
+ std::mutex config_lock;
std::map<std::string, std::string> config;
- Mutex* allocator_lock;
+ std::mutex allocator_lock;
std::string default_allocator_name;
std::map<std::string, Allocator*> alloc_factory;
mutable Allocator* cached_default_allocator;