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

📄 aaconnection.h

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

#define protect protected
#include "Common.h"

class Connection;
class Agent;
class AAConnection;
ostream &operator<<(ostream &os, const AAConnection &connection);

class AAConnection
{
protect:	
	bool mActive;
	bool mLock; /* flag for bandwidth limitation, not have meaning here, always true */

	Agent *mSource;
	Agent *mDestination;
	
	unsigned long mBandwidth;
	unsigned long mBandwidthAtoB;
	unsigned long mBandwidthBtoA;
	unsigned long mBandwidthLock; /* the maxmum bandwidth you limited, if you don't want to limit bandwidth, just gave it a large value */
	
	Connection *mConnection;
public:
	 friend ostream &operator<<(ostream &os, const AAConnection &connection);
	AAConnection(Agent *agent1, Agent *agent2);
	virtual ~AAConnection();
	
	bool isActive() const;
	unsigned long getBandwidth() const;
	unsigned long getBandwidthFrom(const Agent *agent) const;
	void setBandwidthFrom(const Agent *agent, unsigned long bandwidth);

	bool isLock() const;
	unsigned long getLockValue() const;

	virtual long long adjustBandwidth(long long value, bool flag = false);
	
	void activate(unsigned long value = UINT_MAX);
	void inactivate();
	
};

#endif

⌨️ 快捷键说明

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