|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r73811 - sandbox/SOC/2011/checks/boost/checks
From: pierre.talbot.6114_at_[hidden]
Date: 2011-08-16 05:41:39
Author: trademark
Date: 2011-08-16 05:41:39 EDT (Tue, 16 Aug 2011)
New Revision: 73811
URL: http://svn.boost.org/trac/boost/changeset/73811
Log:
Modified the structure algorithm and inherited from weighted_sum_algorithm.
Text files modified:
sandbox/SOC/2011/checks/boost/checks/modulus10.hpp | 30 ++----------------------------
1 files changed, 2 insertions(+), 28 deletions(-)
Modified: sandbox/SOC/2011/checks/boost/checks/modulus10.hpp
==============================================================================
--- sandbox/SOC/2011/checks/boost/checks/modulus10.hpp (original)
+++ sandbox/SOC/2011/checks/boost/checks/modulus10.hpp 2011-08-16 05:41:39 EDT (Tue, 16 Aug 2011)
@@ -12,34 +12,14 @@
#include <boost/checks/traduction_exception.hpp>
#include <boost/checks/weight.hpp>
#include <boost/checks/iteration_sense.hpp>
-#include <boost/checks/basic_checks.hpp>
+#include <boost/checks/weighted_sum.hpp>
namespace boost{
namespace checks{
template <typename mod10_weight, typename iteration_sense, unsigned int number_of_virtual_value_skipped = 0>
-struct modulus10_algorithm
+struct modulus10_algorithm : boost::checks::weighted_sum_algorithm<mod10_weight, iteration_sense, number_of_virtual_value_skipped>
{
- typedef iteration_sense iteration_sense ;
-
- template <typename value>
- static int traduce_to_valid_value(const value ¤t_value, const unsigned int valid_value_counter )
- {
- int valid_value = 0;
- try{
- valid_value = boost::lexical_cast<int>( current_value ) ;
- }catch( boost::bad_lexical_cast ){
- throw boost::checks::traduction_exception() ;
- }
- return valid_value ;
- }
-
- static void operate_on_valid_value( const int current_valid_value, const unsigned int valid_value_counter, int &checksum )
- {
- int current_weight = mod10_weight::weight_associated_with_pos( valid_value_counter + number_of_virtual_value_skipped ) ;
- checksum += current_valid_value * current_weight ;
- }
-
static bool validate_checksum(int checksum)
{
return !(checksum % 10) ;
@@ -54,12 +34,6 @@
throw boost::checks::traduction_exception() ;
}
}
-
- template <typename check_range>
- struct checkdigit
- {
- typedef typename boost::range_value<check_range>::type type;
- };
};
}}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk