📄 link.cpp
字号:
#include "Link.h"
ostream &operator<<(ostream &os, const Link &link)
{
return os << link.mFrom << '\t' << link.mTo << '\t' << link.getType() << '\t' << link.mLinkProperty.getDirection() << '\t' << link.mLinkProperty.getDelay() << '\t' << link.mLinkProperty.getBandwidth() << '\t' << "****"<< '\t' << link.mLinkProperty.getLable();
}
Link::Link(): mFrom(-1), mTo(-1)
{ }
Link::Link(int from, int to): mFrom(from), mTo(to)
{ }
void Link::setType(int type)
{ mLinkProperty.setType(type); }
int Link::getType() const
{ return mLinkProperty.getType(); }
void Link::setDirection(bool direction)
{ mLinkProperty.setDirection(direction); }
bool Link::getDirection() const
{ return mLinkProperty.getDirection(); }
void Link::setFrom(int from)
{ mFrom = from; }
int Link::from() const /* get the id of "from node"; */
{ return mFrom; }
void Link::setTo(int to)
{ mTo = to; }
int Link::to() const /* get the id of "to node"; */
{ return mTo; }
void Link::reset() /* reset bandwidth manager ********use it?*******; */
{
mBandwidthManager.setBandwidth(mLinkProperty.getBandwidth());
mBandwidthManager.reset();
}
void Link::turnAround() /* turn the link around; */
{ int temp = mFrom; mFrom = mTo; mTo = temp; }
void Link::setProperty(const LinkProperty &property) /* set link property */
{ mLinkProperty = property; }
LinkProperty &Link::getProperty() /* get link property; */
{ return mLinkProperty; }
void Link::setBandwidth(unsigned long bandwidth)
{
mLinkProperty.setBandwidth(bandwidth);
mBandwidthManager.setBandwidth(bandwidth);
}
void Link::setDelay(unsigned long delay)
{ mLinkProperty.setDelay(delay); }
void Link::setBandwidthManager(const BandwidthManager &bandwidthManager)
{ mBandwidthManager = bandwidthManager; }
BandwidthManager &Link::getBandwidthManager()
{ return mBandwidthManager; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -