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

📄 linkproperty.cpp

📁 模拟P2P各种网络环境的,适合新手们的学习,不错的源码.
💻 CPP
字号:
#include "LinkProperty.h"

ostream &operator<<(ostream &os, const LinkProperty &property)
{
	os << property.mType << ' ' << property.mDirection << ' '  << property.mDistance << ' ' << property.mDelay << ' ' << property.mBandwidth << ' ' << property.mCost << ' ' << property.mLable;
	return os;
}

LinkProperty::LinkProperty(): mType(INV_LIN), mDirection(false), mDistance(0), mDelay(0), mBandwidth(0), mCost(0)
{ }

LinkProperty::LinkProperty(unsigned long distance, unsigned long delay, unsigned long bandwidth, unsigned long cost): mType(INV_LIN), mDirection(false)
{
	mDistance = distance;
	mDelay = delay;
	mBandwidth = bandwidth;
	mCost = cost;
}
void LinkProperty::setType(int type)
{ mType = type; }

int LinkProperty::getType() const
{ return mType; }

void LinkProperty::setDirection(bool direction)
{ mDirection = direction; }

bool LinkProperty::getDirection() const
{ return mDirection; }

void LinkProperty::setDistance(unsigned long distance)
{ mDistance = distance; }

unsigned long LinkProperty::getDistance() const
{ return mDistance; }

void LinkProperty::setDelay(unsigned long delay)
{ mDelay = delay; }

unsigned long LinkProperty::getDelay() const
{ return mDelay; }

void LinkProperty::setBandwidth(unsigned long bandwidth)
{ mBandwidth = bandwidth; }

unsigned long LinkProperty::getBandwidth() const
{ return mBandwidth; }

void LinkProperty::setCost(unsigned long cost)
{ mCost = cost; }

unsigned long LinkProperty::getCost() const
{ return mCost; }

void LinkProperty::setLable(string lable)
{ mLable = lable; }

string LinkProperty::getLable() const
{ return mLable; }

⌨️ 快捷键说明

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