auto_bus/include/busModel.h

162 lines
3.2 KiB
C
Raw Normal View History

2022-06-11 19:05:06 +08:00
//
// Created by ricardo on 2022/6/10.
//
#ifndef AUTO_BUS_GUI_BUS_MODEL_H
#define AUTO_BUS_GUI_BUS_MODEL_H
#include "railsModel.h"
#include "queryModel.h"
#include "define.h"
#include "cstdio"
2022-06-11 19:05:06 +08:00
#include "string"
#include "sstream"
2022-06-25 16:35:07 +08:00
#include "QObject"
2022-06-11 19:05:06 +08:00
2022-06-25 16:35:07 +08:00
/**
* QObject
*/
class BusControllerModel : public QObject
2022-06-11 19:05:06 +08:00
{
2022-06-25 16:35:07 +08:00
Q_OBJECT
2022-06-11 19:05:06 +08:00
public:
/**
*
*/
rail_node_t *rail_pos;
/**
*
*/
int distance;
/**
*
*/
int direction;
2022-06-17 12:18:43 +08:00
/**
2022-06-25 16:35:07 +08:00
*
2022-06-17 12:18:43 +08:00
*/
int bus_time;
2022-06-11 19:05:06 +08:00
/**
*
*/
RailsModel *rail_manager;
/**
*
*/
QueryModel *query_manager;
/**
*
*/
int chosen_strategy = -1;
2022-06-11 19:05:06 +08:00
/**
*
*
2022-06-11 19:05:06 +08:00
*/
BusControllerModel();
2022-06-11 19:05:06 +08:00
/**
*
*/
~BusControllerModel();
std::string PrintState();
bool JudgeOnStation();
2022-06-11 19:05:06 +08:00
2022-06-25 16:35:07 +08:00
public slots:
/**
*
* @param file_name
*/
void ReadConfigFileSlot(const QString& file_name);
2022-06-11 19:05:06 +08:00
private:
2022-06-17 12:18:43 +08:00
/**
*
*/
int total_distance = 10;
/**
*
* @return
*/
2022-06-11 19:05:06 +08:00
int GetBusPosition() const;
/**
*
* @param file_name
*/
void ReadConfigFile(const std::string& file_name);
/**
*
* @param query
* @param orientation BUS_CLOCK_WISE BUS_COUNTER_CLOCK_WISE
* @return
*/
int GetQueryDistance(bus_query_t *query, int orientation) const;
/**
*
* @return
*/
int FCFSDirection() const;
/**
*
* @return
*/
bus_query_t *FCFSQuery() const;
/**
* SSTF策略下应该处理的请求
* @return
*/
bus_query_t *SSTFGetQuery();
/**
*
* SSTF策略中使用
* @param query
* @return
*/
int SSTFDirection(bus_query_t* query);
/**
* 便
* @return
*/
2022-06-17 12:18:43 +08:00
bus_query_t *SSTFBTWQuery() const;
/**
* SCAN策略下应该处理的请求
* @return
*/
bus_query_t *SCANGetQuery();
/**
*
* SCAN策略中使用
* @param query
* @return
*/
int SCANDirection(bus_query_t *query);
/**
* 便
* @return
*/
bus_query_t *SCANBTWQuery() const;
2022-06-11 19:05:06 +08:00
};
#endif //AUTO_BUS_GUI_BUS_MODEL_H