Maze Builder Docs 7.5.6
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 rows=1u, unsigned int columns=1u, unsigned int levels=1u)
 Construct a grid using unsigned integers.
 
 grid (std::tuple< unsigned int, unsigned int, unsigned int > dimens)
 Construct a grid using a tuple of unsigned integers.
 
 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.
 
grid_operationsoperations () noexcept override
 
const grid_operationsoperations () const noexcept override
 
std::tuple< unsigned int, unsigned int, unsigned int > get_dimensions () const noexcept override
 Get the dimensions of the grid.
 
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::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.
 
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 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 void set_str (std::string const &str) noexcept override
 
virtual std::string get_str () const noexcept override
 
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_vertices (const std::vector< std::tuple< int, int, int, int > > &vertices) noexcept override
 Set the vertices for wavefront object file generation.
 
virtual std::vector< std::vector< std::uint32_t > > get_faces () const noexcept override
 Get the faces 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.
 
- 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.
 

Detailed Description

General purpose grid class for 2D maze generation.

Constructor & Destructor Documentation

◆ grid() [1/4]

mazes::grid::grid ( unsigned int rows = 1u,
unsigned int columns = 1u,
unsigned int levels = 1u )
explicit

Construct a grid using unsigned integers.

Parameters
rows
columns
levels

◆ grid() [2/4]

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

Construct a grid using a tuple of unsigned integers.

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_dimensions()

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

Get the dimensions of the grid.

Returns
A tuple containing the number of rows, columns, and levels

Implements mazes::grid_operations.

◆ get_east()

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

◆ get_faces()

virtual std::vector< std::vector< std::uint32_t > > mazes::grid::get_faces ( ) const
overridevirtualnoexcept

Get the faces for wavefront object file generation.

Returns
A vector of faces, where each face is a vector of vertex indices

Implements mazes::grid_operations.

◆ 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_vertices()

virtual std::vector< std::tuple< int, int, int, int > > mazes::grid::get_vertices ( ) const
overridevirtualnoexcept

Get the vertices for wavefront object file generation.

Returns
A vector of vertices as tuples (x, y, z, w)

Implements mazes::grid_operations.

◆ 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_faces()

virtual void mazes::grid::set_faces ( const std::vector< std::vector< std::uint32_t > > & faces)
overridevirtualnoexcept

Set the faces for wavefront object file generation.

Parameters
facesA vector of faces, where each face is a vector of vertex indices

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

◆ set_vertices()

virtual void mazes::grid::set_vertices ( const std::vector< std::tuple< int, int, int, int > > & vertices)
overridevirtualnoexcept

Set the vertices for wavefront object file generation.

Parameters
verticesA vector of vertices as tuples (x, y, z, w)

Implements mazes::grid_operations.


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