Pluggable output (preliminary)
Some data is generated by (simulation) commands. Depending on the application
it needs to appear on the screen, in an array, in a file or should be forwarded
to another process. Sometimes it is just analysed on the fly, and acted upon.
Whichever way, this is implemented in OUTPUT plugins. Eventually adding another
file format or adding another application is decoupled from implementing yet
another simulation command.
An output plugin (usually) registers a command derived from OUTPUT_CMD with an
associated class derived from OUTPUT. OUTPUT carries a PROBE_LIST, a list of
those probes that are evaluated when producing output data.
In the traditional spice invocation
> print tran v(nodes)
"print" executes an OUTPUT_CMD. It collects the probes "v(nodes)" sticks it to
an OUTPUT object that implements printing and attaches the object to a command
registered as "tran". generally if `output` is an output command, and `sim` is
a simulation command, then the invocation
> output sim [.. probes ..]
creates the OUTPUT object associated with the "output" formatting and attaches
`sim` command. note that there is only one (static) instance per command.
An OUTPUT object may overload these virtual functions
OUTPUT::init(int level, std::string reason)
initialise, e.g. allocate space. level may be used to
control the granularity of the output, e.g. diagnostics.
OUTPUT::head(double l, double h, string s)
Prepare a page or file or window to fill with data. The
parameters l and h specify the range of the output axis
and its name, respectively.
OUTPUT::commit(double X, int level)
Collect or print data from the circuit, usually through
probes, if indicated by level. X is between l and h
passed to head, other values can be used to send
supplementary data, c.f. level.
OUTPUT::flush Postprocess data, or close file handle. Whatever is
needed to finalise.
The `sim` command then may call OUTPUT functions through
SIM::out_*(..).
SIM::out_set(CS&) setup I/O, redirection etc, as specified by the user
provided command.
SIM::out_init(TRACE) initialise. TRACE specifies how much diagnostics
to show, c.f. s__.h.
SIM::out_head specify the layout for the next page of data.
as in table head
SIM::out_commit trigger probe readings and output collection.
SIM::out_flush signal end of page, end of table, end of chunk.
SIM::out_reset I/O reset, low level.