Commit abe00120 authored by Committed by Arjen HiemstraBrowse files
Add support for an iterator based aggregate function in AggregateSensor
While working on this [mr](ksystemstats!21) I ended up needing a way to compute the average of the sensor values inside AggregateSensor. The solution I ended up with (hoping I haven't over-engineered it) is to add support to a new kind of aggregate function that gives the user an iterator (technically two, begin and end) over the sensor values that gives him more flexibility respect the old method. Note that this solution is a superset of the previous one, that, in fact, can still be used if needed (this mr simply add a wrapper around the old kind of aggregate functions in order to make them compatible with the new ones). A good portion of code in this merge request is due to need of separating the implementation of the iterator (PrivateIterator) from the interface given to the user (SensorIterator) in the same way that AggregateSensor is different from Private. NOTE: this mr technically breaks the compatibility with the codes that uses aggregateFunction() (the getter) because now this function return the new kind of aggregate function (and the signature). Not knowing if this function was used actually anywhere and disliking the idea of keeping the old behavior (because now that old aggregate function can be null if the new one is used) I changed the code this way, but I can easily revert it by also keeping track of the old type of aggregate function if this is needed.