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

Namespaces

namespace  database
namespace  filters
namespace  gui
namespace  view

Classes

class  StageParams
 Accumulates stage parameters as a JSON object. More...
class  VizualizationObserver

Functions

int exit_code_for (const reusex::pipeline::StageResult &result)
 Map a library stage outcome onto a rux exit code.
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 ()
VizualizationObserverget_processing_observer ()
int run (int argc, char **argv)
 The whole of the rux CLI, minus the main() symbol itself (#249).
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.

Function Documentation

◆ 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.

◆ 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 32 of file stage_bridge.hpp.

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

Referenced by 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 == -1NOT_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 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, gui) 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(), and SUCCESS.

◆ get_processing_observer()

VizualizationObserver & rux::get_processing_observer ( )

◆ run()

int rux::run ( int argc,
char ** argv )

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().

◆ setup_processing_observer()

void rux::setup_processing_observer ( )

◆ start_viewer()

void rux::start_viewer ( )

◆ wait_for_viewer()

void rux::wait_for_viewer ( )