randomgenerator.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef RANDOMGENERATOR_H
  2. #define RANDOMGENERATOR_H
  3. #include "src/database/flightentry.h"
  4. namespace OPL {
  5. /*!
  6. * \brief The RandomGenerator class generates random data for testing and debugging purposes.
  7. * \details Using the randomFlight() method it is possible to generate a random flight with
  8. * pilot and tail details already present in the database. For this to work, there cannot be any
  9. * gaps in the database, i.e. the row_id must be rising uninterruptedly. If this cannot be guaranteed,
  10. * use pass safe_mode = true as an argument when creating instantiating the generator.
  11. */
  12. class RandomGenerator
  13. {
  14. public:
  15. RandomGenerator(bool safe_mode = false);
  16. const FlightEntry randomFlight();
  17. const QTime randomTime();
  18. const QDate randomDate();
  19. const QDateTime randomDateTime();
  20. const QString randomAirport();
  21. const int randomPilot();
  22. const int randomTail();
  23. const bool randomBool();
  24. private:
  25. bool safeMode = false;
  26. const static inline QStringList m_function_times = {
  27. OPL::FlightEntry::TPIC,
  28. OPL::FlightEntry::TPICUS,
  29. OPL::FlightEntry::TSIC,
  30. OPL::FlightEntry::TDUAL,
  31. OPL::FlightEntry::TFI,
  32. };
  33. int m_numberOfPilots;
  34. int m_numberOfAirports;
  35. int m_numberOfTails;
  36. };
  37. } // namespace OPL
  38. #endif // RANDOMGENERATOR_H