|
MTCT
Design Automation and Optimization for ETCS Railway Networks
|
Container and persistence API for named stations. More...
#include <Station.hpp>
Public Member Functions | |
| StationList ()=default | |
| Creates an empty station list. | |
| StationList (std::filesystem::path const &p, Network const &network) | |
| Loads stations from stations.json in the given directory. | |
| StationList (std::string const &path, Network const &network) | |
| Constructs a station list from a string path. | |
| StationList (char const *const path, Network const &network) | |
| Convenience overload forwarding to the filesystem path constructor. | |
| StationList (const StationList &other) | |
| Copy constructor that performs a deep copy of all stations. | |
| StationList & | operator= (const StationList &other) |
| Copy assignment operator that performs a deep copy of all stations. | |
| StationList (StationList &&) noexcept=default | |
| Move constructor. | |
| StationList & | operator= (StationList &&) noexcept=default |
| Move assignment operator. | |
| auto | begin () const |
| Read-only iterator to the first station entry. | |
| auto | end () const |
| Read-only iterator past the last station entry. | |
| auto | cbegin () const |
| Obtains a const iterator to the first station. | |
| auto | cend () const |
| Read-only iterator past the last station entry (explicit const). | |
| size_t | size () const |
| Retrieves the number of stations. | |
| bool | has_station (const std::string &name) const |
| Checks whether a station with the given name exists. | |
| Station const & | get_station (const std::string &name) const |
| Retrieves a station by name. | |
| std::unordered_set< std::string > | get_station_names () const |
| Returns the set of all station names. | |
| bool | is_fully_in_station (std::string const &station_name, cda_rail::index_set const &edges) const |
| Checks whether all given edges belong to a named station. | |
| void | add_empty_station (std::string const &name) |
| Adds a new station without tracks. | |
| void | add_track_to_station (const std::string &name, size_t track) |
| Adds a track index to an existing station. | |
| void | add_track_to_station (const std::string &name, cda_rail::Network::EdgeInput const &edge, const Network &network) |
| Adds a track to a station by resolving an edge specification. | |
| void | export_stations (const std::filesystem::path &p, const Network &network) const |
| Exports all stations to stations.json in the target directory. | |
| void | export_stations (std::string const &path, const Network &network) const |
| Convenience overload forwarding to the filesystem path export. | |
| void | export_stations (char const *const path, const Network &network) const |
| Writes all stations to the specified directory. | |
| void | update_after_discretization (const std::vector< std::pair< size_t, cda_rail::index_set > > &new_edges) |
| Updates station tracks after network discretization. | |
| void | update_after_discretization (const std::vector< std::pair< size_t, cda_rail::index_vector > > &new_edges) |
| Updates station tracks after network discretization. | |
| std::vector< std::pair< size_t, std::vector< cda_rail::index_vector > > > | get_stop_tracks (const std::string &name, double tr_len, const Network &network, const cda_rail::index_set &edges_to_consider={}) const |
| Computes possible stop tracks for a named station. | |
Static Public Member Functions | |
| static StationList | import_stations (const std::string &path, const Network &network) |
| Imports stations from a directory path string. | |
| static StationList | import_stations (const char *path, const Network &network) |
| Imports stations from a C-string path. | |
| static StationList | import_stations (const std::filesystem::path &p, const Network &network) |
| Imports stations from a filesystem path. | |
Friends | |
| class | Timetable |
Container and persistence API for named stations.
StationList owns all stations and provides lookup, mutation, import/export, and helper operations.
|
default |
Creates an empty station list.
| cda_rail::StationList::StationList | ( | std::filesystem::path const & | p, |
| Network const & | network ) |
Loads stations from stations.json in the given directory.
| p | Directory containing stations.json. |
| network | Network used to resolve edge endpoints from stored vertex names. |
| exceptions::ImportException | If p does not exist or is not a directory. |
|
inline |
Constructs a station list from a string path.
Loads stations from stations.json located in the given directory.
| path | Directory containing stations.json. |
| network | Network used to resolve edge endpoints. |
| exceptions::ImportException | If path does not exist or is not a directory. |
|
inline |
Convenience overload forwarding to the filesystem path constructor.
| path | Directory containing stations.json. |
| network | Network used to resolve edge endpoints. |
|
inline |
Copy constructor that performs a deep copy of all stations.
| other | The StationList to copy from. |
|
defaultnoexcept |
Move constructor.
| void cda_rail::StationList::add_empty_station | ( | std::string const & | name | ) |
Adds a new station without tracks.
| name | Name of the station to create. |
| exceptions::ConsistencyException | If a station with name already exists. |
|
inline |
Adds a track to a station by resolving an edge specification.
| name | Station name. |
| edge | Edge specification to resolve and add. |
| network | Network used to resolve the edge specification. |
| exceptions::StationNotExistentException | if the station does not exist. |
| exceptions::EdgeNotExistentException | if the resolved edge does not exist in the network. |
| void cda_rail::StationList::add_track_to_station | ( | const std::string & | name, |
| size_t | track ) |
Adds a track index to an existing station.
If the track already belongs to the station, the call has no effect.
| name | Station name. |
| track | Track edge index. |
| exceptions::StationNotExistentException | If name is unknown. |
|
inlinenodiscard |
Read-only iterator to the first station entry.
|
inlinenodiscard |
Obtains a const iterator to the first station.
|
inlinenodiscard |
Read-only iterator past the last station entry (explicit const).
|
inlinenodiscard |
Read-only iterator past the last station entry.
|
inline |
Writes all stations to the specified directory.
| path | A C-string representing the target directory. |
| network | Network used to resolve edge endpoint names. |
| exceptions::ExportException | If the directory cannot be created. |
| void cda_rail::StationList::export_stations | ( | const std::filesystem::path & | p, |
| const Network & | network ) const |
Exports all stations to stations.json in the target directory.
Edge endpoints are written using vertex names from network.
| p | Target directory. |
| network | Network used to resolve edge endpoint names. |
| exceptions::ExportException | If the target directory cannot be created. |
|
inline |
Convenience overload forwarding to the filesystem path export.
| path | Target directory. |
| network | Network used to resolve edge endpoint names. |
|
nodiscard |
Retrieves a station by name.
| name | Station name. |
| exceptions::StationNotExistentException | If no station with name exists. |
|
nodiscard |
Returns the set of all station names.
|
inlinenodiscard |
Computes possible stop tracks for a named station.
| name | Station name. |
| tr_len | Train length. |
| network | Network containing the station edges. |
| edges_to_consider | Optional candidate edges to filter the result. If empty, all station edges are considered. |
| exceptions::StationNotExistentException | If name is unknown. |
|
inlinenodiscard |
Checks whether a station with the given name exists.
| name | Station name. |
|
inlinestaticnodiscard |
Imports stations from a C-string path.
| path | Directory containing stations.json. |
| network | Network used to resolve edge endpoints. |
| exceptions::ImportException | if path does not exist or is not a directory. |
|
inlinestaticnodiscard |
Imports stations from a filesystem path.
| p | Directory containing stations.json. |
| network | Network used to resolve edge endpoints. |
| exceptions::ImportException | If the directory does not exist or is not a directory. |
|
inlinestaticnodiscard |
Imports stations from a directory path string.
| path | Directory containing stations.json. |
| network | Network used to resolve edge endpoints. |
|
nodiscard |
Checks whether all given edges belong to a named station.
| exceptions::StationNotExistentException | If station_name is unknown. |
|
inline |
Copy assignment operator that performs a deep copy of all stations.
| other | The StationList to copy from. |
|
defaultnoexcept |
Move assignment operator.
|
inlinenodiscard |
Retrieves the number of stations.
| void cda_rail::StationList::update_after_discretization | ( | const std::vector< std::pair< size_t, cda_rail::index_set > > & | new_edges | ) |
Updates station tracks after network discretization.
For each pair (old_edge, replacement_edges), every occurrence of old_edge in a station is replaced by all edges in replacement_edges.
| new_edges | Mapping from original edge index to replacement edge set. |
| void cda_rail::StationList::update_after_discretization | ( | const std::vector< std::pair< size_t, cda_rail::index_vector > > & | new_edges | ) |
Updates station tracks after network discretization.
For each pair (old_edge, replacement_edges), every occurrence of old_edge in a station is replaced by all edges in replacement_edges.
| new_edges | Mapping from original edge index to replacement edge vector. |
|
friend |