I think I almost got it - just need to figure out how to inject
onCompletedInterval with the proper vars in macro.
macro gen_intervalize(onCompletedInterval)
return quote
if(isNextInterval(i.intervalState, time))
onCompletedInterval(getCurrentIntervalTime(i.intervalState), i.
currentValue)
# Set next interval.
shiftInterval!(i)
# Reset Value.
resetValue!(i)
end
# Increment current value.
incrementCurrentValue!(value)
end
end
function intervalize{T, V}(hi::HistoricalIntervalizer{T,V}, time::T, value::
V)
@gen_intervalize quote
minuteOfDay = (time / (60 * 1000))
hi.array[minuteOfDay + 1] = value
end
end
That's powerful.