Maze Builder Docs 6.0.1
Loading...
Searching...
No Matches
mazes::colored_grid Class Reference

Extension of the grid class to include color information. More...

#include <colored_grid.h>

Inheritance diagram for mazes::colored_grid:
[legend]
Collaboration diagram for mazes::colored_grid:
[legend]

Public Member Functions

 colored_grid (unsigned int width=1u, unsigned int length=1u, unsigned int levels=1u)
 Constructs a colored grid with specified dimensions.
 
virtual std::optional< std::string > contents_of (const std::shared_ptr< cell > &c) const noexcept override
 Retrieves the contents of a given cell, if available.
 
virtual std::optional< 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.
 
- Public Member Functions inherited from mazes::distance_grid
 distance_grid (unsigned int width=1u, unsigned int length=1u, unsigned int levels=1u)
 
std::shared_ptr< distancesget_distances () const noexcept
 
virtual std::future< bool > get_future () noexcept override
 Initialize and configure.
 
- Public Member Functions inherited from mazes::grid
 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.
 
gridoperator= (const grid &other)
 Assignment operator.
 
 grid (grid &&other) noexcept
 Move constructor.
 
gridoperator= (grid &&other) noexcept
 Move assignment operator.
 
virtual ~grid ()
 Destructor.
 
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)
 
std::shared_ptr< cellsearch (int index) const noexcept
 
int count () const noexcept
 Get the count of cells in the grid.
 
- Public Member Functions inherited from mazes::grid_interface

Friends

class binary_tree
 
class dfs
 
class sidewinder
 

Additional Inherited Members

- Protected Member Functions inherited from mazes::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)
 
- Protected Attributes inherited from mazes::grid
std::promise< bool > m_config_promise
 
std::mutex m_cells_mutex
 
std::unordered_map< int, std::shared_ptr< cell > > m_cells
 

Detailed Description

Extension of the grid class to include color information.

Constructor & Destructor Documentation

◆ colored_grid()

mazes::colored_grid::colored_grid ( unsigned int width = 1u,
unsigned int length = 1u,
unsigned int levels = 1u )
explicit

Constructs a colored grid with specified dimensions.

Parameters
widthThe width of the grid. Defaults to 1.
lengthThe length of the grid. Defaults to 1.
levelsThe number of levels in the grid. Defaults to 1.

Member Function Documentation

◆ background_color_for()

virtual std::optional< std::uint32_t > mazes::colored_grid::background_color_for ( const std::shared_ptr< cell > & c) const
overridevirtualnoexcept

Retrieves the background color for a given cell, if available.

Parameters
cA shared pointer to the cell for which the background color is to be retrieved.
Returns
An optional containing the background color as a 32-bit unsigned integer, or an empty optional if no background color is available.

Reimplemented from mazes::distance_grid.

◆ contents_of()

virtual std::optional< std::string > mazes::colored_grid::contents_of ( const std::shared_ptr< cell > & c) const
overridevirtualnoexcept

Retrieves the contents of a given cell, if available.

Parameters
cA shared pointer to the cell whose contents are to be retrieved.
Returns
An optional string containing the contents of the cell. If the cell has no contents, the optional will be empty.

Reimplemented from mazes::distance_grid.


The documentation for this class was generated from the following file: