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

📄 vconnection.h

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

#include "Common.h"
#include "VLink.h"
class Agent;
class Topology;

class VConnection;
ostream &operator<<(ostream &os, const VConnection &connection);

class VConnection
{
protect:
	bool mActive;
	
	Agent *mSource;
	Agent *mDestination;

	unsigned long mBandwidth;
	vector<VLink *> mLink;

	static Topology *mTopology;
	static set<VConnection *> mConnection;
	static set<VLink *> mLinkAdjust;
	
	unsigned long minAverageBandwidth();
	unsigned long minAverageBandwidthA();
	unsigned long minAvailableBandwidth();
public:
	friend ostream &operator<<(ostream &os, const VConnection &connection);
	VConnection(Agent *agent1, Agent *agent2);
	virtual ~VConnection();
	
	void addConnection();
	void removeConnection();

	void activate();
	void inactivate();
	
	virtual long long adjustBandwidth(long long value);
	void reallocate();
	
	bool isActive()
	{ return mActive; }
	unsigned long getBandwidth()
	{ return  mBandwidth; }
};

#endif

⌨️ 快捷键说明

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