Refactoring of Name::Components into CcnxNameComponents
diff --git a/model/ccnx-content-object-header.cc b/model/ccnx-content-object-header.cc
index d1ad0cf..ff849bc 100644
--- a/model/ccnx-content-object-header.cc
+++ b/model/ccnx-content-object-header.cc
@@ -49,12 +49,12 @@
}
void
-CcnxContentObjectHeader::SetName (const Ptr<Name::Components> &name)
+CcnxContentObjectHeader::SetName (const Ptr<CcnxNameComponents> &name)
{
m_name = name;
}
-const Name::Components&
+const CcnxNameComponents&
CcnxContentObjectHeader::GetName () const
{
return *m_name;
diff --git a/model/ccnx-content-object-header.h b/model/ccnx-content-object-header.h
index 97a8d3d..cebfd4d 100644
--- a/model/ccnx-content-object-header.h
+++ b/model/ccnx-content-object-header.h
@@ -63,12 +63,12 @@
/**
* \brief Set interest name
*
- * Sets name of the interest. For example, SetName( Name::Components("prefix")("postfix") );
+ * Sets name of the interest. For example, SetName( CcnxNameComponents("prefix")("postfix") );
**/
void
- SetName (const Ptr<Name::Components> &name);
+ SetName (const Ptr<CcnxNameComponents> &name);
- const Name::Components&
+ const CcnxNameComponents&
GetName () const;
// void
@@ -93,7 +93,7 @@
virtual uint32_t Deserialize (Buffer::Iterator start);
private:
- Ptr<Name::Components> m_name;
+ Ptr<CcnxNameComponents> m_name;
// m_signature;
// m_signedInfo;
};
diff --git a/model/ccnx-content-store.h b/model/ccnx-content-store.h
index fb68981..dfd6e30 100644
--- a/model/ccnx-content-store.h
+++ b/model/ccnx-content-store.h
@@ -73,7 +73,7 @@
* \brief Get prefix of the stored entry
* \returns prefix of the stored entry
*/
- inline const Name::Components&
+ inline const CcnxNameComponents&
GetName () const;
/**
@@ -142,7 +142,7 @@
boost::multi_index::hashed_unique<
boost::multi_index::tag<__ccnx_private_content_store::hash>,
boost::multi_index::const_mem_fun<CcnxContentStoreEntry,
- const Name::Components&,
+ const CcnxNameComponents&,
&CcnxContentStoreEntry::GetName>,
CcnxPrefixHash>,
boost::multi_index::sequenced<boost::multi_index::tag<__ccnx_private_content_store::mru> >
@@ -151,7 +151,7 @@
boost::multi_index::ordered_unique<
boost::multi_index::tag<__ccnx_private_content_store::ordered>,
boost::multi_index::const_mem_fun<CcnxContentStoreEntry,
- const Name::Components&,
+ const CcnxNameComponents&,
&CcnxContentStoreEntry::GetName>
>
#endif
@@ -271,7 +271,7 @@
return os;
}
-const Name::Components&
+const CcnxNameComponents&
CcnxContentStoreEntry::GetName () const
{
return m_header->GetName ();
diff --git a/model/ccnx-interest-header.cc b/model/ccnx-interest-header.cc
index 330e2f4..ea70a93 100644
--- a/model/ccnx-interest-header.cc
+++ b/model/ccnx-interest-header.cc
@@ -60,12 +60,12 @@
}
void
-CcnxInterestHeader::SetName (const Ptr<Name::Components> &name)
+CcnxInterestHeader::SetName (const Ptr<CcnxNameComponents> &name)
{
m_name = name;
}
-const Name::Components&
+const CcnxNameComponents&
CcnxInterestHeader::GetName () const
{
return *m_name;
@@ -96,12 +96,12 @@
}
void
-CcnxInterestHeader::SetExclude (const Ptr<Name::Components> &exclude)
+CcnxInterestHeader::SetExclude (const Ptr<CcnxNameComponents> &exclude)
{
m_exclude = exclude;
}
-const Name::Components&
+const CcnxNameComponents&
CcnxInterestHeader::GetExclude () const
{
return *m_exclude;
diff --git a/model/ccnx-interest-header.h b/model/ccnx-interest-header.h
index 0e13bb8..3b59c00 100644
--- a/model/ccnx-interest-header.h
+++ b/model/ccnx-interest-header.h
@@ -138,12 +138,12 @@
/**
* \brief Set interest name
*
- * Sets name of the interest. For example, SetName( Name::Components("prefix")("postfix") );
+ * Sets name of the interest. For example, SetName( CcnxNameComponents("prefix")("postfix") );
**/
void
- SetName (const Ptr<Name::Components> &name);
+ SetName (const Ptr<CcnxNameComponents> &name);
- const Name::Components&
+ const CcnxNameComponents&
GetName () const;
void
@@ -161,12 +161,12 @@
/**
* \brief Set exclude filer
*
- * For example, SetExclude (Name::Components("exclude1")("exclude2")("exclude3"))
+ * For example, SetExclude (CcnxNameComponents("exclude1")("exclude2")("exclude3"))
**/
void
- SetExclude (const Ptr<Name::Components> &exclude);
+ SetExclude (const Ptr<CcnxNameComponents> &exclude);
- const Name::Components&
+ const CcnxNameComponents&
GetExclude () const;
void
@@ -209,10 +209,10 @@
virtual uint32_t Deserialize (Buffer::Iterator start);
private:
- Ptr<Name::Components> m_name;
+ Ptr<CcnxNameComponents> m_name;
int32_t m_minSuffixComponents; ///< minimum suffix components. not used if negative
int32_t m_maxSuffixComponents; ///< maximum suffix components. not used if negative
- Ptr<Name::Components> m_exclude; ///< exclude filter
+ Ptr<CcnxNameComponents> m_exclude; ///< exclude filter
bool m_childSelector;
bool m_answerOriginKind;
int8_t m_scope; ///< -1 not set, 0 local scope, 1 this host, 2 immediate neighborhood
diff --git a/model/ccnx-rit.h b/model/ccnx-rit.h
index 8220759..b448320 100644
--- a/model/ccnx-rit.h
+++ b/model/ccnx-rit.h
@@ -49,11 +49,11 @@
*/
struct CcnxRitEntry
{
- Name::Components m_prefix; ///< \brief Prefix of the recently satisfied interest
+ CcnxNameComponents m_prefix; ///< \brief Prefix of the recently satisfied interest
uint32_t m_nonce; ///< \brief Nonce of the recently satisfied interest
Time m_expireTime; ///< \brief Time when the record should be removed
- CcnxRitEntry (const Name::Components &prefix, uint32_t nonce, const Time &timeout)
+ CcnxRitEntry (const CcnxNameComponents &prefix, uint32_t nonce, const Time &timeout)
: m_prefix (prefix)
, m_nonce (nonce)
, m_expireTime (timeout)
diff --git a/model/ccnx-route.cc b/model/ccnx-route.cc
index c2033f6..a3b0224 100644
--- a/model/ccnx-route.cc
+++ b/model/ccnx-route.cc
@@ -29,12 +29,12 @@
}
void
-CcnxRoute::SetPrefix (const Ptr<Name::Components> &prefix)
+CcnxRoute::SetPrefix (const Ptr<CcnxNameComponents> &prefix)
{
m_prefix = prefix;
}
-const Name::Components&
+const CcnxNameComponents&
CcnxRoute::GetPrefix (void) const
{
return *m_prefix;
diff --git a/model/ccnx-route.h b/model/ccnx-route.h
index fcff012..65d978f 100644
--- a/model/ccnx-route.h
+++ b/model/ccnx-route.h
@@ -47,11 +47,11 @@
/**
* \param dest Destination CcnxAddress
*/
- void SetPrefix (const Ptr<Name::Components> &dest);
+ void SetPrefix (const Ptr<CcnxNameComponents> &dest);
/**
* \return Destination CcnxAddress of the route
*/
- const Name::Components& GetPrefix (void) const;
+ const CcnxNameComponents& GetPrefix (void) const;
/**
* Equivalent in Linux to dst_entry.dev
@@ -65,7 +65,7 @@
Ptr<CcnxFace> GetOutputFace (void) const;
private:
- Ptr<Name::Components> m_prefix;
+ Ptr<CcnxNameComponents> m_prefix;
Ptr<CcnxFace> m_outputFace;
};
diff --git a/model/hash-helper.h b/model/hash-helper.h
index 36a9ee8..0440e29 100644
--- a/model/hash-helper.h
+++ b/model/hash-helper.h
@@ -37,10 +37,10 @@
* \todo Testing is required to determine if this hash function
* actually provides good hash results
*/
-struct CcnxPrefixHash : public std::unary_function<Name::Components, std::size_t>
+struct CcnxPrefixHash : public std::unary_function<CcnxNameComponents, std::size_t>
{
std::size_t
- operator() (const Name::Components &prefix) const
+ operator() (const CcnxNameComponents &prefix) const
{
std::size_t hash = 23;
BOOST_FOREACH (const std::string &str, prefix.GetComponents ())
diff --git a/model/name-components.cc b/model/name-components.cc
index e1af1ee..7dde99f 100644
--- a/model/name-components.cc
+++ b/model/name-components.cc
@@ -25,15 +25,14 @@
using namespace std;
namespace ns3 {
-namespace Name {
-Components::Components ()
+CcnxNameComponents::CcnxNameComponents ()
{
// m_value = ccn_charbuf_create ();
// ccn_name_init(m_value);
}
-Components::Components (const string &s)
+CcnxNameComponents::CcnxNameComponents (const string &s)
{
// m_value = ccn_charbuf_create ();
// ccn_name_init(m_value);
@@ -41,13 +40,13 @@
m_prefix.push_back (s);
}
-Components::~Components ()
+CcnxNameComponents::~CcnxNameComponents ()
{
// ccn_charbuf_destroy(&m_value);
}
const std::list<std::string> &
-Components::GetComponents () const
+CcnxNameComponents::GetComponents () const
{
return m_prefix;
}
@@ -59,8 +58,8 @@
// return m_value;
// }
-Components&
-Components::operator () (const string &s)
+CcnxNameComponents&
+CcnxNameComponents::operator () (const string &s)
{
// ccn_name_append_str (m_value,s.c_str());
m_prefix.push_back (s);
@@ -73,7 +72,7 @@
// }
void
-Components::Print (std::ostream &os) const
+CcnxNameComponents::Print (std::ostream &os) const
{
for (const_iterator i=m_prefix.begin(); i!=m_prefix.end(); i++)
{
@@ -82,12 +81,10 @@
}
std::ostream &
-operator << (std::ostream &os, const Components &components)
+operator << (std::ostream &os, const CcnxNameComponents &components)
{
components.Print (os);
return os;
}
-
-}
}
diff --git a/model/name-components.h b/model/name-components.h
index 5749fcc..55cd5ae 100644
--- a/model/name-components.h
+++ b/model/name-components.h
@@ -31,20 +31,19 @@
#include "ns3/object.h"
namespace ns3 {
-namespace Name {
-class Components : public Object
+class CcnxNameComponents : public Object
{
public:
- Components ();
- Components (const std::string &s);
- ~Components ();
+ CcnxNameComponents ();
+ CcnxNameComponents (const std::string &s);
+ ~CcnxNameComponents ();
inline void
Add (const std::string &s);
- Components&
+ CcnxNameComponents&
operator () (const std::string &s);
const std::list<std::string> &
@@ -65,10 +64,10 @@
size () const;
inline bool
- operator== (const Components &prefix) const;
+ operator== (const CcnxNameComponents &prefix) const;
inline bool
- operator< (const Components &prefix) const;
+ operator< (const CcnxNameComponents &prefix) const;
private:
std::list<std::string> m_prefix;
@@ -77,22 +76,22 @@
typedef std::list<std::string>::const_iterator const_iterator;
};
-std::ostream & operator << (std::ostream &os, const Components &components);
+std::ostream & operator << (std::ostream &os, const CcnxNameComponents &components);
size_t
-Components::size () const
+CcnxNameComponents::size () const
{
return m_prefix.size ();
}
void
-Components::Add (const std::string &s)
+CcnxNameComponents::Add (const std::string &s)
{
(*this) (s);
}
bool
-Components::operator== (const Components &prefix) const
+CcnxNameComponents::operator== (const CcnxNameComponents &prefix) const
{
if (m_prefix.size () != prefix.m_prefix.size ())
return false;
@@ -101,7 +100,7 @@
}
bool
-Components::operator< (const Components &prefix) const
+CcnxNameComponents::operator< (const CcnxNameComponents &prefix) const
{
return std::lexicographical_compare (m_prefix.begin (), m_prefix.end (),
prefix.m_prefix.begin (), prefix.m_prefix.end ());
@@ -110,12 +109,11 @@
/**
* \class ns3::ComponentsValue
-* \brief hold objects of type ns3::Name::Components
+* \brief hold objects of type ns3:CcnxNameComponents
*/
-ATTRIBUTE_VALUE_DEFINE (Components);
-ATTRIBUTE_ACCESSOR_DEFINE (Components);
-ATTRIBUTE_CHECKER_DEFINE (Components);
-} // Namespace Name
+ATTRIBUTE_VALUE_DEFINE (CcnxNameComponents);
+ATTRIBUTE_ACCESSOR_DEFINE (CcnxNameComponents);
+ATTRIBUTE_CHECKER_DEFINE (CcnxNameComponents);
} // namespace ns3
#endif // _NDN_NAME_COMPONENTS_H_