Program Listing for File nest_block_process.hpp

Return to documentation for file (cosm/arena/operations/nest_block_process.hpp)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include <memory>

#include "rcppsw/er/client.hpp"
#include "rcppsw/patterns/visitor/visitor.hpp"
#include "rcppsw/types/timestep.hpp"
#include "rcppsw/mpl/typelist.hpp"
#include "rcppsw/types/type_uuid.hpp"

#include "cosm/cosm.hpp"

/*******************************************************************************
 * Namespaces
 ******************************************************************************/
namespace cosm::arena {
class base_arena_map;
class caching_arena_map;
} /* namespace cosm::arena */

namespace cosm::repr {
class sim_block3D;
} /* namespace cosm::repr */

namespace cosm::arena::operations {
namespace detail {

/*******************************************************************************
 * Class Definitions
 ******************************************************************************/
class nest_block_process : public rer::client<nest_block_process> {
 private:
  struct visit_typelist_impl {
    using value = rmpl::typelist<base_arena_map,
                                 caching_arena_map,
                                 crepr::sim_block3D>;
  };

 public:
  using visit_typelist = visit_typelist_impl::value;

  nest_block_process(crepr::sim_block3D* arena_block,
                     const rtypes::timestep& t);

  ~nest_block_process(void) override = default;

  nest_block_process(const nest_block_process&) = delete;
  nest_block_process& operator=(const nest_block_process&) = delete;

  void visit(caching_arena_map& map);
  void visit(base_arena_map& map);

 private:
  void visit(crepr::sim_block3D& block);

  template <typename TArenaMap>
  void do_visit(TArenaMap& map);

  /* clang-format off */
  const rtypes::timestep               mc_timestep;
  crepr::sim_block3D*                 m_arena_block;
  /* clang-format on */
};

} /* namespace detail */

using nest_block_process_visitor = rpvisitor::filtered_visitor<detail::nest_block_process>;

} /* namespace cosm::arena::operations */