aboutsummaryrefslogtreecommitdiffstats
path: root/src/algo_factory/algo_cache.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-06-17 21:48:55 +0000
committerlloyd <[email protected]>2010-06-17 21:48:55 +0000
commitc06b260b3328c5ce4be44c4f1a88feb55ee3dbc4 (patch)
tree41b05df5982b5b2e8a23b55972263d2172d6a9fd /src/algo_factory/algo_cache.h
parent0eecae9f21172c0a74ad62acaf77148c94a25be7 (diff)
parent3dde5683f69b9cb9f558bfb18087ce35fbbec78a (diff)
propagate from branch 'net.randombit.botan' (head 294e2082ce9231d6165276e2f2a4153a0116aca3)
to branch 'net.randombit.botan.c++0x' (head 0b695fad10f924601e07b009fcd781191fafcb28)
Diffstat (limited to 'src/algo_factory/algo_cache.h')
-rw-r--r--src/algo_factory/algo_cache.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/algo_factory/algo_cache.h b/src/algo_factory/algo_cache.h
index bafea45e9..45c64628d 100644
--- a/src/algo_factory/algo_cache.h
+++ b/src/algo_factory/algo_cache.h
@@ -30,11 +30,19 @@ template<typename T>
class Algorithm_Cache
{
public:
+ /**
+ * @param algo_spec names the requested algorithm
+ * @param pref_provider suggests a preferred provider
+ * @return prototype object, or NULL
+ */
const T* get(const std::string& algo_spec,
const std::string& pref_provider);
/**
* Add a new algorithm implementation to the cache
+ * @param algo the algorithm prototype object
+ * @param requested_name how this name will be requested
+ * @param provider_name is the name of the provider of this prototype
*/
void add(T* algo,
const std::string& requested_name,
@@ -42,15 +50,23 @@ class Algorithm_Cache
/**
* Set the preferred provider
+ * @param algo_spec names the algorithm
+ * @param provider names the preferred provider
*/
void set_preferred_provider(const std::string& algo_spec,
const std::string& provider);
/**
* Return the list of providers of this algorithm
+ * @param algo_name names the algorithm
+ * @return list of providers of this algorithm
*/
std::vector<std::string> providers_of(const std::string& algo_name);
+ /**
+ * Constructor
+ * @param m a mutex to serialize internal access
+ */
~Algorithm_Cache();
private:
typename std::map<std::string, std::map<std::string, T*> >::const_iterator
@@ -62,7 +78,7 @@ class Algorithm_Cache
std::map<std::string, std::map<std::string, T*> > algorithms;
};
-/**
+/*
* Look for an algorithm implementation in the cache, also checking aliases
* Assumes object lock is held
*/
@@ -84,7 +100,7 @@ Algorithm_Cache<T>::find_algorithm(const std::string& algo_spec)
return algo;
}
-/**
+/*
* Look for an algorithm implementation by a particular provider
*/
template<typename T>
@@ -132,7 +148,7 @@ const T* Algorithm_Cache<T>::get(const std::string& algo_spec,
return prototype;
}
-/**
+/*
* Add an implementation to the cache
*/
template<typename T>
@@ -155,7 +171,7 @@ void Algorithm_Cache<T>::add(T* algo,
}
}
-/**
+/*
* Find the providers of this algo (if any)
*/
template<typename T> std::vector<std::string>
@@ -180,7 +196,7 @@ Algorithm_Cache<T>::providers_of(const std::string& algo_name)
return providers;
}
-/**
+/*
* Set the preferred provider for an algorithm
*/
template<typename T>
@@ -192,7 +208,7 @@ void Algorithm_Cache<T>::set_preferred_provider(const std::string& algo_spec,
pref_providers[algo_spec] = provider;
}
-/**
+/*
* Algorithm_Cache<T> Destructor
*/
template<typename T>