Ideally, the IBLT class should be templated with the abstract Adder class. The Adder class should have two concrete classes of which one is a regular decimal adder (considered default) and another one is the modular adder that works for multisets. DecimalAdder and ModularAdder should be very simple classes that only use operator+.
What is the issue with the current implementation?
It doubles a lot of code and needs complete separate implementations of the sync protocol for IBLT and IBLTMultiset.
Other issues:
void Communicant::commSend(const IBLTMultiset &iblt, bool sync) is superfluous. If IBLTMultiset inherits from IBLT then why wouldn't IBLT version of commSend work for IBLTMultiset too?
_insertModular accepts 1 or -1 and does addition and subtraction. That is not a good idea as the function does not return anything and all the positive and negative integers will pass arguments type checking thus making troubles in runtime.
Ideally, the IBLT class should be templated with the abstract
Adder
class. TheAdder
class should have two concrete classes of which one is a regular decimal adder (considered default) and another one is the modular adder that works for multisets.DecimalAdder
andModularAdder
should be very simple classes that only useoperator+
.What is the issue with the current implementation?
IBLT
andIBLTMultiset
.Other issues:
void Communicant::commSend(const IBLTMultiset &iblt, bool sync)
is superfluous. IfIBLTMultiset
inherits fromIBLT
then why wouldn'tIBLT
version ofcommSend
work forIBLTMultiset
too?_insertModular
accepts1
or-1
and does addition and subtraction. That is not a good idea as the function does not return anything and all the positive and negative integers will pass arguments type checking thus making troubles in runtime.