6#ifndef carLocTypes_enum
7#define carLocTypes_enum
11#include "../util/vector.h"
12#include "../util/error.h"
19 static const int carTypeN = 5;
47 static const std::string carTypeStrings[] = {
56 static const CarType carTypeArray[] = {
74 for (
auto c : carTypeArray) {
75 carTypeVector.push_back(c);
82 static const std::map<std::string, CarType> carTypeMap = {
101 return carTypeStrings[
static_cast<int>(type)];
117 auto it = carTypeMap.find(cartype);
118 if (it == carTypeMap.end()) {
120 "\nInvalid car type");
138 if (cartype < 0 || cartype >= carTypeN) {
140 "\nInvalid car type");
142 return carTypeArray[cartype];
157 ss << carTypeStrings[static_cast<int>(obj)];
166 static const int powerTypeN = 7;
217 static const std::string powerTypeStrings[] = {
219 "Electric Locomotive",
220 "Biodiesel Locomotive",
221 "Diesel-Electric Locomotive",
222 "Diesel-Hybrid Locomotive",
223 "Hydrogen-Hybrid Locomotive",
224 "Biodiesel-Hybrid Locomotive"
228 static const PowerType powerTypeArray[] = {
239 static const std::map<std::string, PowerType> powerTypeMap = {
250 static const std::map<PowerType, CarType> powerToCarMap = {
270 return powerTypeStrings[
static_cast<int>(type)];
286 auto it = powerTypeMap.find(powertype);
287 if (it == powerTypeMap.end()) {
289 "\nInvalid locomotive type");
307 if (powertype < 0 || powertype >= powerTypeN) {
309 "\nInvalid locomotive type");
311 return powerTypeArray[powertype];
326 ss << powerTypeStrings[static_cast<int>(obj)];
335 static const int powerMethodN = 2;
346 static const std::string powerMethodsStrings[] = {
348 "Series Hybrid Power",
349 "Parallel Hybrid Power"
359 static const std::map<std::string, LocomotivePowerMethod> powerMethodMap = {
379 auto it = powerMethodMap.find(powertype);
380 if (it == powerMethodMap.end()) {
382 "\nInvalid locomotive type");
400 if (powertype < 0 || powertype >= powerMethodN) {
402 "\nInvalid locomotive type");
404 return powerMethodArray[powertype];
419 ss << powerMethodsStrings[static_cast<int>(obj)];
429 static const int fuelN = 4;
442 static const std::string fuelStrings[] = {
445 "Hydrogen-Hyprid Fuel",
450 static const FuelType fuelArray[] = {
458 static const std::map<std::string, FuelType> fuelMap = {
466 static const std::map<PowerType, FuelType> powerToFuelMap = {
476 static const std::map<CarType, FuelType> carToFuelMap = {
485 return fuelStrings[
static_cast<int>(type)];
489 auto it = powerToFuelMap.find(theType);
490 if (it != powerToFuelMap.end()) {
493 throw std::invalid_argument(
"Invalid PowerType");
A vector.
Definition vector.h:24
Definition traintypes.h:16
std::ostream & operator<<(std::ostream &ss, const CarType &obj)
Stream insertion operator.
Definition traintypes.h:156
_fuelTypes FuelType
Type of the fuel.
Definition traintypes.h:439
_LocomotivePowerMethod
Values that represent power types.
Definition traintypes.h:337
_LocomotivePowerMethod LocomotivePowerMethod
Type of the power.
Definition traintypes.h:344
LocomotivePowerMethod strToPowerMethod(std::string powertype)
Converts a string to a power method.
Definition traintypes.h:378
std::string PowerTypeToStr(PowerType type)
Power type to string.
Definition traintypes.h:269
std::string carTypeToStr(CarType type)
Car type to string.
Definition traintypes.h:100
_PowerType
Values that represent power types.
Definition traintypes.h:168
_CarType CarType
Type of the car.
Definition traintypes.h:32
CarType itoCarType(int cartype)
Ito car type.
Definition traintypes.h:137
_fuelTypes
Values that represent fuel types.
Definition traintypes.h:431
PowerType strToPowerType(std::string powertype)
Converts a powertype to a power type.
Definition traintypes.h:285
LocomotivePowerMethod iToPowerMethod(int powertype)
Converts a powertype to a power type.
Definition traintypes.h:399
FuelType getFuelTypeFromPowerType(PowerType theType)
Definition traintypes.h:488
Vector< CarType > getCarTypeVector()
Gets car type vector.
Definition traintypes.h:72
PowerType iToPowerType(int powertype)
Converts a powertype to a power type.
Definition traintypes.h:306
std::string fuelTypeToStr(FuelType type)
Definition traintypes.h:484
_PowerType PowerType
Type of the power.
Definition traintypes.h:179
_CarType
Values that represent car types.
Definition traintypes.h:23
CarType strtoCarType(const std::string &cartype)
Strto car type.
Definition traintypes.h:116