⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 linkproperty.h

📁 模拟P2P各种网络环境的,适合新手们的学习,不错的源码.
💻 H
字号:
#ifndef _LinkProperty_h
#define _LinkProperty_h

#define INV_LIN -1 /* invalid link */
#define STU_STU 0 /* stub-stub link */
#define STU_TRA 1 /* stub-transit or transit-stub link */
#define TRA_TRA_INTRA 2 /*intra transit-transit link */
#define TRA_TRA_INTER 3 /* inter transit-transit link */
#define VIR_LIN 4 /* virtual link */

#include "Common.h"

class LinkProperty;
ostream &operator<<(ostream &os, const LinkProperty &property);

class LinkProperty
{
private:
	int mType; /* s-s link or s-t link or t-t link */
	bool mDirection; /* directional link or not */
	
	unsigned long mDistance;
	unsigned long mDelay;
	unsigned long mBandwidth;
	unsigned long mCost;
	
	string mLable;
public:
	friend ostream &operator<<(ostream &os, const LinkProperty &property);
	LinkProperty();
	LinkProperty(unsigned long distance, unsigned long delay, unsigned long bandwidth, unsigned long cost);
	void setType(int type);
	int getType() const;
	void setDirection(bool direction);
	bool getDirection() const;
	void setDistance(unsigned long distance);
	unsigned long getDistance() const;
	void setDelay(unsigned long delay);
	unsigned long getDelay() const;
	void setBandwidth(unsigned long bandwidth);
	unsigned long getBandwidth() const;
	void setCost(unsigned long cost);
	unsigned long getCost() const;
	void setLable(string lable);
	string getLable() const;
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -