--- a/src/Common/QosCube.cc
+++ b/src/Common/QosCube.cc
@@ -174,96 +174,7 @@
}
std::ostream& operator <<(std::ostream& os, const QosCube& cube) {
- if (cube.getQosId())
- os << "QoSCube Id> " << cube.getQosId();
- else
- os << "QoS Parameters List>";
-
- os << "\n average BW = ";
- if ( cube.getAvgBand() < 0)
- os << STR_DONOTCARE;
- else
- os << cube.getAvgBand() << " bit/s";
-
- os << "\n average SDU BW = ";
- if (cube.getAvgSduBand() < 0)
- os << STR_DONOTCARE;
- else
- os << cube.getAvgSduBand() << " SDU/s";
-
- os << "\n peak BW duration = ";
- if (cube.getPeakBandDuration() < 0)
- os << STR_DONOTCARE;
- else
- os << cube.getPeakBandDuration() << " bit/s";
-
- os << "\n peak SDU BW duration = ";
- if ( cube.getPeakSduBandDuration() < 0)
- os << STR_DONOTCARE;
- else
- os << cube.getPeakSduBandDuration() << " SDU/s";
-
- os << "\n burst period = ";
- if ( cube.getBurstPeriod() < 0 )
- os << STR_DONOTCARE;
- else
- os << cube.getBurstPeriod() << " usecs";
-
- os << "\n burst duration = ";
- if ( cube.getBurstDuration() < 0 )
- os << STR_DONOTCARE;
- else
- os << cube.getBurstDuration() << " usecs";
-
- os << "\n undetect. bit errors = ";
- if ( cube.getUndetectedBitErr() < 0 )
- os << STR_DONOTCARE;
- else
- os << cube.getUndetectedBitErr() << "%";
-
- os << "\n max SDU Size = ";
- if ( cube.getMaxSduSize() < 0 )
- os << STR_DONOTCARE;
- else
- os << cube.getMaxSduSize() << " B";
-
- os << "\n partial delivery = " << (cube.isPartialDelivery() ? STR_YES : STR_NO );
-
- os << "\n incomplete delivery = " << (cube.isIncompleteDelivery() ? STR_YES : STR_NO );
-
- os << "\n force order = " << (cube.isForceOrder() ? STR_YES : STR_NO );
-
- os << "\n max allowed gap = ";
- if ( cube.getMaxAllowGap() < 0 )
- os << STR_DONOTCARE;
- else
- os << cube.getMaxAllowGap() << " SDUs";
-
- os << "\n delay = ";
- if ( cube.getDelay() < 0 )
- os << STR_DONOTCARE;
- else
- os << cube.getDelay() << " usecs";
-
- os << "\n jitter = ";
- if ( cube.getJitter() < 0 )
- os << STR_DONOTCARE;
- else
- os << cube.getJitter() << " usecs";
-
- os << "\n cost-time = ";
- if ( cube.getCostTime() < 0 )
- os << STR_DONOTCARE;
- else
- os << cube.getCostTime() << " $/ms";
-
- os << "\n cost-bits = ";
- if ( cube.getCostBits() < 0 )
- os << STR_DONOTCARE;
- else
- os << cube.getCostBits() << " $/Mb";
-
- return os;
+ return os << cube.info();
}
short QosCube::countFeasibilityScore(const QosCube templ) const {
@@ -288,28 +199,28 @@
EV << "CostBits> \t" << getCostBits() << " / " << templ.getCostBits() << endl;
*/
- if (getAvgBand() != VAL_QOSPARAMDONOTCARE)
+ if (getAvgBand() != VAL_QOSPARDONOTCARE)
(getAvgBand() <= templ.getAvgBand()) ? score++ : score--;
- if (getAvgSduBand() != VAL_QOSPARAMDONOTCARE)
+ if (getAvgSduBand() != VAL_QOSPARDONOTCARE)
(getAvgSduBand() <= templ.getAvgSduBand()) ? score++ : score--;
- if (getPeakBandDuration() != VAL_QOSPARAMDONOTCARE)
+ if (getPeakBandDuration() != VAL_QOSPARDONOTCARE)
(getPeakBandDuration() <= templ.getPeakBandDuration()) ? score++ : score--;
- if (getPeakSduBandDuration() != VAL_QOSPARAMDONOTCARE)
+ if (getPeakSduBandDuration() != VAL_QOSPARDONOTCARE)
(getPeakSduBandDuration() <= templ.getPeakSduBandDuration()) ? score++ : score--;
- if (getBurstPeriod() != VAL_QOSPARAMDONOTCARE)
+ if (getBurstPeriod() != VAL_QOSPARDONOTCARE)
(getBurstPeriod() <= templ.getBurstPeriod()) ? score++ : score--;
- if (getBurstDuration() != VAL_QOSPARAMDONOTCARE)
+ if (getBurstDuration() != VAL_QOSPARDONOTCARE)
(getBurstDuration() <= templ.getBurstDuration()) ? score++ : score--;
- if (getUndetectedBitErr() != VAL_QOSPARAMDONOTCARE)
+ if (getUndetectedBitErr() != VAL_QOSPARDONOTCARE)
(getUndetectedBitErr() <= templ.getUndetectedBitErr()) ? score++ : score--;
- if (getMaxSduSize() != VAL_QOSPARAMDONOTCARE)
+ if (getMaxSduSize() != VAL_QOSPARDONOTCARE)
(getMaxSduSize() <= templ.getMaxSduSize()) ? score++ : score--;
(isPartialDelivery() == templ.isPartialDelivery()) ? score++ : score--;
@@ -318,20 +229,114 @@
(isForceOrder() == templ.isForceOrder()) ? score++ : score--;
- if (getMaxAllowGap() != VAL_QOSPARAMDONOTCARE)
+ if (getMaxAllowGap() != VAL_QOSPARDONOTCARE)
(getMaxAllowGap() <= templ.getMaxAllowGap()) ? score++ : score--;
- if (getDelay() != VAL_QOSPARAMDONOTCARE)
+ if (getDelay() != VAL_QOSPARDONOTCARE)
(getDelay() <= templ.getDelay()) ? score++ : score--;
- if (getJitter() != VAL_QOSPARAMDONOTCARE)
+ if (getJitter() != VAL_QOSPARDONOTCARE)
(getJitter() <= templ.getJitter()) ? score++ : score--;
- if (getCostTime() != VAL_QOSPARAMDONOTCARE)
+ if (getCostTime() != VAL_QOSPARDONOTCARE)
(getCostTime() <= templ.getCostTime()) ? score++ : score--;
- if (getCostBits() != VAL_QOSPARAMDONOTCARE)
+ if (getCostBits() != VAL_QOSPARDONOTCARE)
(getCostBits() <= templ.getCostBits()) ? score++ : score--;
return score;
}
+
+std::string QosCube::info() const {
+ std::ostringstream os;
+
+ if (this->getQosId())
+ os << "QoSCube Id> " << this->getQosId();
+ else
+ os << "QoS Parameters List>";
+
+ os << "\n average BW = ";
+ if ( this->getAvgBand() < 0)
+ os << STR_DONOTCARE;
+ else
+ os << this->getAvgBand() << " bit/s";
+
+ os << "\n average SDU BW = ";
+ if (this->getAvgSduBand() < 0)
+ os << STR_DONOTCARE;
+ else
+ os << this->getAvgSduBand() << " SDU/s";
+
+ os << "\n peak BW duration = ";
+ if (this->getPeakBandDuration() < 0)
+ os << STR_DONOTCARE;
+ else
+ os << this->getPeakBandDuration() << " bit/s";
+
+ os << "\n peak SDU BW duration = ";
+ if ( this->getPeakSduBandDuration() < 0)
+ os << STR_DONOTCARE;
+ else
+ os << this->getPeakSduBandDuration() << " SDU/s";
+
+ os << "\n burst period = ";
+ if ( this->getBurstPeriod() < 0 )
+ os << STR_DONOTCARE;
+ else
+ os << this->getBurstPeriod() << " usecs";
+
+ os << "\n burst duration = ";
+ if ( this->getBurstDuration() < 0 )
+ os << STR_DONOTCARE;
+ else
+ os << this->getBurstDuration() << " usecs";
+
+ os << "\n undetect. bit errors = ";
+ if ( this->getUndetectedBitErr() < 0 )
+ os << STR_DONOTCARE;
+ else
+ os << this->getUndetectedBitErr() << "%";
+
+ os << "\n max SDU Size = ";
+ if ( this->getMaxSduSize() < 0 )
+ os << STR_DONOTCARE;
+ else
+ os << this->getMaxSduSize() << " B";
+
+ os << "\n partial delivery = " << (this->isPartialDelivery() ? STR_YES : STR_NO );
+
+ os << "\n incomplete delivery = " << (this->isIncompleteDelivery() ? STR_YES : STR_NO );
+
+ os << "\n force order = " << (this->isForceOrder() ? STR_YES : STR_NO );
+
+ os << "\n max allowed gap = ";
+ if ( this->getMaxAllowGap() < 0 )
+ os << STR_DONOTCARE;
+ else
+ os << this->getMaxAllowGap() << " SDUs";
+
+ os << "\n delay = ";
+ if ( this->getDelay() < 0 )
+ os << STR_DONOTCARE;
+ else
+ os << this->getDelay() << " usecs";
+
+ os << "\n jitter = ";
+ if ( this->getJitter() < 0 )
+ os << STR_DONOTCARE;
+ else
+ os << this->getJitter() << " usecs";
+
+ os << "\n cost-time = ";
+ if ( this->getCostTime() < 0 )
+ os << STR_DONOTCARE;
+ else
+ os << this->getCostTime() << " $/ms";
+
+ os << "\n cost-bits = ";
+ if ( this->getCostBits() < 0 )
+ os << STR_DONOTCARE;
+ else
+ os << this->getCostBits() << " $/Mb";
+ return os.str();
+}