How ilgobbo00/railway works
Railway is a C++ railway-line simulator: it loads station and timetable descriptions, builds a line and its trains, then advances simulated time until every train reaches its destination. During simulation, trains move and interact with stations, while the central Railway coordinates station updates and checks conflicts between trains; stations manage platforms, parking, and priority-based access. The README also describes train hierarchy and queuing to let higher-priority trains pass. Runtime wiring beyond the sampled excerpts is shown only where supported by the interfaces or explicit comments.
Main entry points: Railway.cpp Railway controller · Station.cpp Station behavior · mainRailway.cpp Simulation entry · Railway.h Train movement
Components 16
Simulation core
- Simulation entry
mainRailway.cpp - Railway controller
Railway.cpp - Train interaction checks
Railway.cpp - Completion check
Railway.cpp
Railway domain
- Station line setup
Railway.cpp - Train schedule setup
Railway.cpp - Station behavior
Station.cpp - Principal station
Station.cpp - Secondary station
Station.cpp - Train movement
Railway.h - Train types
Railway.h
Simulation inputs
- Line description
line_description.txt - Timetable
timetables.txt
Events and status
- Station announcements
Station.cpp - Railway messages
Railway.cpp
Other components
- User / operator
Connections 20
- User / operator → Simulation entry: starts simulation
- Simulation entry → Railway controller: constructs; advances time
- Simulation entry → Completion check: checks completion
- Railway controller → Line description: reads line input
- Railway controller → Timetable: reads schedule input
- Railway controller → Station line setup: builds stations
- Railway controller → Train schedule setup: builds trains; corrects times
- Station line setup → Station behavior: creates station objects
- Station behavior → Principal station: specializes requests
- Station behavior → Secondary station: specializes requests
- Train schedule setup → Train types: creates by type
- Train types → Train movement: inherits movement behavior
- Railway controller → Train interaction checks: checks train interactions
- Train interaction checks → Train movement: sets slowing and speed
- Train movement → Station behavior: requests access; asks exit
- Railway controller → Station behavior: updates each minute
- Station behavior → Station announcements: records announcements
- Station announcements → Railway messages: appends events
- Railway controller → Railway messages: collects simulation messages
- Railway controller → Completion check: checks train status