Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73814 - sandbox/SOC/2011/checks/boost/checks
From: pierre.talbot.6114_at_[hidden]
Date: 2011-08-16 05:42:53


Author: trademark
Date: 2011-08-16 05:42:52 EDT (Tue, 16 Aug 2011)
New Revision: 73814
URL: http://svn.boost.org/trac/boost/changeset/73814

Log:
A basic and generic structure algorithm for the weighted sum algorithm.
Added:
   sandbox/SOC/2011/checks/boost/checks/weighted_sum.hpp (contents, props changed)

Added: sandbox/SOC/2011/checks/boost/checks/weighted_sum.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2011/checks/boost/checks/weighted_sum.hpp 2011-08-16 05:42:52 EDT (Tue, 16 Aug 2011)
@@ -0,0 +1,30 @@
+// Boost checks/weighted_sum.hpp header file ------------------------------------//
+// (C) Copyright Pierre Talbot 2011
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#ifndef BOOST_CHECKS_WEIGHTED_SUM_HPP
+#define BOOST_CHECKS_WEIGHTED_SUM_HPP
+
+#include <boost/checks/weight.hpp>
+#include <boost/checks/iteration_sense.hpp>
+#include <boost/checks/basic_check_algorithm.hpp>
+
+namespace boost{
+ namespace checks{
+
+template <typename weight, typename iteration_sense, unsigned int number_of_virtual_value_skipped = 0>
+struct weighted_sum_algorithm : boost::checks::basic_check_algorithm< iteration_sense >
+{
+ static void operate_on_valid_value( const int current_valid_value, const unsigned int valid_value_counter, int &checksum )
+ {
+ int current_weight = weight::weight_associated_with_pos( valid_value_counter + number_of_virtual_value_skipped ) ;
+ checksum += current_valid_value * current_weight ;
+ }
+};
+
+}}
+
+#endif //BOOST_CHECKS_MOD10_HPP
\ No newline at end of file


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