Maze Builder Docs 6.3.5
Loading...
Searching...
No Matches
mazes::cell Class Referencefinal

Cell class for maze generation - only stores its index and links to other cells. More...

#include <cell.h>

Public Member Functions

 cell (std::int32_t index=0)
 Constructs a cell object with an optional index.
 
 cell (const cell &other)
 
celloperator= (const cell &other)
 
 cell (cell &&other) noexcept
 
celloperator= (cell &&other) noexcept
 
void add_link (const std::shared_ptr< cell > &other)
 Add a link to another cell (passage between cells)
 
void remove_link (const std::shared_ptr< cell > &other)
 Remove a link to another cell.
 
std::vector< std::pair< std::shared_ptr< cell >, bool > > get_links () const
 Retrieves links to other cells.
 
bool is_linked (const std::shared_ptr< cell > &c)
 Checks if a cell is linked.
 
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.
 
void cleanup_links ()
 Cleans up or removes links, typically as part of a resource management or shutdown process.
 

Detailed Description

Cell class for maze generation - only stores its index and links to other cells.

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

◆ add_link()

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

Add a link to another cell (passage between cells)

Parameters
otherThe cell to link to

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

std::vector< std::pair< std::shared_ptr< cell >, bool > > mazes::cell::get_links ( ) const

Retrieves links to other cells.

Returns
A vector of pairs containing linked cells and their link status

◆ 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.

◆ remove_link()

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

Remove a link to another cell.

Parameters
otherThe cell to unlink from

◆ 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.

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