Maze Builder Docs 8.2.1
Loading...
Searching...
No Matches
distance_grid.h
Go to the documentation of this file.
1#ifndef DISTANCE_GRID_H
2#define DISTANCE_GRID_H
3
5
6#include <future>
7#include <memory>
8#include <string>
9
12namespace mazes
13{
14 class cell;
15 class distances;
16 class grid;
17 class grid_operations;
18
22 {
23 public:
24 explicit distance_grid(unsigned int width = 1u, unsigned int length = 1u, unsigned int levels = 1u);
25
26 distance_grid(const distance_grid&) = delete;
27
28 distance_grid& operator=(const distance_grid&) = delete;
29
30 distance_grid(distance_grid&&) noexcept = default;
31
32 distance_grid& operator=(distance_grid&&) noexcept = default;
33
37 [[nodiscard]] std::string contents_of(std::shared_ptr<cell> const& c) const noexcept override;
38
42 [[nodiscard]] std::uint32_t
43 background_color_for(std::shared_ptr<cell> const& c) const noexcept override;
44
45 // Delegate to embedded grid
46 [[nodiscard]] grid_operations& operations() noexcept override;
47
48 [[nodiscard]] const grid_operations& operations() const noexcept override;
49
54 void resize(unsigned int rows, unsigned int cols, unsigned int levels) const noexcept;
55
59 void calculate_distances(int start_index, int end_index) noexcept;
60
63 [[nodiscard]] std::shared_ptr<distances> get_distances() const noexcept;
64
65 private:
66 std::shared_ptr<distances> m_distances;
67
68 std::unique_ptr<grid_interface> m_grid;
69 };
70}
71
72#endif // DISTANCE_GRID_H
A grid that can calculate distances between cells.
Definition distance_grid.h:22
std::shared_ptr< distances > get_distances() const noexcept
Get the distances object.
void resize(unsigned int rows, unsigned int cols, unsigned int levels) const noexcept
Resize the grid.
std::uint32_t background_color_for(std::shared_ptr< cell > const &c) const noexcept override
void calculate_distances(int start_index, int end_index) noexcept
Calculates distances for a range of indices.
std::string contents_of(std::shared_ptr< cell > const &c) const noexcept override
grid_operations & operations() noexcept override
Get access to grid operations interface.
A class that manages distances associated with cells in a grid.
Definition distances.h:22
Interface for the grid class.
Definition grid_interface.h:20
Interface for grid navigation and manipulation operations.
Definition grid_operations.h:19