Maze Builder Docs 6.0.1
All Classes Namespaces Files Functions Enumerations Friends Pages
mazes::cell Class Reference

Cell class for maze generation. More...

#include <cell.h>

Public Member Functions

 cell (std::int32_t index=0)
 Constructs a cell object with an optional index.
 
void link (std::shared_ptr< cell > c1, std::shared_ptr< cell > c2, bool bidi=true)
 Links two cell objects, optionally in both directions.
 
void unlink (std::shared_ptr< cell > c1, std::shared_ptr< cell > c2, bool bidi=true)
 Unlinks two cells, optionally in both directions.
 
const std::unordered_map< std::shared_ptr< cell >, bool > & get_links ()
 Retrieves a constant reference to an unordered map of cell links and their boolean states.
 
bool is_linked (const std::shared_ptr< cell > &c)
 Checks if a cell is linked.
 
bool has_northern_neighbor () const noexcept
 Checks if the current object has a northern neighbor.
 
bool has_southern_neighbor () const noexcept
 Checks if the current object has a southern neighbor.
 
bool has_eastern_neighbor () const noexcept
 Checks if there is an eastern neighbor.
 
bool has_western_neighbor () const noexcept
 Checks if there is a western neighbor.
 
std::vector< std::shared_ptr< cell > > get_neighbors () const noexcept
 Retrieves a list of neighboring cells.
 
int32_t get_index () const noexcept
 Retrieves the index of the current cell.
 
void set_index (std::int32_t next_index) noexcept
 Sets the index to the specified value.
 
std::shared_ptr< cellget_north () const
 Retrieves a shared pointer to the cell located to the north.
 
std::shared_ptr< cellget_south () const
 Retrieves a shared pointer to the cell located to the south.
 
std::shared_ptr< cellget_east () const
 Retrieves a shared pointer to the cell located to the east.
 
std::shared_ptr< cellget_west () const
 Retrieves a shared pointer to the cell located to the west.
 
void set_north (std::shared_ptr< cell > const &other)
 Sets the northern neighbor of the current cell.
 
void set_south (std::shared_ptr< cell > const &other)
 Sets the southern neighbor of the current cell.
 
void set_east (std::shared_ptr< cell > const &other)
 Sets the east neighbor of the current cell.
 
void set_west (std::shared_ptr< cell > const &other)
 Sets the west neighbor of the current cell.
 

Detailed Description

Cell class for maze generation.

Constructor & Destructor Documentation

◆ cell()

mazes::cell::cell ( std::int32_t index = 0)
explicit

Constructs a cell object with an optional index.

Parameters
indexThe index to initialize the cell with. Defaults to 0.

Member Function Documentation

◆ get_east()

std::shared_ptr< cell > mazes::cell::get_east ( ) const

Retrieves a shared pointer to the cell located to the east.

Returns
A std::shared_ptr pointing to the cell located to the east.

◆ get_index()

int32_t mazes::cell::get_index ( ) const
noexcept

Retrieves the index of the current cell.

Returns
The index of the current cell.

◆ get_links()

const std::unordered_map< std::shared_ptr< cell >, bool > & mazes::cell::get_links ( )

Retrieves a constant reference to an unordered map of cell links and their boolean states.

Returns
A constant reference to an unordered map where the keys are shared pointers to cell objects and the values are boolean states indicating the link status.

◆ get_neighbors()

std::vector< std::shared_ptr< cell > > mazes::cell::get_neighbors ( ) const
noexcept

Retrieves a list of neighboring cells.

Returns
A vector of shared pointers to neighboring cells.

◆ get_north()

std::shared_ptr< cell > mazes::cell::get_north ( ) const

Retrieves a shared pointer to the cell located to the north.

Returns
A shared pointer to the cell located to the north.

◆ get_south()

std::shared_ptr< cell > mazes::cell::get_south ( ) const

Retrieves a shared pointer to the cell located to the south.

Returns
A shared pointer to the cell located to the south.

◆ get_west()

std::shared_ptr< cell > mazes::cell::get_west ( ) const

Retrieves a shared pointer to the cell located to the west.

Returns
A shared pointer to the cell located to the west.

◆ has_eastern_neighbor()

bool mazes::cell::has_eastern_neighbor ( ) const
noexcept

Checks if there is an eastern neighbor.

Returns
A boolean value indicating whether there is an eastern neighbor.

◆ has_northern_neighbor()

bool mazes::cell::has_northern_neighbor ( ) const
noexcept

Checks if the current object has a northern neighbor.

Returns
A boolean value indicating whether the current object has a northern neighbor.

◆ has_southern_neighbor()

bool mazes::cell::has_southern_neighbor ( ) const
noexcept

Checks if the current object has a southern neighbor.

Returns
A boolean value indicating whether the current object has a southern neighbor.

◆ has_western_neighbor()

bool mazes::cell::has_western_neighbor ( ) const
noexcept

Checks if there is a western neighbor.

Returns
A boolean value indicating whether there is a western neighbor.

◆ is_linked()

bool mazes::cell::is_linked ( const std::shared_ptr< cell > & c)

Checks if a cell is linked.

Parameters
cA shared pointer to the cell to check.
Returns
True if the cell is linked, false otherwise.

◆ link()

void mazes::cell::link ( std::shared_ptr< cell > c1,
std::shared_ptr< cell > c2,
bool bidi = true )

Links two cell objects, optionally in both directions.

Parameters
c1A shared pointer to the first cell object.
c2A shared pointer to the second cell object.
bidiA boolean flag indicating if the link should be bidirectional. Defaults to true.

◆ set_east()

void mazes::cell::set_east ( std::shared_ptr< cell > const & other)

Sets the east neighbor of the current cell.

Parameters
otherA shared pointer to the cell that will be set as the east neighbor.

◆ set_index()

void mazes::cell::set_index ( std::int32_t next_index)
noexcept

Sets the index to the specified value.

Parameters
next_indexThe new index value to set.

◆ set_north()

void mazes::cell::set_north ( std::shared_ptr< cell > const & other)

Sets the northern neighbor of the current cell.

Parameters
otherA shared pointer to the cell that will be set as the northern neighbor.

◆ set_south()

void mazes::cell::set_south ( std::shared_ptr< cell > const & other)

Sets the southern neighbor of the current cell.

Parameters
otherA shared pointer to the cell that will be set as the southern neighbor.

◆ set_west()

void mazes::cell::set_west ( std::shared_ptr< cell > const & other)

Sets the west neighbor of the current cell.

Parameters
otherA shared pointer to the cell that will be set as the west neighbor.

◆ unlink()

void mazes::cell::unlink ( std::shared_ptr< cell > c1,
std::shared_ptr< cell > c2,
bool bidi = true )

Unlinks two cells, optionally in both directions.

Parameters
c1A shared pointer to the first cell.
c2A shared pointer to the second cell.
bidiA boolean indicating whether to unlink in both directions. Defaults to true.

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