Forecast(), set_history() or set_output_multiple()

Hi everybody,

I’m working on building a block which processes samples in chunks: if
the energy of each chunk is greater than a given threshold, the chunk is
reported in output. Moreover for each chunk reported in output, the N
preceding chunks should be reported in output as well.

How can I manage this last requirement? Which is the best function to be
used for this purpose( forecast(), set_history(), set_output_multiple()
or others) and how can I set it?

Thanks in advance.