General purpose grid class for maze generation.
More...
#include <grid.h>
|
| grid (unsigned int rows=1u, unsigned int columns=1u, unsigned int height=1u) |
| Constructor for grid.
|
|
| grid (std::tuple< unsigned int, unsigned int, unsigned int > dimensions) |
| Constructor for grid.
|
|
| grid (const grid &other) |
| Copy constructor.
|
|
grid & | operator= (const grid &other) |
| Assignment operator.
|
|
| grid (grid &&other) noexcept |
| Move constructor.
|
|
grid & | operator= (grid &&other) noexcept |
| Move assignment operator.
|
|
virtual | ~grid () |
| Destructor.
|
|
virtual std::future< bool > | get_future () noexcept |
| Initialize and configure.
|
|
virtual std::tuple< unsigned int, unsigned int, unsigned int > | get_dimensions () const noexcept override |
| Provides dimensions of grid in no assumed ordering.
|
|
virtual void | to_vec (std::vector< std::shared_ptr< cell > > &cells) const noexcept override |
| Convert a 2D grid to a vector of cells (sorted by row then column)
|
|
virtual void | to_vec2 (std::vector< std::vector< std::shared_ptr< cell > > > &cells) const noexcept override |
| Convert a 2D grid to a vector of vectors of cells (sorted by row then column)
|
|
virtual std::optional< std::string > | contents_of (const std::shared_ptr< cell > &c) const noexcept override |
| Get detailed information of a cell in the grid.
|
|
virtual std::optional< std::uint32_t > | background_color_for (const std::shared_ptr< cell > &c) const noexcept override |
| Get the background color for a cell in the grid.
|
|
std::shared_ptr< cell > | search (int index) const noexcept |
|
int | count () const noexcept |
| Get the count of cells in the grid.
|
|
|
void | build_fut (std::vector< int > const &indices) noexcept |
| Builds a future based on the provided indices.
|
|
void | configure_cells (std::vector< std::shared_ptr< cell > > &cells) const noexcept |
| Configure cells by neighbors (N, S, E, W)
|
|
|
std::promise< bool > | m_config_promise |
|
std::mutex | m_cells_mutex |
|
std::unordered_map< int, std::shared_ptr< cell > > | m_cells |
|
|
class | binary_tree |
| Friend classes.
|
|
class | dfs |
|
class | sidewinder |
|
General purpose grid class for maze generation.
◆ grid() [1/4]
mazes::grid::grid |
( |
unsigned int | rows = 1u, |
|
|
unsigned int | columns = 1u, |
|
|
unsigned int | height = 1u ) |
|
explicit |
Constructor for grid.
- Parameters
-
◆ grid() [2/4]
mazes::grid::grid |
( |
std::tuple< unsigned int, unsigned int, unsigned int > | dimensions | ) |
|
|
explicit |
Constructor for grid.
- Parameters
-
◆ grid() [3/4]
mazes::grid::grid |
( |
const grid & | other | ) |
|
Copy constructor.
- Parameters
-
◆ grid() [4/4]
mazes::grid::grid |
( |
grid && | other | ) |
|
|
noexcept |
Move constructor.
- Parameters
-
◆ background_color_for()
virtual std::optional< std::uint32_t > mazes::grid::background_color_for |
( |
const std::shared_ptr< cell > & | c | ) |
const |
|
overridevirtualnoexcept |
◆ build_fut()
void mazes::grid::build_fut |
( |
std::vector< int > const & | indices | ) |
|
|
protectednoexcept |
Builds a future based on the provided indices.
- Parameters
-
indices | A constant reference to a vector of integers representing the indices. |
◆ configure_cells()
void mazes::grid::configure_cells |
( |
std::vector< std::shared_ptr< cell > > & | cells | ) |
const |
|
protectednoexcept |
Configure cells by neighbors (N, S, E, W)
- Parameters
-
◆ contents_of()
virtual std::optional< std::string > mazes::grid::contents_of |
( |
const std::shared_ptr< cell > & | c | ) |
const |
|
overridevirtualnoexcept |
◆ count()
int mazes::grid::count |
( |
| ) |
const |
|
noexcept |
Get the count of cells in the grid.
- Returns
- The number of cells in the grid
◆ get_dimensions()
virtual std::tuple< unsigned int, unsigned int, unsigned int > mazes::grid::get_dimensions |
( |
| ) |
const |
|
overridevirtualnoexcept |
◆ get_future()
virtual std::future< bool > mazes::grid::get_future |
( |
| ) |
|
|
virtualnoexcept |
Initialize and configure.
- Parameters
-
callback | notifies when configuration is complete |
- Returns
Reimplemented in mazes::distance_grid.
◆ operator=() [1/2]
grid & mazes::grid::operator= |
( |
const grid & | other | ) |
|
Assignment operator.
- Parameters
-
- Returns
◆ operator=() [2/2]
grid & mazes::grid::operator= |
( |
grid && | other | ) |
|
|
noexcept |
Move assignment operator.
- Parameters
-
- Returns
◆ search()
std::shared_ptr< cell > mazes::grid::search |
( |
int | index | ) |
const |
|
noexcept |
◆ to_vec()
virtual void mazes::grid::to_vec |
( |
std::vector< std::shared_ptr< cell > > & | cells | ) |
const |
|
overridevirtualnoexcept |
Convert a 2D grid to a vector of cells (sorted by row then column)
- Parameters
-
Implements mazes::grid_interface.
◆ to_vec2()
virtual void mazes::grid::to_vec2 |
( |
std::vector< std::vector< std::shared_ptr< cell > > > & | cells | ) |
const |
|
overridevirtualnoexcept |
Convert a 2D grid to a vector of vectors of cells (sorted by row then column)
- Parameters
-
Implements mazes::grid_interface.
The documentation for this class was generated from the following file: