初步概要设计完成

This commit is contained in:
jackfiled 2022-05-06 11:55:30 +08:00
parent e012ae27f2
commit 05230bc0da
11 changed files with 232 additions and 2 deletions

View File

@ -17,7 +17,7 @@ auto_pilot_bus
|
+-include // 头文件文件夹
|
+-lib // 源代码文件夹
+-src // 源代码文件夹
|
+-main.c // 程序入口
+-CMakeLists.txt // CMake文件

View File

@ -1,7 +1,9 @@
#ifndef AUTO_PILOT_BUS_BUS_H
#define AUTO_PILOT_BUS_BUS_H
#include "define.h"
#include "rail.h"
#include "query.h"
struct {
/**
@ -19,4 +21,24 @@ struct {
*/
typedef struct bus bus_t;
/**
* 使
* @param rails
* @param direction
* @return
*/
int RunBus(rail_node_t* rails, int direction);
/**
*
* @param rail_node
*/
void UpBus(rail_node_t* rail_node);
/**
*
* @param rail_node
*/
void DownBus(rail_node_t* rail_node);
#endif //AUTO_PILOT_BUS_BUS_H

37
include/controller.h Normal file
View File

@ -0,0 +1,37 @@
//
// Created by ricardo on 2022/5/6.
//
#ifndef AUTO_PILOT_BUS_CONTROLLER_H
#define AUTO_PILOT_BUS_CONTROLLER_H
#include "rail.h"
#include "query.h"
/**
*
* @param rails
* @param up_queries
* @param down_queries
* @return
*/
int FCFSFunction(rail_node_t rails, up_bus_t up_queries, down_bus_t down_queries);
/**
*
* @param rails
* @param up_queries
* @param down_queries
* @return
*/
int SSTFFunction(rail_node_t rails, up_bus_t up_queries, down_bus_t down_queries);
/**
* 便
* @param rails
* @param up_queries
* @param down_queries
* @return
*/
int SCANFunction(rail_node_t rails, up_bus_t up_queries, down_bus_t down_queries);
#endif //AUTO_PILOT_BUS_CONTROLLER_H

13
include/define.h Normal file
View File

@ -0,0 +1,13 @@
//
// Created by ricardo on 2022/5/6.
//
#ifndef AUTO_PILOT_BUS_DEFINE_H
#define AUTO_PILOT_BUS_DEFINE_H
#define CLOCK_WISE 0
#define COUNTER_CLOCK_WISE 1
#define TRUE 1
#define FAlSE 0
#endif //AUTO_PILOT_BUS_DEFINE_H

52
include/io.h Normal file
View File

@ -0,0 +1,52 @@
//
// Created by ricardo on 2022/5/6.
//
#ifndef AUTO_PILOT_BUS_IO_H
#define AUTO_PILOT_BUS_IO_H
#include "rail.h"
#include "query.h"
enum read_state{
/**
*
*/
clock = 0,
/**
*
*/
reading,
/**
*
*/
end
};
/**
*
*/
typedef enum read_state read_state_t;
/**
* 使
* @return
*/
rail_node_t* ReadConfigFile();
/**
*
* @param up_queries
* @param down_queries
* @return
*/
read_state_t ReadInput(up_bus_t* up_queries, down_bus_t* down_queries);
/**
*
* @param up_queries
* @param down_queries
* @param rails
*/
void PrintState(up_bus_t* up_queries, down_bus_t* down_queries, rail_node_t* rails);
#endif //AUTO_PILOT_BUS_IO_H

74
include/query.h Normal file
View File

@ -0,0 +1,74 @@
//
// Created by ricardo on 2022/5/6.
//
#ifndef AUTO_PILOT_BUS_QUERY_H
#define AUTO_PILOT_BUS_QUERY_H
#include "rail.h"
struct {
/**
*
*/
int id;
/**
*
*/
int direction;
/**
*
*/
rail_node_t* target;
struct up_bus* next;
} up_bus;
struct {
/**
*
*/
int id;
/**
*
*/
rail_node_t* target;
struct down_bus* next;
} down_bus;
/**
*
*/
typedef struct up_bus up_bus_t;
/**
*
*/
typedef struct down_bus down_bus_t;
extern up_bus_t *up_queries;
extern down_bus_t *down_queries;
/**
*
* @param target
* @param direction
*/
void CreateUpBusQuery(rail_node_t* target, int direction);
/**
*
* @param id
*/
void DeleteUpBusQuery(int id);
/**
*
* @param target
*/
void CreateDownBusQuery(rail_node_t *target);
/**
*
* @param id
*/
void DeleteDownBusQuery(int id);
#endif //AUTO_PILOT_BUS_QUERY_H

View File

@ -1,5 +1,6 @@
#ifndef AUTO_PILOT_BUS_RAIL_H
#define AUTO_PILOT_BUS_RAIL_H
#include "bus.h"
struct {
/**
@ -14,6 +15,10 @@ struct {
*
*/
int next_node_distance;
/**
*
*/
bus_t* bus;
/**
*
*/
@ -29,4 +34,13 @@ struct {
*/
typedef struct rail_node rail_node_t;
extern rail_node_t* rails;
/**
*
* @param id
* @return
*/
rail_node_t *FindNode(int id);
#endif //AUTO_PILOT_BUS_RAIL_H

4
src/controller.c Normal file
View File

@ -0,0 +1,4 @@
//
// Created by ricardo on 2022/5/6.
//
#include "controller.h"

4
src/io.c Normal file
View File

@ -0,0 +1,4 @@
//
// Created by ricardo on 2022/5/6.
//
#include "io.h"

8
src/query.c Normal file
View File

@ -0,0 +1,8 @@
//
// Created by ricardo on 2022/5/6.
//
#include "query.h"
up_bus_t* up_queries;
down_bus_t *down_queries;

View File

@ -1 +1,3 @@
#include "rail.h"
#include "rail.h"
rail_node_t *rails;