vconnection.h

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

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