This seems like a fundamental that I've completely forgotten from comp sci 20 years ago.
How would I link/trigger an object function from another object. Or what is the name of the concept I'm trying to find? (c++ if it matters)
My example is I have a sensor which has accumulators. The accumulators have an array of time interval readings. They accumulate values until their interval is complete and add that to the readings array.
I wanted to make the accumulators flexible, different intervals, timeframes, or the amount of accumulators for each sensor. Eg. 1 hour with 1 min intervals, 1 day with hourly...
I have a class for the Sensor, and Accumulator. But how do I declare multiple accumulators and allow smaller timeframe readings to bubble up to the next higher readings?
==========================
To add a more concrete example because I'm struggling to explain clearly...
Example function in sensor class: Sensor.addAccumulator(timeframe, interval)
So first timeframe could be a 1 hour timeframe and 1 min interval. Then another accumulator added with a 24 hour timeframe and 30 min interval. Next 1 week with 12 hour interval.
The sensor would has a function to get the current reading then gives it to accumulator to process.
But when 1 min of data was accumulated, how can I give that to the next higher timeframe?
I could just give the readings to every accumulator but the calculations become redundant and it's on a microcontroller.
=========
If I had a high powered device I'd dump the values in a time series database with data retention policies that downsample older data.