auto_bus/include/railsModel.h

84 lines
1.4 KiB
C
Raw Normal View History

2022-06-10 21:21:35 +08:00
//
// Created by ricardo on 2022/6/10.
//
2022-06-11 19:04:47 +08:00
#ifndef AUTO_BUS_GUI_RAILS_MODEL_H
#define AUTO_BUS_GUI_RAILS_MODEL_H
2022-06-10 21:21:35 +08:00
#include "cstdlib"
struct rail_node{
/**
*
*/
int id;
2022-06-29 17:25:33 +08:00
2022-06-10 21:21:35 +08:00
/**
*
*/
int last_node_distance;
2022-06-29 17:25:33 +08:00
2022-06-10 21:21:35 +08:00
/**
*
*/
int next_node_distance;
2022-06-29 17:25:33 +08:00
2022-06-10 21:21:35 +08:00
/**
*
*/
struct rail_node* last_node;
2022-06-29 17:25:33 +08:00
2022-06-10 21:21:35 +08:00
/**
*
*/
struct rail_node* next_node;
};
typedef struct rail_node rail_node_t;
class RailsModel
{
public:
/**
*
*/
rail_node_t *rails;
/**
2022-06-26 13:06:22 +08:00
*
*/
2022-06-26 13:06:22 +08:00
int node_num;
2022-06-29 17:25:33 +08:00
/**
*
*/
2022-06-27 14:21:07 +08:00
int total_distance;
2022-06-26 13:06:22 +08:00
explicit RailsModel();
~RailsModel();
/**
*
* @param head
* @param id
* @return
*/
rail_node_t *FindNode(int node_id) const;
2022-06-10 21:21:35 +08:00
2022-06-26 13:06:22 +08:00
/**
*
* @param distance
* @param node_number
*/
void CreateRails(int distance, int node_number);
2022-06-10 21:21:35 +08:00
2022-06-26 13:06:22 +08:00
/**
*
*/
void FreeRails();
2022-06-10 21:21:35 +08:00
};
2022-06-11 19:04:47 +08:00
#endif //AUTO_BUS_GUI_RAILS_MODEL_H