Program Listing for File base_grid_view_entity.hpp
↰ Return to documentation for file (cosm/repr/base_grid_view_entity.hpp
)
#pragma once
/*******************************************************************************
* Includes
******************************************************************************/
#include "rcppsw/patterns/decorator/decorator.hpp"
#include "rcppsw/types/discretize_ratio.hpp"
#include "cosm/cosm.hpp"
/*******************************************************************************
* Namespaces
******************************************************************************/
namespace cosm::repr {
/*******************************************************************************
* Class Definitions
******************************************************************************/
template <typename TGridType, typename TGridViewType>
class base_grid_view_entity : public rpdecorator::decorator<TGridViewType> {
public:
using grid_type = TGridType;
using grid_view_type = TGridViewType;
using cell_type = typename grid_type::value_type;
using coord_type = typename grid_type::coord_type;
base_grid_view_entity(const grid_view_type& view,
const rtypes::discretize_ratio& resolution)
: rpdecorator::decorator<grid_view_type>(view), mc_resolution(resolution) {}
virtual ~base_grid_view_entity(void) = default;
const rtypes::discretize_ratio& resolution(void) const { return mc_resolution; }
virtual const cell_type& access(const coord_type& c) const = 0;
virtual bool contains_abs(const coord_type& cell) const = 0;
virtual bool contains_rel(const coord_type& cell) const = 0;
protected:
const grid_view_type& view(void) const { return decoratee(); }
private:
using rpdecorator::decorator<grid_view_type>::decoratee;
/* clang-format off */
const rtypes::discretize_ratio mc_resolution;
/* clang-format on */
};
} /* namespace cosm::repr */