This patch adds a total() function to the Vector2D
stat type. Similar to other stats such as Scalar or
Vector it is useful to be able to read the total for
a given stat.
{
public:
Vector2dInfoProxy(Stat &stat) : InfoProxy<Stat, Vector2dInfo>(stat) {}
+
+ Result total() const { return this->s.total(); }
};
struct StorageParams
#endif
}
+ /**
+ * Return a total of all entries in this vector.
+ * @return The total of all vector entries.
+ */
+ Result
+ total() const
+ {
+ Result total = 0.0;
+ for (off_type i = 0; i < size(); ++i)
+ total += data(i)->result();
+ return total;
+ }
+
void
prepare()
{
mutable VCounter cvec;
void enable();
+
+ virtual Result total() const = 0;
};
class FormulaInfo : public VectorInfo
}
VResult tot_vec(info.y);
- VResult super_total(1, 0.0);
for (off_type i = 0; i < info.x; ++i) {
if (havesub && (i >= info.subnames.size() || info.subnames[i].empty()))
continue;
yvec[j] = info.cvec[iy + j];
tot_vec[j] += yvec[j];
total += yvec[j];
- super_total[0] += yvec[j];
}
print.name = info.name + "_" +
print.name = info.name;
print.subnames = total_subname;
print.desc = info.desc;
- print.vec = super_total;
+ print.vec = VResult(1, info.total());
print.flags = print.flags & ~total;
print(*stream);
}