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

📄 link.h

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

#define protect protected
#include "Common.h"
#include "LinkProperty.h"
#include "BandwidthManager.h"

class Link;
ostream &operator<<(ostream &os, const Link &link);

class Link
{
protect:
	int mFrom;
	int mTo;
	
	BandwidthManager mBandwidthManager; /* manage the bandwidth information of this link; */
	LinkProperty mLinkProperty; /* additional information of this link; */
public:
	friend ostream &operator<<(ostream &os, const Link &link);
	Link();
	Link(int from, int to);

	void setType(int type);
	int getType() const;
	void setDirection(bool direction);
	bool getDirection() const;
	void setFrom(int from);
	int from() const; /* get the id of "from node"; */
	void setTo(int to);
	int to() const; /* get the id of "to node"; */
	
	void reset(); /* reset bandwidth manager; */
	void turnAround(); /* turn the link around; */
	
	void setBandwidth(unsigned long bandwidth);
	void setDelay(unsigned long delay);
	
	void setProperty(const LinkProperty &property);
	LinkProperty &getProperty(); /* get link property; */
	void setBandwidthManager(const BandwidthManager &bandwidthManager);
	BandwidthManager &getBandwidthManager();

};

#endif

⌨️ 快捷键说明

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