Program Listing for File base_sink.hpp

Return to documentation for file (rcppsw/metrics/base_sink.hpp)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include "rcppsw/er/client.hpp"
#include "rcppsw/metrics/write_status.hpp"
#include "rcppsw/types/timestep.hpp"
#include "rcppsw/metrics/base_data.hpp"
#include "rcppsw/metrics/output_mode.hpp"
#include "rcppsw/metrics/utils.hpp"

/*******************************************************************************
 * Namespaces/Decls
 ******************************************************************************/
namespace rcppsw::metrics {

/*******************************************************************************
 * Class Definitions
 ******************************************************************************/
class base_sink : public er::client<base_sink> {
 public:
  base_sink(const rmetrics::output_mode& mode,
            const rtypes::timestep& interval);

  virtual ~base_sink(void);

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

  virtual void finalize(void) = 0;

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

  bool ready_to_flush(const rtypes::timestep& t) const RCPPSW_PURE;

  const rtypes::timestep& output_interval(void) const {
    return mc_output_interval;
  }

  const rmetrics::output_mode& output_mode(void) const { return mc_output_mode; }

 private:
  /* clang-format off */
  const rmetrics::output_mode mc_output_mode;
  const rtypes::timestep      mc_output_interval;
  /* clang-format on */
};

} /* namespace rcppsw::metrics */