2023-04-24 15:31:46 +02:00
|
|
|
#pragma once
|
|
|
|
#include <iostream>
|
|
|
|
#include "configuration.h"
|
2023-05-15 14:05:55 +02:00
|
|
|
#include <QDateTime>
|
2023-04-24 15:31:46 +02:00
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class Calculator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/// <summary>
|
|
|
|
/// Gets duration in seconds from cost
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="tariff_cfg">Pointer to configuration</param>
|
|
|
|
/// <param name="vehicle_type">Type of vehicle</param>
|
|
|
|
/// <param name="start_datetime">Date/time of payment to be conducted in ISO8601 format (e.g. 2022-12-25T08:00:00Z)</param>
|
|
|
|
/// <param name="price"></param>
|
|
|
|
/// <returns>Returns duration in seconds (data type: double)</returns>
|
|
|
|
std::string GetDurationFromCost(Configuration* cfg, uint8_t vehicle_type, char const* start_datetime, double price, bool nextDay = false, bool prepaid = false);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets cost from duration in seconds
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="tariff_cfg">Pointer to configuration</param>
|
|
|
|
/// <param name="vehicle_type">Type of vehicle</param>
|
|
|
|
/// <param name="start_datetime">Date/time of payment to be conducted in ISO8601 format (e.g. 2022-12-25T08:00:00Z) </param>
|
2023-05-16 15:31:53 +02:00
|
|
|
/// <param name="end_datetime">Date/time of park end to be conducted in ISO8601 format (e.g. 2022-12-25T08:00:00Z) </param>
|
2023-04-24 15:31:46 +02:00
|
|
|
/// <param name="durationMin">Duration of parking in minutes</param>
|
|
|
|
/// <returns>Returns cost (data type: double)</returns>
|
2023-05-16 15:31:53 +02:00
|
|
|
double GetCostFromDuration(Configuration* cfg, uint8_t vehicle_type, const QDateTime start_datetime, QDateTime & end_datetime, double durationMin, bool nextDay = false, bool prepaid = false);
|
2023-05-15 14:05:55 +02:00
|
|
|
|
|
|
|
// Daily ticket
|
2023-05-16 16:43:45 +02:00
|
|
|
QDateTime GetDailyTicketDuration(Configuration* cfg, const QDateTime start_datetime, uint8_t payment_option, bool carry_over);
|
2023-10-11 15:38:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// helper functions for Schoenau
|
|
|
|
//
|
|
|
|
QList<int> GetTimeSteps(Configuration const *cfg, int paymentOption);
|
|
|
|
//
|
|
|
|
double GetPriceForTimeStep(Configuration const *cfg, int paymentOption, int timeStep);
|
2023-05-15 14:05:55 +02:00
|
|
|
};
|