gtopt::OutputSelection struct

Per-atom class-name allow-list layered on top of an OutputFlags bitmask. An empty list for an atom means "no restriction — apply to every element class"; a non-empty list restricts that atom to the listed class cnames (Generator, Bus, Line, Battery, Reservoir, Junction, Demand, …, matching the strings each *LP class passes as the first argument to add_col_sol / add_col_cost / add_row_dual).

Syntax accepted by parse_output_selection:

  • sol,dual,rc → all atoms, no scope
  • sol,dual,rc:Generator,Line → rc only on Generator & Line
  • sol:Generator,Line,dual:Bus,rc → mixed per-atom scopes
  • all → all atoms, no scope
  • none → no atoms

Class names appearing after a colon (or as bare tokens following a scoped atom) extend the previous atom's allow-list — that's how sol,dual,rc:Generator,Line parses (Generator + Line both belong to rc, not as new atoms).

Constructors, destructors, conversion operators

OutputSelection() defaulted constexpr noexcept
OutputSelection(OutputFlags f) constexpr noexcept

Public functions

auto emits(OutputFlags atom, std::string_view cname) const -> bool noexcept
auto operator==(const OutputSelection&) const -> bool defaulted noexcept
auto scope_const(OutputFlags atom) const -> const std::vector<std::string>& noexcept
auto scope_mut(OutputFlags atom) -> std::vector<std::string>& noexcept

Public variables

OutputFlags atoms
std::vector<std::string> dual_classes
std::vector<std::string> extra_classes
std::vector<std::string> rc_classes
std::vector<std::string> sol_classes

Function documentation

gtopt::OutputSelection::OutputSelection() defaulted constexpr noexcept

Construct with no atoms and no scope — matches a default OutputFlags::none.

gtopt::OutputSelection::OutputSelection(OutputFlags f) constexpr noexcept

Construct from a bare OutputFlags (no per-atom scope). Used by the compiled defaults and by tests that still think in terms of the legacy bitmask only.

bool gtopt::OutputSelection::emits(OutputFlags atom, std::string_view cname) const noexcept

True if the given atom is enabled AND, if a class scope is set for that atom, cname appears in the allow-list. Empty scope = applies to every class.

std::vector<std::string>& gtopt::OutputSelection::scope_mut(OutputFlags atom) noexcept

Mutable accessor for the per-atom scope vector, used by the parser to append class names. Returns a reference to the vector for the single atom bit; for aliases like all that expand to multiple atoms, the caller distributes scope entries by walking the individual bits.