加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
flit.h 1.78 KB
一键复制 编辑 原始数据 按行查看 历史
Hic 提交于 2022-09-22 16:55 . 增加丢包功能
#ifndef SIM_FLIT_H_
#define SIM_FLIT_H_
#include "index.h"
#include "SStd.h"
#include <vector>
#include <iostream>
#include <vector>
//数据包,用于整个网络传递,从发送方到接收方
//最大尺寸是预设的,若超过要分片传输
class flit_template
{
public:
//changed at 2022-9-22
//增加了数据包id
typedef long TFlitId;
typedef size_t TPacketId;
friend ostream& operator<<(ostream& os, const flit_template & ft);
private:
TFlitId flit_id_;
flit_type type_;
add_type sor_addr_;
add_type des_addr_;
time_type start_time_;
time_type finish_time_;
Data_type data_;
TPacketId packet_id;
public:
TFlitId flit_id() {return flit_id_;}
TFlitId flit_id() const {return flit_id_;}
flit_type type() {return type_;}
flit_type type() const {return type_;}
add_type & sor_addr() {return sor_addr_;}
const add_type & sor_addr() const {return sor_addr_;}
add_type & des_addr() {return des_addr_;}
const add_type & des_addr() const {return des_addr_;}
time_type start_time() {return start_time_;}
time_type start_time() const {return start_time_;}
time_type finish_time() {return finish_time_;}
time_type finish_time() const {return finish_time_;}
void set_start(time_type a) {start_time_ = a;}
void set_finish(time_type a) {finish_time_ = a;}
Data_type & data() {return data_;}
const Data_type & data() const {return data_;}
TPacketId getPacketId()const
{
return packet_id;
}
flit_template();
flit_template(long a, flit_type b, add_type & c, add_type & d,
time_type e, const Data_type & f,TPacketId packetId);
flit_template(const flit_template & a);
};
//changed at 2020-5-9
bool isHeader(flit_type ft);
bool isTail(flit_type ft);
//changed at 2020-5-23
ostream&operator<<(ostream&os,const add_type&address);
#endif
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化