documentation
diff --git a/model/ccnx-name-components.h b/model/ccnx-name-components.h
index fdffe91..892ac4b 100644
--- a/model/ccnx-name-components.h
+++ b/model/ccnx-name-components.h
@@ -34,58 +34,90 @@
namespace ns3 {
+/**
+ * \ingroup ccnx
+ * \brief Hierarchical CCNX name
+ * A Name element represents a hierarchical name for CCNx content.
+ * It simply contains a sequence of Component elements.
+ * Each Component element contains a sequence of zero or more bytes.
+ * There are no restrictions on what byte sequences may be used.
+ * The Name element in an Interest is often referred to with the term name prefix or simply prefix.
+ */
class CcnxNameComponents : public SimpleRefCount<CcnxNameComponents>
{
public:
/**
- * \brief Creates a prefix with zero components (can be looked as root "/")
+ * \brief Constructor
+ * Creates a prefix with zero components (can be looked as root "/")
*/
CcnxNameComponents ();
- // CcnxNameComponents (const std::string &s);
+
+ /**
+ * \brief Constructor
+ * Creates a prefix from a list of strings where every string represents a prefix component
+ * @param[in] components A list of strings
+ */
CcnxNameComponents (const std::list<boost::reference_wrapper<const std::string> > &components);
+ /**
+ * \brief Generic Add method
+ * Appends object of type T to the list of components
+ * @param[in] value The object to be appended
+ */
template<class T>
inline void
Add (const T &value);
+ /**
+ * \brief Generic constructor operator
+ * The object of type T will be appended to the list of components
+ */
template<class T>
inline CcnxNameComponents&
operator () (const T &value);
+ /**
+ * \brief Get a name
+ * Returns a list of components (strings)
+ */
const std::list<std::string> &
GetComponents () const;
/**
* \brief Get subcomponents of the name, starting with first component
- * \param num Number of components to return. Valid value is in range [1, GetComponents ().size ()]
+ * @param[in] num Number of components to return. Valid value is in range [1, GetComponents ().size ()]
*/
std::list<boost::reference_wrapper<const std::string> >
GetSubComponents (size_t num) const;
- // virtual uint32_t
- // GetSerializedSize (void) const;
-
- // virtual void
- // Serialize (Buffer::Iterator start) const;
-
- // virtual uint32_t
- // Deserialize (Buffer::Iterator start);
-
+ /**
+ * \brief Print name
+ * @param[in] os Stream to print
+ */
void Print (std::ostream &os) const;
+ /**
+ * \brief Returns the size of CcnxNameComponents
+ */
inline size_t
size () const;
+ /**
+ * \brief Equality operator for CcnxNameComponents
+ */
inline bool
operator== (const CcnxNameComponents &prefix) const;
+ /**
+ * \brief Less than operator for CcnxNameComponents
+ */
inline bool
operator< (const CcnxNameComponents &prefix) const;
private:
- std::list<std::string> m_prefix;
+ std::list<std::string> m_prefix; ///< \brief a list of strings (components)
- typedef std::list<std::string>::iterator iterator;
+ typedef std::list<std::string>::iterator iterator;
typedef std::list<std::string>::const_iterator const_iterator;
};
@@ -97,20 +129,24 @@
/**
* \brief Read components from input and add them to components. Will read input stream till eof
- *
- * \todo Check that NS-3 doesn't give unlimited input streams... Otherwise it would be disaster
- *
* Substrings separated by slashes will become separate components
*/
std::istream &
operator >> (std::istream &is, CcnxNameComponents &components);
-
+
+/**
+ * \brief Returns the size of CcnxNameComponents object
+ */
size_t
CcnxNameComponents::size () const
{
return m_prefix.size ();
}
+/**
+ * \brief Generic constructor operator
+ * The object of type T will be appended to the list of components
+ */
template<class T>
CcnxNameComponents&
CcnxNameComponents::operator () (const T &value)
@@ -119,13 +155,11 @@
return *this;
}
-// template<>
-// void
-// CcnxNameComponents::Add (const std::string &string)
-// {
-// m_prefix.push_back (string);
-// }
-
+/**
+ * \brief Generic Add method
+ * Appends object of type T to the list of components
+ * @param[in] value The object to be appended
+ */
template<class T>
void
CcnxNameComponents::Add (const T &value)
@@ -135,6 +169,9 @@
m_prefix.push_back (os.str ());
}
+/**
+ * \brief Equality operator for CcnxNameComponents
+ */
bool
CcnxNameComponents::operator== (const CcnxNameComponents &prefix) const
{
@@ -144,6 +181,9 @@
return std::equal (m_prefix.begin (), m_prefix.end (), prefix.m_prefix.begin ());
}
+/**
+ * \brief Less than operator for CcnxNameComponents
+ */
bool
CcnxNameComponents::operator< (const CcnxNameComponents &prefix) const
{