linkproperty.h

来自「模拟P2P各种网络环境的,适合新手们的学习,不错的源码.」· C头文件 代码 · 共 49 行

H
49
字号
#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 + =
减小字号Ctrl + -
显示快捷键?