NGen
Loading...
Searching...
No Matches
utils::CatchmentOutputsMgr Class Referenceabstract

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).
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~CatchmentOutputsMgr()

virtual utils::CatchmentOutputsMgr::~CatchmentOutputsMgr ( )
virtualdefault

Member Function Documentation

◆ close()

virtual void utils::CatchmentOutputsMgr::close ( )
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.

◆ commit_writes()

virtual void utils::CatchmentOutputsMgr::commit_writes ( )
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.

◆ default_formulation_id()

static std::string utils::CatchmentOutputsMgr::default_formulation_id ( )
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().

◆ is_closed()

virtual bool utils::CatchmentOutputsMgr::is_closed ( )
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.

Returns
Whether this instance is closed.
See also
close

Implemented in utils::CatchmentCsvOutputMgr.

◆ receive_data_entry() [1/2]

virtual void utils::CatchmentOutputsMgr::receive_data_entry ( const std::string & catchment_id,
const time_marker & data_time_marker,
const std::vector< double > & values )
inlinevirtual

Receive a data entry for a catchment using the default formulation id.

See also
default_formulation_id

Reimplemented in utils::CatchmentCsvOutputMgr.

References default_formulation_id(), and receive_data_entry().

◆ receive_data_entry() [2/2]

virtual void utils::CatchmentOutputsMgr::receive_data_entry ( const std::string & formulation_id,
const std::string & catchment_id,
const time_marker & data_time_marker,
const std::vector< double > & values )
pure virtual

Receive a data entry for a catchment at a given simulation time, specifying the formulation id.

Parameters
formulation_idThe id of the formulation involved in producing this data.
catchment_idThe id for the catchment to which this data applies.
data_time_markerA marker for the current simulation time for the data.
valuesThe 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().


The documentation for this class was generated from the following file: