Maze Builder Docs 7.5.6
Loading...
Searching...
No Matches
mazes::configurator Class Referencefinal

Configuration class for arguments. More...

#include <configurator.h>

Public Member Functions

configuratorrows (unsigned int rows) noexcept
 Set the number of rows.
 
configuratorcolumns (unsigned int columns) noexcept
 Set the number of columns.
 
configuratorlevels (unsigned int levels) noexcept
 Set the number of levels.
 
configuratoralgo_id (algo algorithm) noexcept
 Set the maze generation algorithm.
 
configuratorblock_id (int block_id) noexcept
 Set the block ID.
 
configuratorseed (unsigned int seed) noexcept
 Set the random seed.
 
configuratordistances (bool distances) noexcept
 Set the distance calculation flag.
 
configuratordistances_start (int start_index) noexcept
 Set the distance start index.
 
configuratordistances_end (int end_index) noexcept
 Set the distance end index.
 
configuratoroutput_format_id (output_format output_format) noexcept
 Set the output_format ID.
 
configuratoroutput_format_filename (std::string filename) noexcept
 Set the output_format filename.
 
unsigned int rows () const noexcept
 Get the number of rows.
 
unsigned int columns () const noexcept
 Get the number of columns.
 
unsigned int levels () const noexcept
 Get the number of levels.
 
algo algo_id () const noexcept
 Get the maze generation algorithm.
 
int block_id () const noexcept
 Get the block ID.
 
unsigned int seed () const noexcept
 Get the random seed.
 
bool distances () const noexcept
 Check if distances are calculated.
 
int distances_start () const noexcept
 Get the distance start index.
 
int distances_end () const noexcept
 Get the distance end index.
 
output_format output_format_id () const noexcept
 Get the output_format ID.
 
std::string output_format_filename () const noexcept
 Get the output_format filename.
 
bool is_valid () const noexcept
 Validate all configuration values are within safe limits.
 

Static Public Member Functions

static std::optional< std::unique_ptr< algo_interface > > make_algo_from_config (const configurator &config)
 Determine the maze generation algorithm from the configuration.
 

Static Public Attributes

static constexpr auto DEFAULT_ROWS = 10u
 
static constexpr auto DEFAULT_COLUMNS = 10u
 
static constexpr auto DEFAULT_LEVELS = 1u
 
static constexpr auto DEFAULT_BLOCK_ID = 0
 
static constexpr auto DEFAULT_ALGO_ID = algo::BINARY_TREE
 
static constexpr auto DEFAULT_SEED = 0u
 
static constexpr auto DEFAULT_OUTPUT_ID = output_format::PLAIN_TEXT
 
static constexpr auto DEFAULT_FILENAME = ""
 
static constexpr auto DEFAULT_DISTANCES = false
 
static constexpr auto DEFAULT_DISTANCES_START = 0
 
static constexpr auto DEFAULT_DISTANCES_END = -1
 
static constexpr auto MAX_ROWS = 100u
 
static constexpr auto MAX_COLUMNS = 100u
 
static constexpr auto MAX_LEVELS = 10u
 

Detailed Description

Configuration class for arguments.

This class stores maze generation parameters with safe default values

Member Function Documentation

◆ algo_id() [1/2]

algo mazes::configurator::algo_id ( ) const
inlinenoexcept

Get the maze generation algorithm.

Returns
The algorithm used for maze generation

◆ algo_id() [2/2]

configurator & mazes::configurator::algo_id ( algo algorithm)
inlinenoexcept

Set the maze generation algorithm.

Parameters
algorithmThe algorithm to use
Returns
A reference to this configurator

◆ block_id() [1/2]

int mazes::configurator::block_id ( ) const
inlinenoexcept

Get the block ID.

Returns
The block ID

◆ block_id() [2/2]

configurator & mazes::configurator::block_id ( int block_id)
inlinenoexcept

Set the block ID.

Parameters
block_idThe block ID
Returns
A reference to this configurator

◆ columns() [1/2]

unsigned int mazes::configurator::columns ( ) const
inlinenoexcept

Get the number of columns.

Returns
The number of columns (guaranteed to be > 0)

◆ columns() [2/2]

configurator & mazes::configurator::columns ( unsigned int columns)
inlinenoexcept

