16#include <unordered_map>
35 explicit grid(
unsigned int rows = 1u,
unsigned int columns = 1u,
unsigned int levels = 1u);
39 explicit grid(std::tuple<unsigned int, unsigned int, unsigned int> dimens);
72 std::tuple<
unsigned int,
unsigned int,
unsigned int>
get_dimensions() const noexcept override;
77 virtual std::
string contents_of(std::shared_ptr<
cell> const &c) const noexcept override;
93 virtual std::vector<std::shared_ptr<
cell>>
get_neighbors(std::shared_ptr<
cell> const &c) const noexcept override;
103 virtual std::shared_ptr<
cell> get_north(const std::shared_ptr<
cell> &c) const noexcept override;
104 virtual std::shared_ptr<
cell> get_south(const std::shared_ptr<
cell> &c) const noexcept override;
105 virtual std::shared_ptr<
cell> get_east(const std::shared_ptr<
cell> &c) const noexcept override;
106 virtual std::shared_ptr<
cell> get_west(const std::shared_ptr<
cell> &c) const noexcept override;
111 virtual std::shared_ptr<
cell>
search(
int index) const noexcept override;
120 virtual
void set_str(std::
string const &str) noexcept override;
122 virtual std::
string get_str() const noexcept override;
126 virtual std::vector<std::tuple<
int,
int,
int,
int>>
get_vertices() const noexcept override;
130 virtual
void set_vertices(const std::vector<std::tuple<
int,
int,
int,
int>> &vertices) noexcept override;
134 virtual std::vector<std::vector<std::uint32_t>>
get_faces() const noexcept override;
138 virtual
void set_faces(const std::vector<std::vector<std::uint32_t>> &faces) noexcept override;
141 std::unordered_map<
int, std::shared_ptr<
cell>> m_cells;
143 std::tuple<
unsigned int,
unsigned int,
unsigned int> m_dimensions;
147 mutable std::mutex m_topology_mutex;
148 std::unordered_map<
int, std::unordered_map<
Direction,
int>> m_topology;
153 std::vector<std::tuple<
int,
int,
int,
int>> m_vertices;
154 std::vector<std::vector<std::uint32_t>> m_faces;
Cell class with links to other cells.
Definition cell.h:19
Interface for the grid class.
Definition grid_interface.h:20
Interface for grid navigation and manipulation operations.
Definition grid_operations.h:18
General purpose grid class for 2D maze generation.
Definition grid.h:28
grid_operations & operations() noexcept override
grid(const grid &other)
Copy constructor.
virtual std::shared_ptr< cell > search(int index) const noexcept override
Search for a cell by index.
virtual std::vector< std::vector< std::uint32_t > > get_faces() const noexcept override
Get the faces for wavefront object file generation.
virtual void clear_cells() noexcept override
Cleanup cells by cleaning up links within cells.
virtual std::string contents_of(std::shared_ptr< cell > const &c) const noexcept override
Get detailed information of a cell in the grid.
virtual std::uint32_t background_color_for(std::shared_ptr< cell > const &c) const noexcept override
Get the background color for a cell in the grid.
virtual std::vector< std::tuple< int, int, int, int > > get_vertices() const noexcept override
Get the vertices for wavefront object file generation.
virtual void set_faces(const std::vector< std::vector< std::uint32_t > > &faces) noexcept override
Set the faces for wavefront object file generation.
grid & operator=(const grid &other)
Assignment operator.
grid & operator=(grid &&other) noexcept
Move assignment operator.
std::tuple< unsigned int, unsigned int, unsigned int > get_dimensions() const noexcept override
Get the dimensions of the grid.
virtual std::shared_ptr< cell > get_neighbor(std::shared_ptr< cell > const &c, Direction dir) const noexcept override
Get neighbor by the cell's respective location.
grid(std::tuple< unsigned int, unsigned int, unsigned int > dimens)
Construct a grid using a tuple of unsigned integers.
virtual void set_vertices(const std::vector< std::tuple< int, int, int, int > > &vertices) noexcept override
Set the vertices for wavefront object file generation.
grid(grid &&other) noexcept
Move constructor.
grid(unsigned int rows=1u, unsigned int columns=1u, unsigned int levels=1u)
Construct a grid using unsigned integers.
virtual int num_cells() const noexcept override
Get the count of cells in the grid.
~grid() override
Destructor.
virtual void set_neighbor(const std::shared_ptr< cell > &c, Direction dir, std::shared_ptr< cell > const &neighbor) noexcept override
Set neighbor for a cell in a given direction.
virtual std::vector< std::shared_ptr< cell > > get_neighbors(std::shared_ptr< cell > const &c) const noexcept override
Get all the neighbors by the cell.
Enumerations and utilities for the maze builder program.
Namespace for the maze builder.
Definition algo_interface.h:6
Direction
Directional neighbors for grid topology.
Definition enums.h:183