lsa: cleanup operator<<
Delete .toString() virtual function in favor of ostream output.
Delete Lsa::getOriginRouterCopy() in favor of a custom Boost.Multi-Index
key extractor.
Mark single-parameter constructor as 'explicit'.
Rewrite class-level Doxygen with ABNF syntax.
refs #5308
Change-Id: I3c43395ce86f9a1a52da186fcf8c5a15cf35fe40
diff --git a/src/lsa/name-lsa.hpp b/src/lsa/name-lsa.hpp
index 7c82b90..625bbb7 100644
--- a/src/lsa/name-lsa.hpp
+++ b/src/lsa/name-lsa.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, The University of Memphis,
+ * Copyright (c) 2014-2024, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -29,11 +29,15 @@
namespace nlsr {
-/*!
- \brief Data abstraction for NameLsa
- NameLsa := NAME-LSA-TYPE TLV-LENGTH
- Lsa
- Name+
+/**
+ * @brief Represents an LSA of name prefixes announced by the origin router.
+ *
+ * NameLsa is encoded as:
+ * @code{.abnf}
+ * NameLsa = NAME-LSA-TYPE TLV-LENGTH
+ * Lsa
+ * 1*Name
+ * @endcode
*/
class NameLsa : public Lsa, private boost::equality_comparable<NameLsa>
{
@@ -44,6 +48,7 @@
const ndn::time::system_clock::time_point& timepoint,
const NamePrefixList& npl);
+ explicit
NameLsa(const ndn::Block& block);
Lsa::Type
@@ -94,12 +99,13 @@
void
wireDecode(const ndn::Block& wire);
- std::string
- toString() const override;
-
std::tuple<bool, std::list<ndn::Name>, std::list<ndn::Name>>
update(const std::shared_ptr<Lsa>& lsa) override;
+private:
+ void
+ print(std::ostream& os) const override;
+
private: // non-member operators
// NOTE: the following "hidden friend" operators are available via
// argument-dependent lookup only and must be defined inline.
@@ -117,9 +123,6 @@
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(NameLsa);
-std::ostream&
-operator<<(std::ostream& os, const NameLsa& lsa);
-
} // namespace nlsr
#endif // NLSR_LSA_NAME_LSA_HPP