Set the number of columns.

Parameters
columnsThe number of columns (must be > 0, will be clamped to reasonable limits)
Returns
A reference to this configurator
Warning
Values will be clamped to prevent memory issues

◆ distances() [1/2]

bool mazes::configurator::distances ( ) const
inlinenoexcept

Check if distances are calculated.

Returns
True if distances are calculated, false otherwise

◆ distances() [2/2]

configurator & mazes::configurator::distances ( bool distances)
inlinenoexcept

Set the distance calculation flag.

Parameters
distancesThe distance calculation flag
Returns
A reference to this configurator

◆ distances_end() [1/2]

int mazes::configurator::distances_end ( ) const
inlinenoexcept

Get the distance end index.

Returns
The ending cell index for distance calculation

◆ distances_end() [2/2]

configurator & mazes::configurator::distances_end ( int end_index)
inlinenoexcept

Set the distance end index.

Parameters
end_indexThe ending cell index for distance calculation
Returns
A reference to this configurator

◆ distances_start() [1/2]

int mazes::configurator::distances_start ( ) const
inlinenoexcept

Get the distance start index.

Returns
The starting cell index for distance calculation

◆ distances_start() [2/2]

configurator & mazes::configurator::distances_start ( int start_index)
inlinenoexcept

Set the distance start index.

Parameters
start_indexThe starting cell index for distance calculation
Returns
A reference to this configurator

◆ is_valid()

bool mazes::configurator::is_valid ( ) const
inlinenoexcept

Validate all configuration values are within safe limits.

Returns
True if all values are valid, false if any are problematic

Checks for potential infinite loop conditions and memory issues

◆ levels() [1/2]

unsigned int mazes::configurator::levels ( ) const
inlinenoexcept

Get the number of levels.

Returns
The number of levels (guaranteed to be > 0)

◆ levels() [2/2]

configurator & mazes::configurator::levels ( unsigned int levels)
inlinenoexcept

Set the number of levels.

Parameters
levelsThe number of levels (must be > 0, will be clamped to reasonable limits)
Returns
A reference to this configurator
Warning
Values will be clamped to prevent memory issues
Note
Most mazes are 2D (levels=1), 3D mazes should use moderate level counts

◆ make_algo_from_config()

static std::optional< std::unique_ptr< algo_interface > > mazes::configurator::make_algo_from_config ( const configurator & config)
inlinestatic

Determine the maze generation algorithm from the configuration.

Parameters
configThe configurator containing the algorithm settings
Returns
A unique pointer to the selected algorithm interface

◆ output_format_filename() [1/2]

std::string mazes::configurator::output_format_filename ( ) const
inlinenoexcept

Get the output_format filename.

Returns
The output_format filename

◆ output_format_filename() [2/2]

configurator & mazes::configurator::output_format_filename ( std::string filename)
inlinenoexcept

Set the output_format filename.

Parameters
filenameThe output_format filename
Returns
A reference to this configurator

◆ output_format_id() [1/2]

output_format mazes::configurator::output_format_id ( ) const
inlinenoexcept

Get the output_format ID.

Returns
The output_format ID

◆ output_format_id() [2/2]

configurator & mazes::configurator::output_format_id ( output_format output_format)
inlinenoexcept

Set the output_format ID.

Parameters
output_formatThe output_format ID
Returns
A reference to this configurator

◆ rows() [1/2]

unsigned int mazes::configurator::rows ( ) const
inlinenoexcept

Get the number of rows.

Returns
The number of rows (guaranteed to be > 0)

◆ rows() [2/2]

configurator & mazes::configurator::rows ( unsigned int rows)
inlinenoexcept

Set the number of rows.

Parameters
rowsThe number of rows (must be > 0, will be clamped to reasonable limits)
Returns
A reference to this configurator
Warning
Values be clamped to prevent memory issues

◆ seed() [1/2]

unsigned int mazes::configurator::seed ( ) const
inlinenoexcept

Get the random seed.

Returns
The random seed

◆ seed() [2/2]

configurator & mazes::configurator::seed ( unsigned int seed)
inlinenoexcept

Set the random seed.

Parameters
seedThe random seed (0 = use random seed)
Returns
A reference to this configurator

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