Maze Builder Docs 6.3.5
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.
 
void configure (const std::vector< int > &indices) noexcept override
 Configure the grid's cells' neighbors.
 
virtual std::string contents_of (const std::shared_ptr< cell > &c) const noexcept override
 Retrieves the contents of a given cell, if available.
 
virtual 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.
 
- Public Member Functions inherited from mazes::grid
 grid (unsigned int r=1u, unsigned int c=1u, unsigned int l=1u)
 
 grid (std::tuple< unsigned int, unsigned int, unsigned int > dimens)
 
 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.
 
 ~grid () override
 Destructor.
 
std::shared_ptr< cellget_neighbor (std::shared_ptr< cell > const &c, Direction dir) const noexcept
 Get neighbor by the cell's respective location.
 
std::vector< std::shared_ptr< cell > > get_neighbors (std::shared_ptr< cell > const &c) const noexcept
 Get all the neighbors by the cell.
 
void set_neighbor (const std::shared_ptr< cell > &c, Direction dir, std::shared_ptr< cell > const &neighbor) noexcept
 
std::shared_ptr< cellget_north (const std::shared_ptr< cell > &c) const noexcept override
 
std::shared_ptr< cellget_south (const std::shared_ptr< cell > &c) const noexcept override
 
std::shared_ptr< cellget_east (const std::shared_ptr< cell > &c) const noexcept override
 
std::shared_ptr< cellget_west (const std::shared_ptr< cell > &c) const noexcept override
 
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)
 
std::shared_ptr< cellsearch (int index) const noexcept
 
int num_cells () const noexcept
 Get the count of cells in the grid.
 
void clear_cells () noexcept
 Cleanup cells by cleaning up links within cells.
 
- Public Member Functions inherited from mazes::grid_interface

Friends

class binary_tree
 
class dfs
 
class sidewinder
 

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::uint32_t mazes::colored_grid::background_color_for ( const std::shared_ptr< cell > & c) const
overridevirtualnoexcept

Get the background color for a cell in the grid.

Parameters
c
Returns

Reimplemented from mazes::grid.

◆ configure()

void mazes::colored_grid::configure ( const std::vector< int > & indices)
overridevirtualnoexcept

Configure the grid's cells' neighbors.

Parameters
indices
Returns

Reimplemented from mazes::grid.

◆ contents_of()

virtual 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::grid.


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