26 #ifndef CRYPTO3_ACCUMULATORS_PUBKEY_SSS_DEAL_SHARES_HPP
27 #define CRYPTO3_ACCUMULATORS_PUBKEY_SSS_DEAL_SHARES_HPP
35 #include <boost/concept_check.hpp>
37 #include <boost/accumulators/framework/accumulator_base.hpp>
38 #include <boost/accumulators/framework/parameters/sample.hpp>
54 namespace accumulators {
56 template<
typename ProcessingMode,
typename =
void>
59 template<
typename ProcessingMode>
63 typedef typename processing_mode_type::scheme_type
scheme_type;
64 typedef typename processing_mode_type::op_type
op_type;
68 typedef typename processing_mode_type::result_type
result_type;
75 template<
typename Args>
77 seen_coeffs(0), n(args[boost::accumulators::sample]),
78 t(args[
nil::crypto3::accumulators::threshold_value]) {
81 processing_mode_type::init_accumulator(
82 acc, n, t, args[nil::crypto3::accumulators::weights]);
84 processing_mode_type::init_accumulator(acc, n, t);
89 assert(t == seen_coeffs);
91 return processing_mode_type::process(acc);
98 template<
typename Args>
100 resolve_type(args[boost::accumulators::sample],
101 args[::nil::crypto3::accumulators::iterator_last |
nullptr]);
105 inline void resolve_type(
const typename scheme_type::coeff_type &coeff,
106 std::nullptr_t =
nullptr) {
107 if (t == seen_coeffs) {
111 processing_mode_type::update(acc, seen_coeffs, coeff);
115 template<
typename InputRange>
117 for (
const auto &c : range) {
122 template<
typename InputIterator>
124 for (
auto it = first; it != last; it++) {
245 template<
typename ProcessingMode>
252 typedef boost::mpl::always<accumulators::impl::deal_shares_impl<mode_type>>
impl;
257 template<
typename ProcessingMode,
typename AccumulatorSet>
258 typename boost::mpl::apply<AccumulatorSet, tag::deal_shares<ProcessingMode>>::type::result_type
260 return boost::accumulators::extract_result<tag::deal_shares<ProcessingMode>>(acc);
std::size_t n
Definition: accumulators/deal_shares.hpp:129
void resolve_type(const InputRange &range, std::nullptr_t)
Definition: accumulators/deal_shares.hpp:116
ProcessingMode processing_mode_type
Definition: accumulators/deal_shares.hpp:62
deal_shares_impl(const Args &args)
Definition: accumulators/deal_shares.hpp:76
void operator()(const Args &args)
Definition: accumulators/deal_shares.hpp:99
std::size_t t
Definition: accumulators/deal_shares.hpp:130
std::size_t seen_coeffs
Definition: accumulators/deal_shares.hpp:131
processing_mode_type::internal_accumulator_type internal_accumulator_type
Definition: accumulators/deal_shares.hpp:65
void resolve_type(const typename scheme_type::coeff_type &coeff, std::nullptr_t=nullptr)
Definition: accumulators/deal_shares.hpp:105
processing_mode_type::op_type op_type
Definition: accumulators/deal_shares.hpp:64
internal_accumulator_type acc
Definition: accumulators/deal_shares.hpp:132
processing_mode_type::scheme_type scheme_type
Definition: accumulators/deal_shares.hpp:63
processing_mode_type::result_type result_type
Definition: accumulators/deal_shares.hpp:68
void resolve_type(InputIterator first, InputIterator last)
Definition: accumulators/deal_shares.hpp:123
result_type result(boost::accumulators::dont_care) const
Definition: accumulators/deal_shares.hpp:88
Definition: accumulators/deal_shares.hpp:57
Definition: accumulators/deal_shares.hpp:246
boost::mpl::always< accumulators::impl::deal_shares_impl< mode_type > > impl
Definition: accumulators/deal_shares.hpp:252
ProcessingMode mode_type
Definition: accumulators/deal_shares.hpp:247
Definition: weighted_shamir.hpp:35