mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-03 08:30:23 +01:00
refactor(track): the sleeper layout split by concern instead of one TrackSleepers.cpp
- SleeperRules: the rules beams are laid by and the faults counted where the layout breaks them - SleeperGeometry: plan helpers, beam boxes with their overlap and support tests and a grid of cells, shared by laying, filling gaps, keeping beams apart and checking instead of three copies of each - SleeperPaths: sampled paths, how near they run and whether one carries another; the tracks near a track and the stretches of a path where a test holds, shared by paths_around/unsettle_around and shared_zones/zones_of - SleeperFeatures: frogs and crossings the timbers turn to; SleeperLines: lines of beams, the rails they carry, where they part - SleeperLayout: clusters and their layout, given the epoch instead of reading it; SleeperModels: the models of the beams - SleeperWorker: the layouts kept per epoch and worked out in the background, behind a small interface - TrackSleepers: the facade, laying the instances, the shared zones and the check - sleepercheck reports a digest of all beams; geomhash skips empty chunks instead of crashing The layout is unchanged: geomhash, sleepercheck with the digest, wings, space, guards, crossings and switches give the same output on baltyk, zz_rozjazdy_id4, zz_rf_slips, zz_rf_wide, zz_slips_s42, zz_demo_przechylka and zz_connections.
This commit is contained in:
31
world/SleeperWorker.h
Normal file
31
world/SleeperWorker.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
This Source Code Form is subject to the
|
||||
terms of the Mozilla Public License, v.
|
||||
2.0. If a copy of the MPL was not
|
||||
distributed with this file, You can
|
||||
obtain one at
|
||||
http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
#include "world/TrackSleepers.h"
|
||||
|
||||
// the layouts of the clusters of tracks kept till a track changes, and worked out in a thread of their own while the simulation runs
|
||||
namespace track_sleepers {
|
||||
|
||||
// the layouts worked out so far hold no more, as a track changed
|
||||
void outdate_layouts();
|
||||
// the beams of the track from the layout of its cluster worked out already for the tracks as they are, none where there's none yet
|
||||
std::optional<std::vector<beam>> laid_out( TTrack const &Track );
|
||||
// whether the layouts are worked out in the background
|
||||
bool in_background();
|
||||
// the layout of the cluster of the track asked of the thread working them out
|
||||
void ask_layout( TTrack &Track );
|
||||
// nothing left to work out in the background nor being worked out, the waiting ones dropped
|
||||
void settle_background();
|
||||
|
||||
} // namespace track_sleepers
|
||||
Reference in New Issue
Block a user