I've inherited a project that has two output modes, console and plain-text file. The project uses Ada.Text_IO.SET_OUTPUT to select one or the other.
I want to create a third SET_OUTPUT option, one that can easily re-direct output to a variety of formats other than stdout or a disk file. I'd like the output to be some sort of in-RAM object or "file" so that it can be quickly read by multiple clients. I also need to keep the code portable, so ideally the solution would stick to the standard libraries.
I've tried instantiations of Sequential_IO, but the code base is too large and inconsistent (wrt overloadings and renamings of Text_IO's procedures and whether Text_IO is called by full dot notation) to quickly and reliably replace calls.
I must be uncreative (and I'm certainly new to Ada), but the solution I keep coming to seems overly complex and convoluted--creating a container of Text_IO's File_Type in a memory pool managed at a low level; then SET_OUTPUT to that in-RAM file, from where it can be pushed or pulled to clients.
I hope I'm missing something, and that someone can help me find an simpler way. Thanks in advance.