Program Listing for File free_blocks_calculator.hpp

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

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include "cosm/arena/ds/cache_vector.hpp"
#include "cosm/cosm.hpp"
#include "cosm/ds/block3D_vector.hpp"

/*******************************************************************************
 * Namespaces/Decls
 ******************************************************************************/
namespace cosm::arena {

/*******************************************************************************
 * Class Definitions
 ******************************************************************************/
class free_blocks_calculator {
 public:
  explicit free_blocks_calculator(bool oos_ok) : mc_oos_ok(oos_ok) {}

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

  cds::block3D_vectorno
  operator()(const cds::block3D_vectorno& c_all_blocks,
             const cads::acache_vectorro& c_all_caches) const;

  cds::block3D_vectorno
  operator()(const cds::block3D_vectorno& c_all_blocks) const {
    return operator()(c_all_blocks, {});
  }

 private:
  /* clang-format off */
  const bool mc_oos_ok;
  /* clang-format on */
};

} /* namespace cosm::arena */