lsa: define CoordinateLsa operator==

getCorRadius, setCorRadius, getCorTheta, setCorTheta methods are
renamed, in accordance with ndn-cxx code style recommendations.

refs #4094

Change-Id: Iaf3ebf3b895d6dc351b2f754e4a9c65713bdca3a
diff --git a/src/lsa/coordinate-lsa.hpp b/src/lsa/coordinate-lsa.hpp
index 112e7d5..c9e3904 100644
--- a/src/lsa/coordinate-lsa.hpp
+++ b/src/lsa/coordinate-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.
  *
@@ -23,6 +23,9 @@
 #define NLSR_LSA_COORDINATE_LSA_HPP
 
 #include "lsa.hpp"
+#include "utility/numeric.hpp"
+
+#include <boost/operators.hpp>
 
 namespace nlsr {
 
@@ -33,7 +36,7 @@
                       HyperbolicRadius
                       HyperbolicAngle+
  */
-class CoordinateLsa : public Lsa
+class CoordinateLsa : public Lsa, private boost::equality_comparable<CoordinateLsa>
 {
 public:
   CoordinateLsa() = default;
@@ -57,34 +60,31 @@
   }
 
   double
-  getCorRadius() const
+  getRadius() const
   {
     return m_hyperbolicRadius;
   }
 
   void
-  setCorRadius(double cr)
+  setRadius(double cr)
   {
     m_wire.reset();
     m_hyperbolicRadius = cr;
   }
 
-  const std::vector<double>
-  getCorTheta() const
+  const std::vector<double>&
+  getTheta() const
   {
     return m_hyperbolicAngles;
   }
 
   void
-  setCorTheta(std::vector<double> ct)
+  setTheta(std::vector<double> ct)
   {
     m_wire.reset();
-    m_hyperbolicAngles = ct;
+    m_hyperbolicAngles = std::move(ct);
   }
 
-  bool
-  isEqualContent(const CoordinateLsa& clsa) const;
-
   template<ndn::encoding::Tag TAG>
   size_t
   wireEncode(ndn::EncodingImpl<TAG>& block) const;
@@ -101,6 +101,20 @@
   std::tuple<bool, std::list<ndn::Name>, std::list<ndn::Name>>
   update(const std::shared_ptr<Lsa>& lsa) override;
 
+private: // non-member operators
+  // NOTE: the following "hidden friend" operators are available via
+  //       argument-dependent lookup only and must be defined inline.
+  // boost::equality_comparable provides != operator.
+
+  friend bool
+  operator==(const CoordinateLsa& lhs, const CoordinateLsa& rhs)
+  {
+    return util::diffInEpsilon(lhs.m_hyperbolicRadius, rhs.m_hyperbolicRadius) &&
+           std::equal(lhs.m_hyperbolicAngles.begin(), lhs.m_hyperbolicAngles.end(),
+                      rhs.m_hyperbolicAngles.begin(), rhs.m_hyperbolicAngles.end(),
+                      util::diffInEpsilon);
+  }
+
 private:
   double m_hyperbolicRadius = 0.0;
   std::vector<double> m_hyperbolicAngles;