1 #ifndef SLAM_CTOR_CORE_LAZY_TILED_GRID_MAP_H_INCLUDED     2 #define SLAM_CTOR_CORE_LAZY_TILED_GRID_MAP_H_INCLUDED    15 #include "../geometry_utils.h"    53     return *
tile(ic)->cell(ic);
    58     std::shared_ptr<Tile> &
tile = this->
tile(coord);
    62     if (1 < tile.use_count()) {
    63       tile.reset(
new Tile{*tile});
    66     std::shared_ptr<GridCell> &cell = tile->cell(coord);
    67     if (1 < cell.use_count()) {
    75   std::tuple<unsigned, unsigned>
    78     unsigned prepend_nm = 0, append_nm = 0;
    80       prepend_nm = 1 + ((min - val) >> Tile_Size_Bits);
    81     } 
else if (max <= val) {
    82       append_nm = 1 + ((val - max) >> Tile_Size_Bits);
    84     return std::make_tuple(prepend_nm, append_nm);
    88     Tile(std::shared_ptr<GridCell> dflt) {
    92     std::shared_ptr<GridCell> &
cell(
const Coord& cell_coord) {
    93       return const_cast<std::shared_ptr<GridCell> &
>(
    94         static_cast<const Tile*
>(
this)->
cell(cell_coord));
    97     const std::shared_ptr<GridCell> &
cell(
const Coord& cell_coord)
 const {
    99                     (cell_coord.
y & Tile_Coord_Mask)];
   102     std::array<std::shared_ptr<GridCell>, Tile_Size*Tile_Size> 
_cells;
   108                    (c.
x >> Tile_Size_Bits)];
   116   mutable std::vector<std::shared_ptr<Tile>> 
_tiles;
   130     ensure_inside(area_id);
   135     ensure_inside(area_id);
   157     unsigned prep_x = 0, app_x = 0, prep_y = 0, app_y = 0;
   161     unsigned new_tiles_nm_x = prep_x + 
_tiles_nm_x + app_x;
   162     unsigned new_tiles_nm_y = prep_y + 
_tiles_nm_y + app_y;
   165     std::vector<std::shared_ptr<Tile>> new_tiles{new_tiles_nm_x*new_tiles_nm_y,
   167     for (
unsigned row_i = 0; row_i != 
_tiles_nm_y; ++row_i) {
   169                 &
_tiles[(row_i + 1) * _tiles_nm_x], 
   170                 &new_tiles[(prep_y + row_i)* new_tiles_nm_x + prep_x]);
   175     std::swap(
_tiles, new_tiles);
   178     _origin += 
Coord(prep_x * Tile_Size, prep_y * Tile_Size);
 std::shared_ptr< Tile > & tile(const Coord &c) const 
 
void update(const Coord &area_id, const AreaOccupancyObservation &aoo) override
Updates area with a given observation. 
 
Coord external2internal(const Coord &coord) const 
 
static constexpr unsigned Tile_Size
 
UnboundedLazyTiledGridMap(std::shared_ptr< GridCell > prototype, const GridMapParams ¶ms=MapValues::gmp)
 
static constexpr GridMapParams gmp
 
std::array< std::shared_ptr< GridCell >, Tile_Size *Tile_Size > _cells
 
void ensure_sole_owning(const Coord &area_id)
 
virtual bool has_cell(const Coord &c) const 
 
const std::shared_ptr< GridCell > unknown_cell() const 
 
void set_width(unsigned w)
 
std::vector< std::shared_ptr< Tile > > _tiles
 
virtual DiscretePoint2D origin() const 
 
bool has_internal_cell(const Coord &c) const 
 
static constexpr unsigned Tile_Size_Bits
 
static constexpr unsigned Tile_Coord_Mask
 
LazyTiledGridMap(std::shared_ptr< GridCell > prototype, const GridMapParams ¶ms=MapValues::gmp)
 
void update(const Coord &area_id, const AreaOccupancyObservation &aoo) override
Updates area with a given observation. 
 
std::shared_ptr< Tile > _unknown_tile
 
const GridCell & operator[](const Coord &c) const override
 
void set_height(unsigned h)
 
void update(const Coord &area_id, const AreaOccupancyObservation &aoo) override
Updates area with a given observation. 
 
std::shared_ptr< GridCell > _unknown_cell
 
std::tuple< unsigned, unsigned > extra_tiles_nm(int min, int val, int max) const 
 
bool ensure_inside(const DiscretePoint2D &c)
 
bool has_cell(const Coord &) const override
 
std::shared_ptr< GridCell > & cell(const Coord &cell_coord)
 
void reset(const Coord &area_id, const GridCell &new_area) override
 
virtual int height() const 
 
Tile(std::shared_ptr< GridCell > dflt)
 
const GridCell & operator[](const Coord &ec) const override
 
const GridCell & cell_internal(const Coord &ic) const 
 
std::shared_ptr< Tile > unknown_tile()
 
DiscretePoint2D origin() const override
 
virtual void reset(const Coord &area_id, const GridCell &new_area)
 
void reset(const Coord &area_id, const GridCell &new_area) override
 
virtual int width() const 
 
const std::shared_ptr< GridCell > & cell(const Coord &cell_coord) const