Botan  1.11.15
Classes | Public Types | Public Member Functions | Static Public Member Functions
Botan::Algo_Registry< T > Class Template Reference

#include <algo_registry.h>

List of all members.

Classes

class  Add
struct  Algo_Info

Public Types

typedef std::function< T
*(const Spec &)> 
maker_fn
typedef T::Spec Spec

Public Member Functions

void add (const std::string &name, const std::string &provider, maker_fn fn, byte pref)
T * make (const Spec &spec, const std::string &provider="")
std::vector< std::string > providers_of (const Spec &spec)

Static Public Member Functions

static Algo_Registry< T > & global_registry ()

Detailed Description

template<typename T>
class Botan::Algo_Registry< T >

Definition at line 22 of file algo_registry.h.


Member Typedef Documentation

template<typename T>
typedef std::function<T* (const Spec&)> Botan::Algo_Registry< T >::maker_fn

Definition at line 27 of file algo_registry.h.

template<typename T>
typedef T::Spec Botan::Algo_Registry< T >::Spec

Definition at line 25 of file algo_registry.h.


Member Function Documentation

template<typename T>
void Botan::Algo_Registry< T >::add ( const std::string &  name,
const std::string &  provider,
maker_fn  fn,
byte  pref 
) [inline]

Definition at line 35 of file algo_registry.h.

         {
         std::unique_lock<std::mutex> lock(m_mutex);
         m_algo_info[name].add_provider(provider, fn, pref);
         }
template<typename T>
static Algo_Registry<T>& Botan::Algo_Registry< T >::global_registry ( ) [inline, static]

Definition at line 29 of file algo_registry.h.

Referenced by Botan::Algo_Registry< T >::Add::Add(), Botan::generate_rfc6979_nonce(), Botan::get_transform(), Botan::make_a(), and Botan::providers_of().

         {
         static Algo_Registry<T> g_registry;
         return g_registry;
         }
template<typename T>
T* Botan::Algo_Registry< T >::make ( const Spec spec,
const std::string &  provider = "" 
) [inline]

Definition at line 50 of file algo_registry.h.

References e.

Referenced by Botan::CBC_MAC::make(), Botan::HMAC::make(), Botan::CTR_BE::make(), Botan::OFB::make(), and Botan::CMAC::make().

         {
         maker_fn maker = find_maker(spec, provider);

         try
            {
            return maker(spec);
            }
         catch(std::exception& e)
            {
            throw std::runtime_error("Creating '" + spec.as_string() + "' failed: " + e.what());
            }
         }
template<typename T>
std::vector<std::string> Botan::Algo_Registry< T >::providers_of ( const Spec spec) [inline]

Definition at line 41 of file algo_registry.h.

         {
         std::unique_lock<std::mutex> lock(m_mutex);
         auto i = m_algo_info.find(spec.algo_name());
         if(i != m_algo_info.end())
            return i->second.providers();
         return std::vector<std::string>();
         }

The documentation for this class was generated from the following file: