Experimental trie implementation
diff --git a/model/ccnx-name-components.h b/model/ccnx-name-components.h
index 7f62851..1d8ef2a 100644
--- a/model/ccnx-name-components.h
+++ b/model/ccnx-name-components.h
@@ -46,6 +46,9 @@
class CcnxNameComponents : public SimpleRefCount<CcnxNameComponents>
{
public:
+ typedef std::list<std::string>::iterator iterator;
+ typedef std::list<std::string>::const_iterator const_iterator;
+
/**
* \brief Constructor
* Creates a prefix with zero components (can be looked as root "/")
@@ -109,6 +112,30 @@
size () const;
/**
+ * @brief Get read-write begin() iterator
+ */
+ inline iterator
+ begin ();
+
+ /**
+ * @brief Get read-only begin() iterator
+ */
+ inline const_iterator
+ begin () const;
+
+ /**
+ * @brief Get read-write end() iterator
+ */
+ inline iterator
+ end ();
+
+ /**
+ * @brief Get read-only end() iterator
+ */
+ inline const_iterator
+ end () const;
+
+ /**
* \brief Equality operator for CcnxNameComponents
*/
inline bool
@@ -119,12 +146,11 @@
*/
inline bool
operator< (const CcnxNameComponents &prefix) const;
+
+ typedef std::string partial_type;
private:
std::list<std::string> m_prefix; ///< \brief a list of strings (components)
-
- typedef std::list<std::string>::iterator iterator;
- typedef std::list<std::string>::const_iterator const_iterator;
};
/**
@@ -149,6 +175,40 @@
return m_prefix.size ();
}
+CcnxNameComponents::iterator
+CcnxNameComponents::begin ()
+{
+ return m_prefix.begin ();
+}
+
+/**
+ * @brief Get read-only begin() iterator
+ */
+CcnxNameComponents::const_iterator
+CcnxNameComponents::begin () const
+{
+ return m_prefix.begin ();
+}
+
+/**
+ * @brief Get read-write end() iterator
+ */
+CcnxNameComponents::iterator
+CcnxNameComponents::end ()
+{
+ return m_prefix.end ();
+}
+
+/**
+ * @brief Get read-only end() iterator
+ */
+CcnxNameComponents::const_iterator
+CcnxNameComponents::end () const
+{
+ return m_prefix.end ();
+}
+
+
/**
* \brief Generic constructor operator
* The object of type T will be appended to the list of components