Maze Builder Docs 6.7.5
Loading...
Searching...
No Matches
mazes::grid Class Reference

General purpose grid class for 2D maze generation. More...

#include <grid.h>

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

Public Member Functions

 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.
 
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.
 
grid_operationsoperations () noexcept override
 
const grid_operationsoperations () const noexcept override
 
std::tuple< unsigned int, unsigned int, unsigned int > get_dimensions () const noexcept override
 Retrieves the dimensions as a tuple of three unsigned integers.
 
virtual std::shared_ptr< cellget_neighbor (std::shared_ptr< cell > const &c, Direction dir) const noexcept override
 Get neighbor by the cell's respective location.
 
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.
 
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.
 
void sort (std::vector< std::shared_ptr< cell > > &cells) const noexcept override
 Transformation and display cells.
 
virtual std::shared_ptr< cellget_north (const std::shared_ptr< cell > &c) const noexcept override
 
virtual std::shared_ptr< cellget_south (const std::shared_ptr< cell > &c) const noexcept override
 
virtual std::shared_ptr< cellget_east (const std::shared_ptr< cell > &c) const noexcept override
 
virtual std::shared_ptr< cellget_west (const std::shared_ptr< cell > &c) const noexcept override
 
virtual std::shared_ptr< cellsearch (int index) const noexcept override
 Search for a cell by index.
 
virtual std::vector< std::shared_ptr< cell > > get_cells () const noexcept override
 Retrieves a collection of cell objects.
 
virtual int num_cells () const noexcept override
 Get the count of cells in the grid.
 
virtual void clear_cells () noexcept override
 Cleanup cells by cleaning up links within cells.
 
virtual bool set_cells (const std::vector< std::shared_ptr< cell > > &cells) noexcept override
 Set cells and build topology from them.
 
virtual void set_str (std::string const &str) noexcept override
 
virtual std::string get_str () const noexcept override
 
- Public Member Functions inherited from mazes::grid_interface
- Public Member Functions inherited from mazes::grid_operations
virtual ~grid_operations ()=default
 Destroys the grid_operations object and releases any associated resources.
 

Friends

class binary_tree
 Friend classes.
 
class dfs
 
class sidewinder
 

Detailed Description

General purpose grid class for 2D maze generation.

Constructor & Destructor Documentation

◆ grid() [1/4]

mazes::grid::grid ( unsigned int r = 1u,
unsigned int c = 1u,
unsigned int l = 1u )
explicit
Parameters
r
c
l

◆ grid() [2/4]

mazes::grid::grid ( std::tuple< unsigned int, unsigned int, unsigned int > dimens)
explicit
Parameters
dimens

◆ grid() [3/4]

mazes::grid::grid ( const grid & other)

Copy constructor.

Parameters
other

◆ grid() [4/4]

mazes::grid::grid ( grid && other)
noexcept

Move constructor.

Parameters
other

Member Function Documentation

◆ background_color_for()

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

Get the background color for a cell in the grid.

Parameters
c
Returns

Implements mazes::grid_interface.

◆ clear_cells()

virtual void mazes::grid::clear_cells ( )
overridevirtualnoexcept

Cleanup cells by cleaning up links within cells.

Implements mazes::grid_operations.

◆ contents_of()

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

Get detailed information of a cell in the grid.

Parameters
c
Returns

Implements mazes::grid_interface.

◆ get_cells()

virtual std::vector< std::shared_ptr< cell > > mazes::grid::get_cells ( ) const
overridevirtualnoexcept

Retrieves a collection of cell objects.

Returns
A vector containing shared pointers to cell objects.

Implements mazes::grid_operations.

◆ get_dimensions()

std::tuple< unsigned int, unsigned int, unsigned int > mazes::grid::get_dimensions ( ) const
overridevirtualnoexcept

Retrieves the dimensions as a tuple of three unsigned integers.

Returns
A tuple containing three unsigned integers representing the dimensions.

Implements mazes::grid_operations.

◆ get_east()

virtual std::shared_ptr< cell > mazes::grid::get_east ( const std::shared_ptr< cell > & c) const
overridevirtualnoexcept

◆ get_neighbor()

virtual std::shared_ptr< cell > mazes::grid::get_neighbor ( std::shared_ptr< cell > const & c,
Direction dir ) const
overridevirtualnoexcept

Get neighbor by the cell's respective location.

Parameters
c
dir
Returns

Implements mazes::grid_operations.

◆ get_neighbors()

virtual std::vector< std::shared_ptr< cell > > mazes::grid::get_neighbors ( std::shared_ptr< cell > const & c) const
overridevirtualnoexcept

Get all the neighbors by the cell.

Parameters
c
Returns

Implements mazes::grid_operations.

◆ get_north()

virtual std::shared_ptr< cell > mazes::grid::get_north ( const std::shared_ptr< cell > & c) const
overridevirtualnoexcept

◆ get_south()

virtual std::shared_ptr< cell > mazes::grid::get_south ( const std::shared_ptr< cell > & c) const
overridevirtualnoexcept

◆ get_str()

virtual std::string mazes::grid::get_str ( ) const
overridevirtualnoexcept

◆ get_west()

virtual std::shared_ptr< cell > mazes::grid::get_west ( const std::shared_ptr< cell > & c) const
overridevirtualnoexcept

◆ num_cells()

virtual int mazes::grid::num_cells ( ) const
overridevirtualnoexcept

Get the count of cells in the grid.

Returns
The number of cells in the grid

Implements mazes::grid_operations.

◆ operations() [1/2]

const grid_operations & mazes::grid::operations ( ) const
overridevirtualnoexcept
Returns

Implements mazes::grid_interface.

◆ operations() [2/2]

grid_operations & mazes::grid::operations ( )
overridevirtualnoexcept
Returns

Implements mazes::grid_interface.

◆ operator=() [1/2]

grid & mazes::grid::operator= ( const grid & other)

Assignment operator.

Parameters
other
Returns

◆ operator=() [2/2]

grid & mazes::grid::operator= ( grid && other)
noexcept

Move assignment operator.

Parameters
other
Returns

◆ search()

virtual std::shared_ptr< cell > mazes::grid::search ( int index) const
overridevirtualnoexcept

Search for a cell by index.

Parameters
index
Returns

Implements mazes::grid_operations.

◆ set_cells()

virtual bool mazes::grid::set_cells ( const std::vector< std::shared_ptr< cell > > & cells)
overridevirtualnoexcept

Set cells and build topology from them.

Parameters
cellsVector of pre-configured cells
Returns
true if successful, false otherwise

Implements mazes::grid_operations.

◆ set_neighbor()

virtual void mazes::grid::set_neighbor ( const std::shared_ptr< cell > & c,
Direction dir,
std::shared_ptr< cell > const & neighbor )
overridevirtualnoexcept

Set neighbor for a cell in a given direction.

Parameters
c
dir
neighbor
Returns

Implements mazes::grid_operations.

◆ set_str()

virtual void mazes::grid::set_str ( std::string const & str)
overridevirtualnoexcept

◆ sort()

void mazes::grid::sort ( std::vector< std::shared_ptr< cell > > & cells) const
overridevirtualnoexcept

Transformation and display cells.

Parameters
cellsVector to fill with cells

Implements mazes::grid_operations.


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