|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Streaming JSON writer for CA trajectories. More...
#include <ca-io.H>
Public Member Functions | |
| JSON_Frame_Stream_Writer (std::ostream &out, JSON_Write_Options opts={}) | |
| Start a JSON frame stream. | |
| JSON_Frame_Stream_Writer (const JSON_Frame_Stream_Writer &)=delete | |
| JSON_Frame_Stream_Writer & | operator= (const JSON_Frame_Stream_Writer &)=delete |
| ~JSON_Frame_Stream_Writer () | |
| Finish the JSON document if it is still open. | |
| template<typename Lattice > | |
| void | accept (std::size_t step, const Lattice &frame) |
| Append one frame to the stream. | |
| void | close () |
| Finish the stream. | |
Private Attributes | |
| std::ostream * | out_ = nullptr |
| bool | first_ = true |
| bool | closed_ = false |
| JSON_Write_Options | opts_ {} |
Streaming JSON writer for CA trajectories.
The writer emits one JSON object with a frames array. Each accepted frame contains its step and a full snapshot. The caller must call close() (or let the destructor run on an open stream that tolerates best-effort writes) to finish the JSON document.
|
inlineexplicit |
|
delete |
|
inline |
Finish the JSON document if it is still open.
Destructors must not throw; call close() explicitly when the caller needs to observe stream errors.
Definition at line 1576 of file ca-io.H.
References Aleph::and, and Aleph::blossom_maximum_cardinality_matching().
Append one frame to the stream.
| Lattice | 2D lattice type. |
| [in] | step | step index associated with the frame. |
| [in] | frame | lattice frame. |
| std::runtime_error | on stream write failure. |
Definition at line 1600 of file ca-io.H.
References ah_runtime_error_if, Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::JSON_Write_Options::pretty, and Aleph::CA::write_json().
|
inline |
|
delete |
|
private |
|
private |