Template Class grid2D_view_entity
Defined in File grid2D_view_entity.hpp
Inheritance Relationships
Base Types
public cosm::repr::entity2D
(Class entity2D)public cosm::repr::base_grid_view_entity< TGridType, TGridViewType >
(Template Class base_grid_view_entity)public rer::client< grid2D_view_entity< TGridType, TGridViewType > >
Derived Type
public cosm::repr::base_grid_los< grid2D_view_entity< rds::grid2D< cds::cell2D >, rds::grid2D< cds::cell2D >::const_grid_view >, rmath::vector2d >
(Template Class base_grid_los)
Class Documentation
-
template<typename TGridType, typename TGridViewType>
class grid2D_view_entity : public cosm::repr::entity2D, public cosm::repr::base_grid_view_entity<TGridType, TGridViewType>, public rer::client<grid2D_view_entity<TGridType, TGridViewType>> Representation of an arena_grid::view or arena_grid::const_view object as an entity in the arena. This representation makes it much easier to pass abstract, mult-cell objects that are not entities per-se as entities for various operations such as block distribution in foraging.
It has the following characteristics:
Spans multiple cells in the arena.
Does not “exist” in the sense that it is not detectable by robots. It lives on the same level of abstraction as the arena grid (hence the class name).
Has no concept of movability/immovability (again, it is abstract).
Public Types
-
using base_grid_view_entity_type = base_grid_view_entity<TGridType, TGridViewType>
-
using grid_view_type = TGridViewType
Public Functions
-
inline grid2D_view_entity(const rtypes::type_uuid &id, const grid_view_type &the_view, const rtypes::discretize_ratio &res)
-
~grid2D_view_entity(void) override = default
-
inline virtual const cell_type &access(const coord_type &c) const override
Get the cell associated with a particular grid location within the view. Asserts that both coordinates are within the bounds of the grid underlying the view.
- Parameters:
c – The RELATIVE coord within the view.
- Returns:
A reference to the cell.
-
const cell_type &access(const coord_type &c) const = 0
Get the cell associated with a particular grid location within the view. Asserts that both coordinates are within the bounds of the grid underlying the view.
- Parameters:
c – The RELATIVE coord within the view.
- Returns:
A reference to the cell.
-
inline const cell_type &access(size_t i, size_t j) const
Get the cell associated with a particular grid location within the view. Asserts that both coordinates are within the bounds of the grid underlying the view.
- Parameters:
i – The RELATIVE X coord within the view.
j – The RELATIVE Y coord within the view.
- Returns:
A reference to the cell.
-
inline virtual bool contains_abs(const coord_type &cell) const override
Determine if the specified ABSOLUTE coordinates lie within the view entity (i.e., the coordinates are specified relative to the origin of the parent grid this entity is built from.)
-
inline virtual bool contains_rel(const coord_type &cell) const override
Determine if the specified RELATIVE coordinates lie within the view entity (i.e., the coordinates are specified relative to the origin of the view entity, which is not necessarily the same as the origin of the parent grid).
-
inline const rtypes::discretize_ratio &resolution(void) const
Protected Functions
-
inline const grid_view_type &view(void) const