SafeAPI RBC 2oo2 Generic Application
IL/CTC route and train logic for the safeAPIRBC2oo2 reference RBC
Loading...
Searching...
No Matches
safeAPIRBC2oo2GA

The Generic Application layer of the safeAPIRBC2oo2 reference RBC: Interlocking (IL) and CTC route/train logic, plus the Movement-Authority-logic adaptation that drives it. Extracted from the original safeAPIRBC2oo2 project when it split into safeAPIRBC2oo2GP (executable/platform), safeAPIRBC2oo2GA (this project), safeAPIRBC2oo2SA (installer packaging + site-data libraries), and safeAPIBackendPosix (OAL backend).

Builds libsafeapi_rbc2oo2_ga.{dylib,so} (rbc2oo2::ga), a genuine shared library GP loads at runtime — not a static library folded into GP's own binary. It also builds the Role C IL and CTC gateway service binaries (safeapi_gateway_c_il, safeapi_gateway_c_ctc) when built as part of a GP superbuild (a standalone cmake -S . or conan create skips these two and just builds the shared library).

The GP↔GA boundary

GP and GA call into each other in both directions (GP drives GA's IL/CTC adapters; GA reads/writes route and train state GP owns). Because two genuinely circular shared libraries can't link each other directly, each side builds against an empty dummy of the other and the real library replaces it on disk before the process runs — GP's own build defines a dummy_ga target for this; GA links the real safeapi_gp directly since that direction was always a straightforward same-build link. GP's bare-call surface into GA is deliberately minimal (one setup entry point, ab_ga_ma_adaptation_init()); everything else is a callback GA registers into GP at init. See CLAUDE.md for the full history of this design and safeAPIRBC2oo2GP/CLAUDE.md for the CMake mechanics that make the dummy/real swap work.

What's here

  • src/AB/il/ — Interlocking adapter (route add/release handling).
  • src/AB/ctc/ — CTC adapter (train-connected / MA-granted / MA-extended / train-telemetry indications).
  • src/AB/ma_logic_adaptation/ — the single entry point GP calls to wire IL/CTC into its own route-validator and notification callback slots.
  • src/AB/main/ — GA-internal storage for the GP-supplied interface pointer.
  • include/ab_siteGA.h — GA's own reduced, route-only site-data contract (id, start_signal, end_signal, length_m) — a deliberate projection of safeAPIRBC2oo2GP's full RailML topology, implemented by safeAPIRBC2oo2SA as sa::site::ga. Kept hand-in-sync with GP's own full topology; nothing in the build catches drift if the track layout changes — update both together.

Building

Standalone (just the shared library):

cmake -S . -B build -DSAPI_FRAMEWORK_DIR=../safeAPIFreamwork
cmake --build build
ctest --test-dir build --output-on-failure
cmake --install build --prefix . # -> dist/<platform>/lib/libsafeapi_rbc2oo2_ga.*

As part of the full application, build safeAPIRBC2oo2GP instead — its CMakeLists.txt add_subdirectory()s this project by default and also produces the two gateway-service binaries listed above, installed into GP's own dist/<platform>/bin/.

See CLAUDE.md for the detailed design history (interface evolution, the move of Movement-Authority granting from IL's wire message to GP's own position-based connect gate, and more).