Project

General

Profile

Actions

Task #2346

closed

Construct LSA data strings using std::ostringstream

Added by Vince Lehman over 9 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Target version:
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 #1

Updated by Nicholas Gordon almost 7 years ago

  • Status changed from New to In Progress
  • Assignee set to Nicholas Gordon
  • Target version set to v0.4.0
Actions #2

Updated by Nicholas Gordon almost 7 years ago

  • Status changed from In Progress to Code review
Actions #3

Updated by Nicholas Gordon almost 7 years ago

  • Status changed from Code review to Closed
Actions

Also available in: Atom PDF