|
NGen
|
Abstract class for managing and writing to catchment data files. More...
#include <CatchmentOutputsMgr.hpp>
Inheritance diagram for utils::CatchmentOutputsMgr:
Collaboration diagram for utils::CatchmentOutputsMgr:Public Member Functions | |
| virtual void | receive_data_entry (const std::string &formulation_id, const std::string &catchment_id, const time_marker &data_time_marker, const std::vector< double > &values)=0 |
| Receive a data entry for a catchment at a given simulation time, specifying the formulation id. | |
| virtual void | receive_data_entry (const std::string &catchment_id, const time_marker &data_time_marker, const std::vector< double > &values) |
| Receive a data entry for a catchment using the default formulation id. | |
| virtual void | commit_writes ()=0 |
| Flush any data buffered since the last commit out to the underlying sink. | |
| virtual void | close ()=0 |
| Close down this manager: commit everything received, finalize the output, and close files. | |
| virtual bool | is_closed ()=0 |
| A test of whether this instance is closed. | |
| virtual | ~CatchmentOutputsMgr ()=default |
Static Public Member Functions | |
| static std::string | default_formulation_id () |
| The formulation id used when a caller omits one (the common single-formulation case). | |
Abstract class for managing and writing to catchment data files.
The set of catchments a manager handles, and their output schema, is fixed at construction (see the concrete backend's constructor and FeatureDescriptor); this class is the data sink for that fixed set.
|
virtualdefault |
|
pure virtual |
Close down this manager: commit everything received, finalize the output, and close files.
The expected shape is close() == commit_writes (flush all received data) followed by finalizing and closing the sink, so callers never need a separate commit_writes() before close(). commit_writes() remains available for mid-run flushes.
close() is the point at which a commit/finalize failure is reported, so it may throw; call it explicitly if you need to observe such errors. A backend's destructor should still call close() as a best-effort backstop, but must never let an exception escape the destructor.
Once closed, a manager cannot receive new data; subsequent receive_data_entry calls should throw. close() is idempotent – calling it on an already-closed instance returns.
Implemented in utils::CatchmentCsvOutputMgr.
|
pure virtual |
Flush any data buffered since the last commit out to the underlying sink.
A backend that writes eagerly (relying on its own stream buffering) may do little here beyond a flush; one that batches writes accumulated entries now. This is an optional mid-run durability checkpoint – close performs a final commit regardless.
Implemented in utils::CatchmentCsvOutputMgr.
|
inlinestatic |
The formulation id used when a caller omits one (the common single-formulation case).
Carrying a formulation id lets a simulation run independent formulation setups over the same catchment without their output colliding; backends may organize output by formulation (e.g. a per-formulation file or subdirectory).
Referenced by utils::CatchmentCsvOutputMgr::output_path(), and receive_data_entry().
|
pure virtual |
A test of whether this instance is closed.
Mirrors the sibling NexusOutputsMgr interface, where backends use it as a guard against writing after close; kept here for parity across the two hierarchies.
Implemented in utils::CatchmentCsvOutputMgr.
|
inlinevirtual |
Receive a data entry for a catchment using the default formulation id.
Reimplemented in utils::CatchmentCsvOutputMgr.
References default_formulation_id(), and receive_data_entry().
|
pure virtual |
Receive a data entry for a catchment at a given simulation time, specifying the formulation id.
| formulation_id | The id of the formulation involved in producing this data. |
| catchment_id | The id for the catchment to which this data applies. |
| data_time_marker | A marker for the current simulation time for the data. |
| values | The catchment's output values for this time, positionally aligned with the columns the manager was constructed with. Values cross this boundary as typed doubles for the backend to serialize as it sees fit – no string formatting or parsing. |
Implemented in utils::CatchmentCsvOutputMgr.
Referenced by receive_data_entry(), ngen::DomainLayer::update_models(), and ngen::Layer::update_models().