Maze Builder Docs 8.2.1
Loading...
Searching...
No Matches
colored_grid.h
Go to the documentation of this file.
1#ifndef COLORED_GRID_H
2#define COLORED_GRID_H
3
5
8namespace mazes
9{
10 class cell;
11 class distances;
12 class grid_operations;
13
16 {
17 public:
18 // Delete copy constructor and copy assignment operator to fix the static assertion failure
19 colored_grid(const colored_grid&) = delete;
20 colored_grid& operator=(const colored_grid&) = delete;
21
22 // Explicitly define move constructor and move assignment operator
23 colored_grid(colored_grid&&) noexcept = default;
24 colored_grid& operator=(colored_grid&&) noexcept = default;
25
30 explicit colored_grid(unsigned int width = 1u, unsigned int length = 1u, unsigned int levels = 1u);
31
35 [[nodiscard]] std::string contents_of(const std::shared_ptr<cell>& c) const noexcept override;
36
40 [[nodiscard]] std::uint32_t background_color_for(const std::shared_ptr<cell>& c) const noexcept override;
41
45 void initialize_distance_coloring(int start_index, int goal_index) noexcept;
46
47 // Delegate to the embedded grid
48 [[nodiscard]] grid_operations& operations() noexcept override;
49
50 // Delegate to the embedded grid
51 [[nodiscard]] const grid_operations& operations() const noexcept override;
52
57 void resize(unsigned int rows, unsigned int cols, unsigned int levels) const noexcept;
58
59 private:
60 std::shared_ptr<distances> m_distances;
61 std::unique_ptr<grid_interface> m_grid;
62 };
63} // namespace mazes
64
65#endif // COLORED_GRID_H
A colored grid implementation that extends the grid_interface to include distance-based coloring.
Definition colored_grid.h:16
std::string contents_of(const std::shared_ptr< cell > &c) const noexcept override
Retrieves the contents of a given cell, if available.
void resize(unsigned int rows, unsigned int cols, unsigned int levels) const noexcept
Resize the grid to the specified dimensions.
void initialize_distance_coloring(int start_index, int goal_index) noexcept
Initialize distance coloring from a starting cell index.
std::uint32_t background_color_for(const std::shared_ptr< cell > &c) const noexcept override
Retrieves the background color for a given cell, if available.
grid_operations & operations() noexcept override
Get access to grid operations interface.
colored_grid(unsigned int width=1u, unsigned int length=1u, unsigned int levels=1u)
Constructs a colored grid with specified dimensions.
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