SOLA
Loading...
Searching...
No Matches
destination.h
1// Copyright 2023 The SOLA authors
2//
3// This file is part of DAISI.
4//
5// DAISI is free software: you can redistribute it and/or modify it under the terms of the GNU
6// General Public License as published by the Free Software Foundation; version 2.
7//
8// DAISI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
9// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
10// Public License for more details.
11//
12// You should have received a copy of the GNU General Public License along with DAISI. If not, see
13// <https://www.gnu.org/licenses/>.
14//
15// SPDX-License-Identifier: GPL-2.0-only
16
17#ifndef DAISI_PATH_PLANNING_DESTINATION_H_
18#define DAISI_PATH_PLANNING_DESTINATION_H_
19
20#include <cstdint>
21#include <functional>
22#include <tuple>
23
24#include "connection_points.h"
25
26namespace daisi::path_planning {
27
30 uint32_t from_station_id = 0;
31 MainConnPoints out_point; // at ourself
32 uint32_t to_station_id = 0;
33 MainConnPoints in_point; // at destination
34
35 bool operator==(const RouteIdentifier &other) const {
36 return std::tie(from_station_id, to_station_id, out_point, in_point) ==
37 std::tie(other.from_station_id, to_station_id, other.out_point, other.in_point);
38 }
39};
40
43 std::size_t operator()(const RouteIdentifier &dest) const {
44 return std::hash<uint32_t>()(dest.from_station_id) ^ std::hash<uint32_t>()(dest.to_station_id) ^
45 std::hash<MainConnPoints>()(dest.out_point) ^ std::hash<MainConnPoints>()(dest.in_point);
46 }
47};
48
49} // namespace daisi::path_planning
50
51#endif // DAISI_PATH_PLANNING_DESTINATION_H_
Definition destination.h:41
std::size_t operator()(const RouteIdentifier &dest) const
Hash implementation for RouteIdentifier.
Definition destination.h:43
Identifier of a route from a station and point type to another station with given point type.
Definition destination.h:29