From ff1e835d888a2783e59efc30fa125bfaf7d150fe Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 12 Nov 2008 18:11:50 +0000 Subject: Remove support for provider identifiers from SCAN_Name - it turns out this was not the right place to keep track of this information. Also modify all Algorithm_Factory constructor functions to take instead of a SCAN_Name a pair of std::strings - the SCAN name and an optional provider name. If a provider is specified, either that provider will be used or the request will fail. Otherwise, the library will attempt best effort, based on user-set algorithm implementation settings (combine with benchmark.h for choosing the fastest implementation at runtime) or if not set, a static ordering (preset in static_provider_weight in prov_weight.cpp, though it would be nice to make this easier to toggle). --- src/utils/scan_name.cpp | 14 ++------------ src/utils/scan_name.h | 28 +++------------------------- 2 files changed, 5 insertions(+), 37 deletions(-) (limited to 'src/utils') diff --git a/src/utils/scan_name.cpp b/src/utils/scan_name.cpp index f5a1a9245..c0e931e14 100644 --- a/src/utils/scan_name.cpp +++ b/src/utils/scan_name.cpp @@ -40,11 +40,9 @@ parse_and_deref_aliases(const std::string& algo_spec) } -SCAN_Name::SCAN_Name(const std::string& algo_spec, - const std::string& provider) +SCAN_Name::SCAN_Name(const std::string& algo_spec) { orig_algo_spec = algo_spec; - m_provider = provider; name = parse_and_deref_aliases(algo_spec); @@ -52,15 +50,7 @@ SCAN_Name::SCAN_Name(const std::string& algo_spec, throw Decoding_Error("Bad SCAN name " + algo_spec); } -SCAN_Name SCAN_Name::arg(u32bit i) const - { - if(i > arg_count()) - throw std::range_error("SCAN_Name::argument"); - - return SCAN_Name(name[i+1], m_provider); - } - -std::string SCAN_Name::arg_as_string(u32bit i) const +std::string SCAN_Name::arg(u32bit i) const { if(i > arg_count()) throw std::range_error("SCAN_Name::argument"); diff --git a/src/utils/scan_name.h b/src/utils/scan_name.h index b01411c94..4e391c37d 100644 --- a/src/utils/scan_name.h +++ b/src/utils/scan_name.h @@ -22,21 +22,14 @@ class SCAN_Name public: /** @param algo_spec A SCAN name - @param providers An optional provider name */ - SCAN_Name(const std::string& algo_spec, - const std::string& providers = ""); + SCAN_Name(const std::string& algo_spec); /** @return the original input string */ std::string as_string() const { return orig_algo_spec; } - /** - @return the provider name (or empty) - */ - std::string provider() const { return m_provider; } - /** @return the algorithm name */ @@ -47,15 +40,6 @@ class SCAN_Name */ u32bit arg_count() const { return name.size() - 1; } - /** - @param provider a provider name - @returns if this provider was allowed by the request - */ - bool provider_allowed(const std::string& provider) const - { - return (m_provider == "" || m_provider == provider); - } - /** @return if the number of arguments is between lower and upper */ @@ -66,13 +50,7 @@ class SCAN_Name @param i which argument @return the ith argument */ - std::string arg_as_string(u32bit i) const; - - /** - @param i which argument - @return the ith argument - */ - SCAN_Name arg(u32bit i) const; + std::string arg(u32bit i) const; /** @param i which argument @@ -80,7 +58,7 @@ class SCAN_Name */ u32bit arg_as_u32bit(u32bit i, u32bit def_value) const; private: - std::string orig_algo_spec, m_provider; + std::string orig_algo_spec; std::vector name; }; -- cgit v1.2.3