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/coordinate-lsa.hpp b/src/lsa/coordinate-lsa.hpp
index c9e3904..3e7f0a1 100644
--- a/src/lsa/coordinate-lsa.hpp
+++ b/src/lsa/coordinate-lsa.hpp
@@ -29,12 +29,22 @@
namespace nlsr {
-/*!
- \brief Data abstraction for CoordinateLsa
- CoordinateLsa := COORDINATE-LSA-TYPE TLV-LENGTH
- Lsa
- HyperbolicRadius
- HyperbolicAngle+
+/**
+ * @brief Represents an LSA of hyperbolic coordinates of the origin router.
+ *
+ * CoordinateLsa is encoded as:
+ * @code{.abnf}
+ * CoordinateLsa = COORDINATE-LSA-TYPE TLV-LENGTH
+ * Lsa
+ * HyperbolicRadius
+ * 1*HyperbolicAngle ; theta
+ *
+ * HyperbolicRadius = HYPERBOLIC-RADIUS-TYPE TLV-LENGTH
+ * Double ; IEEE754 double precision
+ *
+ * HyperbolicAngle = HYPERBOLIC-ANGLE-TYPE TLV-LENGTH
+ * Double ; IEEE754 double precision
+ * @endcode
*/
class CoordinateLsa : public Lsa, private boost::equality_comparable<CoordinateLsa>
{
@@ -45,6 +55,7 @@
const ndn::time::system_clock::time_point& timepoint,
double radius, std::vector<double> angles);
+ explicit
CoordinateLsa(const ndn::Block& block);
Lsa::Type
@@ -95,12 +106,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.
@@ -122,9 +134,6 @@
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(CoordinateLsa);
-std::ostream&
-operator<<(std::ostream& os, const CoordinateLsa& lsa);
-
} // namespace nlsr
#endif // NLSR_LSA_COORDINATE_LSA_HPP