gtopt::LPClassName struct

Public static variables

static std::size_t max_short_len

Constructors, destructors, conversion operators

LPClassName() defaulted constexpr noexcept
LPClassName(std::string_view pfull_name) explicit constexpr noexcept
operator std::string_view() const constexpr noexcept

Public functions

auto empty() const -> bool noexcept
auto full_name() const -> std::string_view noexcept
auto operator<=>(const LPClassName& other) const -> auto noexcept
auto operator==(const LPClassName& other) const -> bool noexcept
auto operator==(std::string_view other) const -> bool noexcept
auto short_name() const -> std::string_view noexcept
auto snake_case() const -> std::string_view noexcept
Alias for short_name().

Function documentation

gtopt::LPClassName::LPClassName() defaulted constexpr noexcept

Default constructor yields an empty class name (both full_name() and snake_case() return empty views). Required so that aggregate types like StateVariable::Key (which stores an LPClassName by value) can be default-initialised — the empty instance signals "unset" and comparisons against a live class name reliably fail.

bool gtopt::LPClassName::operator==(std::string_view other) const noexcept

Heterogeneous equality against any string-like (string_view / std::string / const char*). Compares the PascalCase full_name(). Lets call sites compare a stored LPClassName against a string literal without explicit conversion — e.g. key.class_name == "Reservoir" works.

std::string_view gtopt::LPClassName::short_name() const noexcept

snake_case of the full class name, materialized once at construction. Returns a std::string_view over the internal buffer — zero-cost to call and usable anywhere a string_view is expected. "ReserveProvision" → "reserve_provision", "Generator" → "generator", etc.

Variable documentation

static std::size_t gtopt::LPClassName::max_short_len

Maximum characters in the materialized snake_case short name. Longest current name: "ReservoirProductionFactor" → 27 chars.