Output machinery, API a bit fragile
The current output machinery works, but is brittle in respect to small changes in unexpected code locations. This can become very problematic because error messages are not very helpful here (segmentation violation). Non-experts may easily get trapped. This will potentially require attention and maintenance resources we don't want to spend.
Here is why: A process can produce output by inheriting from a Writer
class that is derived from BaseOutput
, which provides a write
method. Thus, calling process::writer
will write to the output. However, all Writers
must be initialized by a state-machine object OutputManager
. The OutputManager handles start/end of libraries as well as of individual showers by initiating and managing output sinks, flushing data, keeping shower the counter, etc. Thus, a Writer
(which typically will be a process
) must be added to the manager with a call like OutputManger::add("id_string", ...writer...)
. An additional complexity (just making things more indirect and unclear) is SubWriter
which can be used to cut the direct tie between Writer and Process (so that multiple processes can write to the same Writer). And lastly, processes can also be configured to not produce output using the WriterOff
output sink.
This all works, but if any call in a program is at the wrong place or missing (e.g. the OutputManger::add
, or OutputManager::startLibrary
etc.) then the typical outcome is that a process will try to write into uninitialized data/sinks, which will just crash. There are no error messages etc.
With more and more output types produced by corsika this will become more and more difficult to manage.