27 , m_algo_id{algo::BINARY_TREE}
30 , m_output_id{output::PLAIN_TEXT}
65 m_rows = (
rows == 0) ? 1 : (
rows > 10000) ? 10000 :
rows;
95 m_algo_id = algorithm;
135 m_help = std::move(
help);
143 m_version = std::move(
version);
149 unsigned int rows() const noexcept {
return m_rows; }
153 unsigned int columns() const noexcept {
return m_columns; }
157 unsigned int levels() const noexcept {
return m_levels; }
165 int block_id() const noexcept {
return m_block_id; }
169 unsigned int seed() const noexcept {
return m_seed; }
181 const std::string&
help() const noexcept {
return m_help; }
185 const std::string&
version() const noexcept {
return m_version; }
192 if (m_rows == 0 || m_columns == 0 || m_levels == 0) {
197 const unsigned int MAX_DIMENSION = 10000;
198 if (m_rows > MAX_DIMENSION || m_columns > MAX_DIMENSION || m_levels > 1000) {
203 const auto max_cells = std::numeric_limits<size_t>::max() /
sizeof(
void*);
204 if (
static_cast<size_t>(m_rows) * m_columns * m_levels > max_cells) {
218 m_algo_id = algo::BINARY_TREE;
221 m_output_id = output::PLAIN_TEXT;
230 unsigned int m_columns;
232 unsigned int m_levels;
246 std::string m_version;
Configuration class for arguments.
Definition configurator.h:15
unsigned int seed() const noexcept
Get the random seed.
Definition configurator.h:169
void reset_to_defaults() noexcept
Reset all values to safe defaults.
Definition configurator.h:213
configurator & help(std::string help) noexcept
Set the help message.
Definition configurator.h:134
unsigned int rows() const noexcept
Get the number of rows.
Definition configurator.h:149
output output_id() const noexcept
Get the output ID.
Definition configurator.h:177
const std::string & version() const noexcept
Get the version string.
Definition configurator.h:185
configurator & columns(unsigned int columns) noexcept
Set the number of columns.
Definition configurator.h:73
bool distances() const noexcept
Check if distances are calculated.
Definition configurator.h:173
~configurator() noexcept=default
Destructor.
configurator & block_id(int block_id) noexcept
Set the block ID.
Definition configurator.h:102
configurator & output_id(output output) noexcept
Set the output ID.
Definition configurator.h:126
int block_id() const noexcept
Get the block ID.
Definition configurator.h:165
configurator & operator=(configurator &&other) noexcept=default
Move assignment operator.
algo algo_id() const noexcept
Get the maze generation algorithm.
Definition configurator.h:161
bool is_valid() const noexcept
Validate all configuration values are within safe limits.
Definition configurator.h:190
configurator & levels(unsigned int levels) noexcept
Set the number of levels.
Definition configurator.h:84
configurator & distances(bool distances) noexcept
Set the distance calculation flag.
Definition configurator.h:118
configurator & algo_id(algo algorithm) noexcept
Set the maze generation algorithm.
Definition configurator.h:94
unsigned int levels() const noexcept
Get the number of levels.
Definition configurator.h:157
configurator & version(std::string version) noexcept
Set the version string.
Definition configurator.h:142
const std::string & help() const noexcept
Get the help message.
Definition configurator.h:181
configurator & seed(unsigned int seed) noexcept
Set the random seed.
Definition configurator.h:110
unsigned int columns() const noexcept
Get the number of columns
Definition configurator.h:153
configurator & operator=(const configurator &other) noexcept=default
Copy assignment operator.
configurator(configurator &&other) noexcept=default
Move constructor
configurator() noexcept
Default constructor - initializes all values to safe defaults.
Definition configurator.h:22
configurator(const configurator &other) noexcept=default
Copy constructor.
A class that manages distances associated with cells in a grid.
Definition distances.h:17
Enumerations for the maze builder program.
Namespace for the maze builder.
Definition algo_interface.h:9
output
Enum class for output types.
Definition enums.h:19
algo
Enum class for maze types by the generating algorithm.
Definition enums.h:79