Actions
Task #2346
closedConstruct LSA data strings using std::ostringstream
Start date:
01/05/2015
Due date:
% Done:
0%
Estimated time:
Description
Currently, the getData() methods for the three LSA types return a string representation of their data constructed using multiple casts and helper methods:
string adjLsaData;
adjLsaData = m_origRouter.toUri() + "|" + "adjacency" + "|"
+ boost::lexical_cast<std::string>(m_lsSeqNo) + "|"
+ ndn::time::toIsoString(m_expirationTimePoint);
adjLsaData += "|";
adjLsaData += boost::lexical_cast<std::string>(m_adl.getSize());
std::list<Adjacent> al = m_adl.getAdjList();
for (std::list<Adjacent>::iterator it = al.begin(); it != al.end(); it++) {
adjLsaData += "|";
adjLsaData += (*it).getName().toUri();
adjLsaData += "|";
adjLsaData += (*it).getConnectingFaceUri();
adjLsaData += "|";
adjLsaData += boost::lexical_cast<std::string>((*it).getLinkCost());
}
return adjLsaData + "|";
Instead, LSA data strings should be constructed using std::ostringstream:
std::ostringstream os;
os << m_origRouter << "|" << "adjacency" << "|"
<< m_lsSeqNo << "|" << m_expirationTimePoint ...
...
return os.str();
Actions