#include "gtl_math_sum.h" namespace gtl { namespace math { sum::sum(gtl::analog_data *data) : analog_value(data) { _name = "sum"; } void sum::before_copying_data(std::vector::iterator begin, std::vector::iterator end) { _value -= std::accumulate(begin, end, 0.0); } void sum::after_copying_data(std::vector::iterator begin, std::vector::iterator end) { _value += std::accumulate(begin, end, 0.0); } void sum::data_changed() { //_value = std::accumulate(_ad->begin(), _ad->end(), _value); analog_value::data_changed(); // _value = std::accumulate(_data.begin(), _data.end(), 0.0); emit value_changed(); } } }