Add const-correctness to read-only APIs across state, control, network, and sync modules - #6
Merged
Merged
Conversation
Co-authored-by: eskfro <106732002+eskfro@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix: add const to functions and variables
Add const-correctness to read-only APIs across state, control, network, and sync modules
Aug 31, 2026
eskfro
marked this pull request as ready for review
August 31, 2026 12:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This addresses missing const qualifiers on functions and values that are semantically read-only, with emphasis on getters and pure decision helpers. The update improves const-correctness without changing behavior.
Elevator state + node getters
ElevatorStateaccessors asconst(Id,Floor,Active,Obstruction,Fault,DoorOpen,Stopped,MotorDir,MovingState,Version,Requests,Inertia,Usable).ElevatorNode::Id()andElevatorNode::Running()asconst.CopyFrom/OnUpdatesignatures to use const-safe parameters (const ElevatorState*,const ElevatorState&).Control/request table decision surface
RequestTablereaders asconst(Value,Table,IsRequestAbove/Below/Here).const(Requests,ShouldStop,ShouldClearImmediately,ChooseDirection,ClearCurrentFloor).Order sync + packet accessors
Ordergetters asconst; madeObservedByandOnUpdateconst-correct.OrderTable::Order(...)and madeToBoolTable/Joinconst-correct.NetworkPacket::Id()asconstand added const overloads forOrders(),State(),CabButtonOrders().Peers read-only methods + local const usage
Peers::ObservedByAll,CalculateElevatorCosts, andNumElevsasconst.constwhere values are not mutated (e.g., selected booleans and copied orders).