Program Listing for File interference_metrics_data.hpp

Return to documentation for file (cosm/spatial/metrics/interference_metrics_data.hpp)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include "rcppsw/metrics/base_data.hpp"
#include "rcppsw/al/multithread.hpp"

/*******************************************************************************
 * Namespaces/Decls
 ******************************************************************************/
namespace cosm::spatial::metrics {

/*******************************************************************************
 * Class Definitions
 ******************************************************************************/
  struct interference_metrics_data_impl {
    ral::mt_size_t n_exp_interference{0};
    ral::mt_size_t n_episodes{0};
    ral::mt_size_t n_entered_interference{0};
    ral::mt_size_t n_exited_interference{0};
    ral::mt_size_t interference_duration{0};
  };


struct interference_metrics_data : public rmetrics::base_data {
  interference_metrics_data_impl interval{};
  interference_metrics_data_impl cum{};

  interference_metrics_data& operator+=(const interference_metrics_data& rhs) {
    ral::mt_accum(this->interval.n_exp_interference,
                  rhs.interval.n_exp_interference);
    ral::mt_accum(this->interval.n_episodes,
                  rhs.interval.n_episodes);
    ral::mt_accum(this->interval.n_entered_interference,
                  rhs.interval.n_entered_interference);
    ral::mt_accum(this->interval.n_exited_interference,
                  rhs.interval.n_exited_interference);
    ral::mt_accum(this->interval.interference_duration,
                  rhs.interval.interference_duration);

    ral::mt_accum(this->cum.n_exp_interference,
                  rhs.interval.n_exp_interference);
    ral::mt_accum(this->cum.n_episodes,
                  rhs.interval.n_episodes);
    ral::mt_accum(this->cum.n_entered_interference,
                  rhs.interval.n_entered_interference);
    ral::mt_accum(this->cum.n_exited_interference,
                  rhs.interval.n_exited_interference);
    ral::mt_accum(this->cum.interference_duration,
                  rhs.interval.interference_duration);

    return *this;
  }
};

} /* namespace cosm::spatial::metrics */