ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
rux Namespace Reference

Namespaces

namespace  database
namespace  filters
namespace  view

Classes

struct  GuiLaunch
 What plain rux (no subcommand) asks the desktop app to do. More...
class  StageParams
 Accumulates stage parameters as a JSON object. More...
class  VizualizationObserver

Typedefs

using StageParamsSink
 Receives a subcommand's stage parameters instead of running the stage.
using GuiLauncher
 Starts the desktop app and returns its exit code.

Functions

int exit_code_for (const reusex::pipeline::StageResult &result)
 Map a library stage outcome onto a rux exit code.
void set_stage_params_sink (StageParamsSink sink)
 Test seam for "Kopiér som rux-kommando" (Qt client): while a sink is set, rux create clouds|planes|rooms|instances|mesh and rux optimize hand the parameters their flags produced to it and do nothing else — no project is opened.
bool capture_stage_params (std::string_view stage, const std::string &params)
 Called by each stage subcommand before it runs: true when a sink took params (the subcommand must then return without running).
int exit_code_for (int status)
 Translate a run_subcommand_* return value into a process exit code.
void finish (int status)
 Hand a run_subcommand_* status to CLI11 so that it reaches the process exit code.
void setup_processing_observer ()
void start_viewer ()
void wait_for_viewer ()
VizualizationObserver & get_processing_observer ()
int run (int argc, char **argv, GuiLauncher launch_gui={})
 The whole of the rux CLI, minus the main() symbol itself (#249).
bool logging_left_up ()
 True when run() returned with spdlog still up because detached Qt-client work (rux_qt/background.hpp) outlived the window.
void finish_logging ()
 The spdlog teardown run() skipped.
int check_stage_prerequisites (const reusex::ProjectDB &db, reusex::core::PipelineStage stage, const reusex::core::ArtifactOverrides &overrides={})
 Check stage's documented inputs against db and report any problem on the CLI log, including the derived "run these commands in order" hint.

Typedef Documentation

◆ GuiLauncher

Initial value:
std::function<int(int argc, char **argv, const GuiLaunch &)>
What plain rux (no subcommand) asks the desktop app to do.
Definition rux_app.hpp:16

Starts the desktop app and returns its exit code.

Injected by the rux executable's main() (which alone links the Qt client), so rux_lib — and every test binary that links it — stays free of Qt Widgets.

Definition at line 29 of file rux_app.hpp.

◆ StageParamsSink

Initial value:
std::function<void(std::string_view stage, const std::string &params)>

Receives a subcommand's stage parameters instead of running the stage.

Definition at line 73 of file stage_bridge.hpp.

Function Documentation

◆ capture_stage_params()

bool rux::capture_stage_params ( std::string_view stage,
const std::string & params )

Called by each stage subcommand before it runs: true when a sink took params (the subcommand must then return without running).

References capture_stage_params().

Referenced by capture_stage_params().

◆ check_stage_prerequisites()

int rux::check_stage_prerequisites ( const reusex::ProjectDB & db,
reusex::core::PipelineStage stage,
const reusex::core::ArtifactOverrides & overrides = {} )

Check stage's documented inputs against db and report any problem on the CLI log, including the derived "run these commands in order" hint.

Parameters
overridesSubstitutions for the artifact names a flag can retarget (e.g. {{"labels", opt.semantic_cloud_name}}).
Returns
RuxError::SUCCESS when the contract is satisfied, otherwise RuxError::INVALID_ARGUMENT — the inputs are the caller's mistake, not an internal failure.

References check_stage_prerequisites().

Referenced by check_stage_prerequisites().

◆ exit_code_for() [1/2]

int rux::exit_code_for ( const reusex::pipeline::StageResult & result)
inline

Map a library stage outcome onto a rux exit code.

invalid_input is what keeps rux create planes -f 'bogus' reporting INVALID_ARGUMENT rather than a generic error, as it did when the subcommand evaluated the filter itself.

Definition at line 34 of file stage_bridge.hpp.

References exit_code_for(), GENERIC, INVALID_ARGUMENT, reusex::pipeline::StageResult::invalid_input, reusex::pipeline::StageResult::ok, and SUCCESS.

Referenced by exit_code_for(), exit_code_for(), and finish().

◆ exit_code_for() [2/2]

int rux::exit_code_for ( int status)
inline

Translate a run_subcommand_* return value into a process exit code.

RuxError values are negative (GENERIC == -1 … NOT_IMPLEMENTED == -4) but a process exit status carries only the low 8 bits, so returning them unchanged would surface to a shell as 255/254/253/252. Mirror them onto small positive codes instead and clamp into 1–125, the range a shell reserves for program status (126/127 mean "not executable"/"not found" and 128+n means "killed by signal n").

Definition at line 23 of file exit_status.hpp.

References exit_code_for(), and SUCCESS.

◆ finish()

void rux::finish ( int status)
inline

Hand a run_subcommand_* status to CLI11 so that it reaches the process exit code.

CLI11 takes subcommand callbacks as std::function<void()>, so a callback that merely returns its status has that status silently discarded and rux exits 0 even though the stage failed (issue #299). Wrapping every call in rux::finish() closes that gap:

  • CLI::RuntimeError derives from CLI::ParseError, which main() already catches and forwards to CLI::App::exit().
  • App::exit() special-cases RuntimeError — it returns the exit code without printing anything. The subcommand's own spdlog::error line therefore remains the only user-visible diagnostic, unchanged.

A successful status returns normally, so long-running and interactive subcommands (view) keep their existing lifecycle: the throw can only happen after run_subcommand_* has already returned.

Definition at line 47 of file exit_status.hpp.

References exit_code_for(), finish(), and SUCCESS.

Referenced by finish().

◆ finish_logging()

void rux::finish_logging ( )

The spdlog teardown run() skipped.

References finish_logging().

Referenced by finish_logging().

◆ get_processing_observer()

VizualizationObserver & rux::get_processing_observer ( )

◆ logging_left_up()

bool rux::logging_left_up ( )

True when run() returned with spdlog still up because detached Qt-client work (rux_qt/background.hpp) outlived the window.

main() then either ends with std::quick_exit (still running) or calls finish_logging() (it has finished since) — so the logger is torn down exactly once, and never under a thread that may still log.

References logging_left_up().

Referenced by logging_left_up().

◆ run()

int rux::run ( int argc,
char ** argv,
GuiLauncher launch_gui = {} )

The whole of the rux CLI, minus the main() symbol itself (#249).

Installs the fatal-signal handlers and the async spdlog logger, builds the CLI::App, registers every subcommand, parses argv and runs the selected subcommand. The return value is already a process exit code (0 on success, 1-125 on failure — see exit_status.hpp), so main() only has to forward it.

Splitting this out of main() is what lets rux_lib be a static library the unit tests can link: an object file containing main cannot be linked into a Catch2 binary that supplies its own.

Not re-entrant: it mutates process-global state (signal dispositions, the spdlog default logger, the ReUseX log handler) and calls spdlog::shutdown() on the way out. Call it once, from main().

With no subcommand: calls launch_gui when there is a display and a launcher was given, and prints the help text otherwise (exit 0).

References run().

Referenced by run().

◆ set_stage_params_sink()

void rux::set_stage_params_sink ( StageParamsSink sink)

Test seam for "Kopiér som rux-kommando" (Qt client): while a sink is set, rux create clouds|planes|rooms|instances|mesh and rux optimize hand the parameters their flags produced to it and do nothing else — no project is opened.

tests/unit/rux_app/test_cli_command_roundtrip.cpp parses the client's generated commands through the real CLI with it. Pass an empty function to clear it.

References set_stage_params_sink().

Referenced by set_stage_params_sink().

◆ setup_processing_observer()

void rux::setup_processing_observer ( )

◆ start_viewer()

void rux::start_viewer ( )

References start_viewer().

Referenced by start_viewer().

◆ wait_for_viewer()

void rux::wait_for_viewer ( )

References wait_for_viewer().

Referenced by wait_for_viewer().