auto_bus/include/busModel.h

114 lines
2.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"
class BusControllerModel
{
public:
/**
*
*/
rail_node_t *rail_pos;
/**
*
*/
int distance;
/**
*
*/
int direction;
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
private:
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
*/
bus_query_t *SSTFBTWQuery();
2022-06-11 19:05:06 +08:00
};
#endif //AUTO_BUS_GUI_BUS_MODEL_H