tools: Fixing bugs in nfd-status
Also in this commit: implementing const_reverse_iterator in FaceTable.
It also would be good to have reverse iterator in Fib, but not strictly
necessary.
Change-Id: Ie9cf849b718f5db76db2957b4452790f9ae68fd3
Refs: #1378
diff --git a/daemon/fw/face-table.hpp b/daemon/fw/face-table.hpp
index 868cf9e..b806cad 100644
--- a/daemon/fw/face-table.hpp
+++ b/daemon/fw/face-table.hpp
@@ -38,16 +38,26 @@
public: // enumeration
typedef std::map<FaceId, shared_ptr<Face> > FaceMap;
- /** \brief ForwarderIterator for shared_ptr<Face>
+ /** \brief ForwardIterator for shared_ptr<Face>
*/
typedef MapValueIterator<FaceMap> const_iterator;
+ /** \brief ReverseIterator for shared_ptr<Face>
+ */
+ typedef MapValueReverseIterator<FaceMap> const_reverse_iterator;
+
const_iterator
begin() const;
const_iterator
end() const;
+ const_reverse_iterator
+ rbegin() const;
+
+ const_reverse_iterator
+ rend() const;
+
public: // events
/** \brief fires after a Face is added
*/
@@ -96,6 +106,18 @@
return const_iterator(m_faces.end());
}
+inline FaceTable::const_reverse_iterator
+FaceTable::rbegin() const
+{
+ return const_reverse_iterator(m_faces.rbegin());
+}
+
+inline FaceTable::const_reverse_iterator
+FaceTable::rend() const
+{
+ return const_reverse_iterator(m_faces.rend());
+}
+
} // namespace nfd
#endif // NFD_FW_FACE_TABLE_HPP