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

GA's own site data: route composition, built from GP's raw physical elements (railML interlocking <route>). More...

#include "ab_siteGP.h"
#include <stddef.h>
#include <stdint.h>
Include dependency graph for ab_siteGA.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ab_site_ga_route_layout_t
 One route's static layout entry (railML interlocking <route>) - GA's own full definition (not a reduced projection of anyone else's table - GA is the sole owner of route topology now). More...

Macros

#define SAFEAPI_EXAMPLE_MAX_BALISES_PER_ROUTE   2U
#define SAFEAPI_EXAMPLE_MAX_SEGMENTS_PER_ROUTE   4U
#define SAFEAPI_EXAMPLE_MAX_SWITCHES_PER_ROUTE   2U

Functions

const ab_site_ga_route_layout_tab_site_ga_get_route (uint16_t route_id)
 Looks up a route by its ID.
const ab_site_ga_route_layout_tab_site_ga_get_route_by_signals (uint16_t start_signal, uint16_t end_signal)
 Looks up a route by its start and end signal identities.
const ab_site_ga_route_layout_tab_site_ga_get_route_by_name (const char *name)
 Looks up a route by its railML designator/name.

Variables

const ab_site_ga_route_layout_t ab_site_ga_track_layout []
const size_t ab_site_ga_track_layout_count

Detailed Description

GA's own site data: route composition, built from GP's raw physical elements (railML interlocking <route>).

Ownership corrected this session. Earlier versions of this header held only a reduced 4-field route PROJECTION of GP's own full route table (id/start_signal/end_signal/length_m), hand-kept-in-sync with safeAPIRBC2oo2GP/include/ab_siteGP.h's full copy - a real, twice- documented drift risk (see this project's own git history / SAPI root CLAUDE.md). Corrected: GP's header now owns ONLY the raw physical infrastructure (segments/signals/switches/balises); THIS header is now the sole owner of route topology - a route is an interlocking-level concept "built from signals and segments," and GA already owns route LOGIC everywhere else in this codebase (IL/CTC adaptation, MA-logic adaptation, the route ID exchanged with IL over the wire), so owning route topology data belongs here too, not in GP.

safeAPIRBC2oo2SA implements this header's contract in ab_siteGA.c, GENERATED (not hand-authored) by generate_ab_site_ga.py (this project's own etc/scripts/) from the single-source-of-truth RailML file safeAPIRBC2oo2SA/etc/site/ab_site.railml.xml - independently of safeAPIRBC2oo2GP/etc/scripts/generate_ab_site_gp.py's own read of the exact same file (no GP-to-GA pipeline - see that script's own header comment for why). See safeAPIRBC2oo2SA/etc/site/README.md for the full RailML field-mapping.

Runtime route STATE (which routes are currently granted to which train) is a completely separate, unaffected concept - GP's own mutable ab_gp_db_route_t, which THIS module (via src/AB/il/ab_ga_il.c) already adds/updates/removes at runtime in response to IL's own ROUTE_ADD/RELEASE indications, through the existing ab_gp_ga_interface_t function-pointer handoff (ga_interface.h) - unchanged by this header's own route-TOPOLOGY-ownership move.

Symbol names stay GA-namespaced (ab_site_ga_*) even though GP no longer defines a competing ab_site_route_layout_t of its own - defensive: this project already paid once, for real, to learn that ELF's flat symbol namespace lets two same-named tables interpose each other when a static-linked executable (GP) and a dynamically-loaded shared library (this project) are both loaded in one process (see safeAPIRBC2oo2GP/docs/TIMING_AND_DATA_LOSS_ANALYSIS.md finding 11) - not worth re-litigating for a rename with no other benefit.

Definition in file ab_siteGA.h.

Macro Definition Documentation

◆ SAFEAPI_EXAMPLE_MAX_BALISES_PER_ROUTE

#define SAFEAPI_EXAMPLE_MAX_BALISES_PER_ROUTE   2U

Definition at line 59 of file ab_siteGA.h.

◆ SAFEAPI_EXAMPLE_MAX_SEGMENTS_PER_ROUTE

#define SAFEAPI_EXAMPLE_MAX_SEGMENTS_PER_ROUTE   4U

Definition at line 60 of file ab_siteGA.h.

◆ SAFEAPI_EXAMPLE_MAX_SWITCHES_PER_ROUTE

#define SAFEAPI_EXAMPLE_MAX_SWITCHES_PER_ROUTE   2U

Definition at line 61 of file ab_siteGA.h.

Function Documentation

◆ ab_site_ga_get_route()

const ab_site_ga_route_layout_t * ab_site_ga_get_route ( uint16_t route_id)

Looks up a route by its ID.

Parameters
route_idRoute ID to find.
Returns
Pointer to route entry if found, NULL otherwise.

◆ ab_site_ga_get_route_by_name()

const ab_site_ga_route_layout_t * ab_site_ga_get_route_by_name ( const char * name)

Looks up a route by its railML designator/name.

Parameters
nameRoute name (e.g., "R_100_101").
Returns
Pointer to route entry if found, NULL otherwise.

◆ ab_site_ga_get_route_by_signals()

const ab_site_ga_route_layout_t * ab_site_ga_get_route_by_signals ( uint16_t start_signal,
uint16_t end_signal )

Looks up a route by its start and end signal identities.

Parameters
start_signalSignal identity where route starts.
end_signalSignal identity where route ends.
Returns
Pointer to route entry if found, NULL otherwise.

Variable Documentation

◆ ab_site_ga_track_layout

const ab_site_ga_route_layout_t ab_site_ga_track_layout[]
extern

Static route layout table - GA's own, full definition.