Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
FareToken.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2002-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// Fare Modul for calculating prices during intermodal routing
19/****************************************************************************/
20
21#pragma once
22#include <config.h>
23enum class FareToken : int {
24 None = 0,
25 Free = 1, // walking and other things can be free
26 H = 2,
27 L = 3,
28 T1 = 4,
29 T2 = 5,
30 T3 = 6,
31 Z = 7,
32 M = 8,
33 U = 9,
34 KL = 10,
35 KH = 11,
36 K = 12,
37 KHU = 13,
38 KLU = 14,
39 KHZ = 15,
40 KLZ = 16,
41 ZU = 17, //Artificial state for after leaving short trip khu or klu since a pedestrian edge does not allow us
42 //to distinguish between z or u zones
43 START = 18
44
45};
46
47namespace FareUtil {
48
49inline std::string tokenToString(FareToken const& token) {
50 switch (token) {
51 case FareToken::H:
52 return "H";
53 case FareToken::L:
54 return "L";
55 case FareToken::T1:
56 return "T1";
57 case FareToken::T2:
58 return "T2";
59 case FareToken::T3:
60 return "T3";
61 case FareToken::U:
62 return "U";
63 case FareToken::Z:
64 return "Z";
65 case FareToken::M:
66 return "M";
67 case FareToken::K:
68 return "K";
69 case FareToken::KL:
70 return "KL";
71 case FareToken::KH:
72 return "KH";
73 case FareToken::ZU:
74 return "ZU";
75 case FareToken::None:
76 return "None";
77 case FareToken::Free:
78 return "Free";
79 case FareToken::KHU:
80 return "KHU";
81 case FareToken::KLU:
82 return "KLU";
83 case FareToken ::KHZ:
84 return "KHZ";
85 case FareToken ::KLZ:
86 return "KLZ";
87 default:
88 return "";
89 }
90}
91
92
93inline std::string tokenToTicket(FareToken const& token) {
94 switch (token) {
95 case FareToken::H:
96 return "Einzelticket Halle";
97 case FareToken::L:
98 return "Einzelticket Leipzig";
99 case FareToken::T1:
100 return "Einzelticket Stadtverkehr 1";
101 case FareToken::T2:
102 return "Einzelticket Stadtverkehr 2";
103 case FareToken::T3:
104 return "Einzelticket Stadtverkehr 3";
105 case FareToken::U:
106 return "Einzelticket";
107 case FareToken::Z:
108 return "Einzelticket";
109 case FareToken::M:
110 return "Einzelticket Verbundpreis";
111 case FareToken::K:
112 return "Kurzstreckenticket";
113 case FareToken::KL:
114 return "Kurzstreckenticket Leipzig";
115 case FareToken::KH:
116 return "Kurzstreckenticket Halle";
117 case FareToken::ZU:
118 return "None";
119 case FareToken::None:
120 return "None";
121 case FareToken::Free:
122 return "Free";
123 case FareToken::KHU:
124 return "Kurzstreckenticket Halle";
125 case FareToken::KLU:
126 return "Kurzstreckenticket Leipzig";
127 case FareToken ::KHZ:
128 return "Kurzstreckenticket Halle";
129 case FareToken ::KLZ:
130 return "Kurzstreckenticket Leipzig";
131 case FareToken ::START:
132 return "forbidden START";
133 }
134 return ""; //surpress compiler warning
135}
136
137inline FareToken stringToToken(std::string str) {
138 if (str == "H") {
139 return FareToken::H;
140 }
141 if (str == "L") {
142 return FareToken::L;
143 }
144 if (str == "T1") {
145 return FareToken::T1;
146 }
147 if (str == "T2") {
148 return FareToken::T2;
149 }
150 if (str == "T3") {
151 return FareToken::T3;
152 }
153 if (str == "1") {
154 return FareToken::T1;
155 }
156 if (str == "2") {
157 return FareToken::T2;
158 }
159 if (str == "3") {
160 return FareToken::T3;
161 }
162 if (str == "U") {
163 return FareToken::U;
164 }
165 if (str == "Z") {
166 return FareToken::Z;
167 }
168 if (str == "M") {
169 return FareToken::M;
170 }
171 if (str == "K") {
172 return FareToken::K;
173 }
174 if (str == "KL") {
175 return FareToken::KL;
176 }
177 if (str == "KH") {
178 return FareToken::KH;
179 }
180 if (str == "ZU") {
181 return FareToken::ZU;
182 }
183 if (str == "None") {
184 return FareToken::None;
185 }
186 if (str == "Free") {
187 return FareToken::Free;
188 }
189 if (str == "KHU") {
190 return FareToken::KHU;
191 }
192 if (str == "KLU") {
193 return FareToken::KLU;
194 }
195 if (str == "KHZ") {
196 return FareToken::KHZ;
197 }
198 if (str == "KLZ") {
199 return FareToken::KLZ;
200 }
201 if (str == "NOTFOUND") {
202 return FareToken::None;
203 }
204 assert(false);
205 return FareToken::None;
206}
207
208}
FareToken
Definition FareToken.h:23
std::string tokenToTicket(FareToken const &token)
Definition FareToken.h:93
std::string tokenToString(FareToken const &token)
Definition FareToken.h:49
FareToken stringToToken(std::string str)
Definition FareToken.h:137