Program Listing for File base_swarm_manager.hpp

Return to documentation for file (cosm/pal/base_swarm_manager.hpp)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include <ticpp/ticpp.h>

#include <memory>
#include <string>

#include "rcppsw/common/common.hpp"
#include "rcppsw/er/client.hpp"
#include "rcppsw/math/config/rng_config.hpp"
#include "rcppsw/math/rng.hpp"
#include "rcppsw/types/timestep.hpp"

#include "cosm/cosm.hpp"
#include "cosm/pal/config/output_config.hpp"

/*******************************************************************************
 * Namespaces/Decls
 ******************************************************************************/
namespace fs = std::filesystem;

namespace cosm::pal {

/*******************************************************************************
 * Class Definitions
 ******************************************************************************/
class base_swarm_manager : public rer::client<base_swarm_manager> {
 public:
  base_swarm_manager(void);

  virtual void init(ticpp::Element& node) = 0;
  virtual void reset(void) = 0;
  virtual void pre_step(void) = 0;
  virtual void post_step(void) = 0;
  virtual void destroy(void) = 0;

  /* Not copy constructable/assignable by default */
  base_swarm_manager(const base_swarm_manager&) = delete;
  const base_swarm_manager& operator=(const base_swarm_manager&) = delete;

  rmath::rng* rng(void) { return m_rng; }

 protected:
  virtual void output_init(const cpconfig::output_config* config) RCPPSW_COLD;

  virtual void ndc_uuid_push(void) const = 0;

  virtual void ndc_uuid_pop(void) const = 0;

  virtual void mdc_ts_update(void) const = 0;

  void rng_init(const rmath::config::rng_config* config) RCPPSW_COLD;

  fs::path output_root(void) const { return m_output_root; }

  void timestep(const rtypes::timestep& t) { m_timestep = t; }
  const rtypes::timestep& timestep(void) const { return m_timestep; }

 private:
  /* clang-format off */
  rtypes::timestep m_timestep{0};
  fs::path         m_output_root{};
  rmath::rng*      m_rng{nullptr};
  /* clang-format on */
};

} /* namespace cosm::pal */