Program Listing for File metrics_extract.hpp

Return to documentation for file (cosm/controller/operations/metrics_extract.hpp)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include <boost/variant/static_visitor.hpp>
#include <utility>

#include "cosm/cosm.hpp"

/*******************************************************************************
 * Namespaces/Decls
 ******************************************************************************/
namespace cosm::controller::operations {

/*******************************************************************************
 * Class Definitions
 ******************************************************************************/
template <class TController, class TAggregator>
class metrics_extract : public boost::static_visitor<void> {
 public:
  explicit metrics_extract(TAggregator* const agg) : m_agg(agg) {}

  template<typename ...Args>
  void operator()(const TController* const c, Args&& ...args) const {
    m_agg->collect_from_controller(c, std::forward<Args>(args)...);
  }

 private:
  /* clang-format off */
  TAggregator* const m_agg;
  /* clang-format on */
};

} /* namespace cosm::controller::operations */