Class base_sink

Inheritance Relationships

Base Type

Derived Types

Class Documentation

class base_sink : public rcppsw::er::client<base_sink>

Base class that uses the template design pattern to provide hooks for derived classes so that the process of writing out collected metrics is centralized in one place (here).

Metrics are written out in .csv format at whatever frequency derived classes choose.

Subclassed by rcppsw::metrics::file_sink, rcppsw::metrics::network_sink

Public Functions

base_sink(const rmetrics::output_mode &mode, const rtypes::timestep &interval)
Parameters:
  • mode – The output mode. See output_mode for possible values.

  • interval – Metric output interval.

virtual ~base_sink(void)
virtual void finalize(void) = 0

Finalize metrics and flush files in preparation for program exit.

virtual write_status flush(const rmetrics::base_data *data, const rtypes::timestep &t) = 0

Flush gathered metrics data to file; might do nothing if the internal conditions for writing metrics (e.g., the configured interval) are not met.

virtual void initialize(const rmetrics::base_data *data) = 0

Initialize any required files for the metrics sink (i.e., .csv headers).

inline const rtypes::timestep &output_interval(void) const
inline const rmetrics::output_mode &output_mode(void) const
bool ready_to_flush(const rtypes::timestep &t) const

Have the conditions been met to flush the metrics ?