Another set of refactoring
diff --git a/utils/counting-policy.h b/utils/counting-policy.h
index d8cfe07..ffa2d1a 100644
--- a/utils/counting-policy.h
+++ b/utils/counting-policy.h
@@ -24,10 +24,9 @@
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/list.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
/**
* @brief Traits for policy that just keeps track of number of elements
@@ -105,6 +104,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif // COUNTING_POLICY_H_
diff --git a/utils/detail/functor-hook.h b/utils/detail/functor-hook.h
index 63dcffd..f34969c 100644
--- a/utils/detail/functor-hook.h
+++ b/utils/detail/functor-hook.h
@@ -23,12 +23,10 @@
#include <boost/intrusive/parent_from_member.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
-namespace detail
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
+namespace detail {
template<class BaseHook, class ValueType, int N>
struct FunctorHook
@@ -66,6 +64,7 @@
} // detail
} // ndnSIM
+} // ndn
} // ns3
#endif // FUNCTOR_HOOK_H_
diff --git a/utils/detail/multi-policy-container.h b/utils/detail/multi-policy-container.h
index 7272a01..35119cb 100644
--- a/utils/detail/multi-policy-container.h
+++ b/utils/detail/multi-policy-container.h
@@ -24,12 +24,10 @@
#include <boost/mpl/inherit_linearly.hpp>
#include <boost/mpl/at.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
-namespace detail
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
+namespace detail {
template< class Base, class Value >
struct policy_wrap
@@ -160,6 +158,7 @@
} // detail
} // ndnSIM
+} // ndn
} // ns3
#endif // MULTI_POLICY_CONTAINER_H_
diff --git a/utils/detail/multi-type-container.h b/utils/detail/multi-type-container.h
index 24bf17c..d4971c4 100644
--- a/utils/detail/multi-type-container.h
+++ b/utils/detail/multi-type-container.h
@@ -25,12 +25,10 @@
#include <boost/mpl/inherit.hpp>
#include <boost/mpl/at.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
-namespace detail
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
+namespace detail {
template <class T>
struct wrap
@@ -82,6 +80,7 @@
} // detail
} // ndnSIM
+} // ndn
} // ns3
#endif // MULTI_TYPE_CONTAINER_H_
diff --git a/utils/empty-policy.h b/utils/empty-policy.h
index 04bc676..a50b9e8 100644
--- a/utils/empty-policy.h
+++ b/utils/empty-policy.h
@@ -21,10 +21,9 @@
#ifndef EMPTY_POLICY_H_
#define EMPTY_POLICY_H_
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
/**
* @brief Traits for empty (bogus) replacement policy
@@ -54,6 +53,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif // EMPTY_POLICY_H_
diff --git a/utils/fifo-policy.h b/utils/fifo-policy.h
index 1943e06..77d4ce2 100644
--- a/utils/fifo-policy.h
+++ b/utils/fifo-policy.h
@@ -24,10 +24,9 @@
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/list.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
/**
* @brief Traits for First In First Out replacement policy
@@ -123,6 +122,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif
diff --git a/utils/load-stats-face.cc b/utils/load-stats-face.cc
index de202ee..df48f2b 100644
--- a/utils/load-stats-face.cc
+++ b/utils/load-stats-face.cc
@@ -28,12 +28,11 @@
using namespace boost::mpl;
using namespace boost::tuples;
-NS_LOG_COMPONENT_DEFINE ("LoadStatsFace");
+NS_LOG_COMPONENT_DEFINE ("ndn.LoadStatsFace");
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
std::ostream &
operator << (std::ostream &os, const LoadStats::stats_tuple &tuple);
@@ -147,6 +146,7 @@
return os;
}
-} // ndnSIM
-} // ns3
+} // namespace ndnSIM
+} // namespace ndn
+} // namespace ns3
diff --git a/utils/load-stats-face.h b/utils/load-stats-face.h
index b8202f9..70a4c36 100644
--- a/utils/load-stats-face.h
+++ b/utils/load-stats-face.h
@@ -23,10 +23,9 @@
#include "load-stats.h"
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
class LoadStatsFace
{
@@ -132,7 +131,8 @@
std::ostream &
operator << (std::ostream &os, const LoadStatsFace &stats);
-} // ndnSIM
-} // ns3
+} // namespace ndnSIM
+} // namespace ndn
+} // namespace ns3
#endif // LOAD_STATS_FACE_H
diff --git a/utils/load-stats-node.cc b/utils/load-stats-node.cc
index 86a149d..39e9d60 100644
--- a/utils/load-stats-node.cc
+++ b/utils/load-stats-node.cc
@@ -26,12 +26,11 @@
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("LoadStatsNode");
+NS_LOG_COMPONENT_DEFINE ("ndn.LoadStatsNode");
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
void
LoadStatsNode::Step ()
@@ -62,13 +61,13 @@
}
void
-LoadStatsNode::AddIncoming (ns3::Ptr<ns3::NdnFace> face)
+LoadStatsNode::AddIncoming (ns3::Ptr<Face> face)
{
m_incoming [face].count ()++;
}
void
-LoadStatsNode::AddOutgoing (ns3::Ptr<ns3::NdnFace> face)
+LoadStatsNode::AddOutgoing (ns3::Ptr<Face> face)
{
m_outgoing [face].count ()++;
}
@@ -114,14 +113,14 @@
}
void
-LoadStatsNode::Rx (ns3::Ptr<ns3::NdnFace> face, uint32_t amount)
+LoadStatsNode::Rx (ns3::Ptr<Face> face, uint32_t amount)
{
m_pit.rx () += amount;
m_incoming [face].rx () += amount;
}
void
-LoadStatsNode::Tx (ns3::Ptr<ns3::NdnFace> face, uint32_t amount)
+LoadStatsNode::Tx (ns3::Ptr<Face> face, uint32_t amount)
{
m_pit.tx () += amount;
m_outgoing [face].tx () += amount;
@@ -187,7 +186,7 @@
void
-LoadStatsNode::RemoveFace (ns3::Ptr<ns3::NdnFace> face)
+LoadStatsNode::RemoveFace (ns3::Ptr<Face> face)
{
NS_LOG_FUNCTION (this);
m_incoming.erase (face);
@@ -213,5 +212,6 @@
}
-} // ndnSIM
-} // ns3
+} // namespace ndnSIM
+} // namespace ndn
+} // namespace ns3
diff --git a/utils/load-stats-node.h b/utils/load-stats-node.h
index 5989a23..365db55 100644
--- a/utils/load-stats-node.h
+++ b/utils/load-stats-node.h
@@ -25,9 +25,10 @@
#include <map>
#include "ns3/ptr.h"
-namespace ns3
-{
-class NdnFace;
+namespace ns3 {
+namespace ndn {
+
+class Face;
namespace ndnSIM
{
@@ -37,7 +38,7 @@
class LoadStatsNode
{
public:
- typedef std::map< ns3::Ptr<ns3::NdnFace>, LoadStatsFace > stats_container;
+ typedef std::map< ns3::Ptr<Face>, LoadStatsFace > stats_container;
LoadStatsNode () {}
LoadStatsNode (const LoadStatsNode &) {}
@@ -55,13 +56,13 @@
* Increment counter to incoming list
*/
void
- AddIncoming (ns3::Ptr<ns3::NdnFace> face);
+ AddIncoming (ns3::Ptr<Face> face);
/**
* Increment counter to outgoing list
*/
void
- AddOutgoing (ns3::Ptr<ns3::NdnFace> face);
+ AddOutgoing (ns3::Ptr<Face> face);
/**
* Increment counter to both incoming and outgoing lists, for all faces
@@ -79,13 +80,13 @@
* Increment counter for Tx amount
*/
void
- Rx (ns3::Ptr<ns3::NdnFace> face, uint32_t amount);
+ Rx (ns3::Ptr<Face> face, uint32_t amount);
/**
* Increment counter for Tx amount
*/
void
- Tx (ns3::Ptr<ns3::NdnFace> face, uint32_t amount);
+ Tx (ns3::Ptr<Face> face, uint32_t amount);
LoadStatsNode &
operator += (const LoadStatsNode &stats);
@@ -119,7 +120,7 @@
}
void
- RemoveFace (ns3::Ptr<ns3::NdnFace> face);
+ RemoveFace (ns3::Ptr<Face> face);
private:
LoadStatsFace m_pit;
@@ -152,6 +153,7 @@
operator << (std::ostream &os, const LoadStatsNode &node);
} // ndnSIM
+} // ndn
} // ns3
#endif
diff --git a/utils/load-stats.cc b/utils/load-stats.cc
index 166a906..3bc2897 100644
--- a/utils/load-stats.cc
+++ b/utils/load-stats.cc
@@ -29,12 +29,11 @@
const double EXP_2 = exp (-1.0/30.0); /* 1/exp(1sec/30sec) */
const double EXP_3 = exp (-1.0/60.0); /* 1/exp(1sec/60sec) */
-NS_LOG_COMPONENT_DEFINE ("LoadStats");
+NS_LOG_COMPONENT_DEFINE ("ndn.LoadStats");
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
const double LoadStats::PRECISION = 0.1;
@@ -104,5 +103,6 @@
return os;
}
-} // ndnSIM
-} // ns3
+} // namespace ndnSIM
+} // namespace ndn
+} // namespace ns3
diff --git a/utils/load-stats.h b/utils/load-stats.h
index 2b2db89..3e71753 100644
--- a/utils/load-stats.h
+++ b/utils/load-stats.h
@@ -24,10 +24,9 @@
#include "ns3/nstime.h"
#include <boost/tuple/tuple.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
class LoadStats
{
@@ -76,7 +75,8 @@
std::ostream &
operator << (std::ostream &os, const LoadStats &stats);
-} // ndnSIM
-} // ns3
+} // namespace ndnSIM
+} // namespace ndn
+} // namespace ns3
#endif // LOAD_STATS_H
diff --git a/utils/lru-policy.h b/utils/lru-policy.h
index bddb281..15b482f 100644
--- a/utils/lru-policy.h
+++ b/utils/lru-policy.h
@@ -24,10 +24,9 @@
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/list.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
/**
* @brief Traits for Least Recently Used replacement policy
@@ -128,6 +127,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif
diff --git a/utils/multi-policy.h b/utils/multi-policy.h
index b50119a..386cb2e 100644
--- a/utils/multi-policy.h
+++ b/utils/multi-policy.h
@@ -34,10 +34,9 @@
#include <boost/intrusive/options.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
template<typename Policies> // e.g., mpl::vector1< lru_policy_traits >
struct multi_policy_traits
@@ -128,6 +127,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif // MULTI_POLICY_H_
diff --git a/utils/payload-policy.h b/utils/payload-policy.h
index 76cf2cf..a474afd 100644
--- a/utils/payload-policy.h
+++ b/utils/payload-policy.h
@@ -24,10 +24,9 @@
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/list.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
/**
* @brief Traits for policy that keeps items in a sorted order using payload member
@@ -129,6 +128,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif // PAYLOAD_POLICY_H
diff --git a/utils/payload-with-policy.h b/utils/payload-with-policy.h
index 4cfe975..7db278b 100644
--- a/utils/payload-with-policy.h
+++ b/utils/payload-with-policy.h
@@ -21,10 +21,9 @@
#ifndef PAYLOAD_WITH_INDEX_H_
#define PAYLOAD_WITH_INDEX_H_
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
template<typename PayloadTraits,
typename IndexTraits>
@@ -102,6 +101,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif // PAYLOAD_WITH_POLICY_H_
diff --git a/utils/persistent-policy.h b/utils/persistent-policy.h
index c7add54..95c7d8f 100644
--- a/utils/persistent-policy.h
+++ b/utils/persistent-policy.h
@@ -24,10 +24,9 @@
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/list.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
/**
* @brief Traits for persistent replacement policy
@@ -123,6 +122,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif // PERSISTENT_POLICY_H_
diff --git a/utils/random-policy.h b/utils/random-policy.h
index 3bfb6e2..9e0dde6 100644
--- a/utils/random-policy.h
+++ b/utils/random-policy.h
@@ -26,10 +26,9 @@
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/set.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
/**
* @brief Traits for random replacement policy
@@ -161,6 +160,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif // RANDOM_POLICY_H
diff --git a/utils/stats-tree.cc b/utils/stats-tree.cc
index aff2e93..5893861 100644
--- a/utils/stats-tree.cc
+++ b/utils/stats-tree.cc
@@ -22,14 +22,11 @@
#include "ns3/ndn-face.h"
#include "ns3/log.h"
-using namespace ns3;
+NS_LOG_COMPONENT_DEFINE ("ndn.StatsTree");
-NS_LOG_COMPONENT_DEFINE ("StatsTree");
-
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
StatsTree::StatsTree ()
: m_tree ("")
@@ -50,7 +47,7 @@
}
void
-StatsTree::NewPitEntry (const ns3::NdnNameComponents &key)
+StatsTree::NewPitEntry (const NameComponents &key)
{
std::pair<tree_type::iterator, bool> item = m_tree.insert (key, LoadStatsNode ());
@@ -58,7 +55,7 @@
}
void
-StatsTree::Incoming (const NdnNameComponents &key, Ptr<NdnFace> face)
+StatsTree::Incoming (const NameComponents &key, Ptr<Face> face)
{
std::pair<tree_type::iterator, bool> item = m_tree.insert (key, LoadStatsNode ());
@@ -66,7 +63,7 @@
}
void
-StatsTree::Outgoing (const NdnNameComponents &key, Ptr<NdnFace> face)
+StatsTree::Outgoing (const NameComponents &key, Ptr<Face> face)
{
std::pair<tree_type::iterator, bool> item = m_tree.insert (key, LoadStatsNode ());
@@ -74,7 +71,7 @@
}
void
-StatsTree::Satisfy (const NdnNameComponents &key)
+StatsTree::Satisfy (const NameComponents &key)
{
std::pair<tree_type::iterator, bool> item = m_tree.insert (key, LoadStatsNode ());
@@ -82,7 +79,7 @@
}
void
-StatsTree::Timeout (const NdnNameComponents &key)
+StatsTree::Timeout (const NameComponents &key)
{
std::pair<tree_type::iterator, bool> item = m_tree.insert (key, LoadStatsNode ());
@@ -90,7 +87,7 @@
}
void
-StatsTree::Rx (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face, uint32_t amount)
+StatsTree::Rx (const NameComponents &key, Ptr<Face> face, uint32_t amount)
{
std::pair<tree_type::iterator, bool> item = m_tree.insert (key, LoadStatsNode ());
@@ -98,7 +95,7 @@
}
void
-StatsTree::Tx (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face, uint32_t amount)
+StatsTree::Tx (const NameComponents &key, Ptr<Face> face, uint32_t amount)
{
std::pair<tree_type::iterator, bool> item = m_tree.insert (key, LoadStatsNode ());
@@ -106,9 +103,9 @@
}
// const LoadStatsNode &
-// StatsTree::Get (const ns3::NdnNameComponents &key) const
+// StatsTree::Get (const NameComponents &key) const
const LoadStatsNode &
-StatsTree::operator [] (const ns3::NdnNameComponents &key) const
+StatsTree::operator [] (const NameComponents &key) const
{
tree_type::iterator foundItem, lastItem;
bool reachLast;
@@ -140,7 +137,7 @@
}
void
-StatsTree::RemoveFace (ns3::Ptr<ns3::NdnFace> face)
+StatsTree::RemoveFace (Ptr<Face> face)
{
tree_type::recursive_iterator item (&m_tree), end;
for (; item != end; item ++)
@@ -158,6 +155,7 @@
}
-} // ndnSIM
-} // ns3
+} // namespace ndnSIM
+} // namespace ndn
+} // namespace ns3
diff --git a/utils/stats-tree.h b/utils/stats-tree.h
index c92d4bb..0b13e2c 100644
--- a/utils/stats-tree.h
+++ b/utils/stats-tree.h
@@ -26,15 +26,14 @@
#include "ns3/ndn-name-components.h"
#include "ns3/ptr.h"
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
class StatsTree
{
public:
- typedef trie< ns3::NdnNameComponents,
+ typedef trie< NameComponents,
non_pointer_traits< LoadStatsNode >, void* > tree_type;
StatsTree ();
@@ -43,33 +42,33 @@
Step ();
void
- NewPitEntry (const ns3::NdnNameComponents &key);
+ NewPitEntry (const NameComponents &key);
void
- Incoming (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face);
+ Incoming (const NameComponents &key, Ptr<Face> face);
void
- Outgoing (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face);
+ Outgoing (const NameComponents &key, Ptr<Face> face);
void
- Satisfy (const ns3::NdnNameComponents &key);
+ Satisfy (const NameComponents &key);
void
- Timeout (const ns3::NdnNameComponents &key);
+ Timeout (const NameComponents &key);
void
- Rx (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face, uint32_t amount);
+ Rx (const NameComponents &key, Ptr<Face> face, uint32_t amount);
void
- Tx (const ns3::NdnNameComponents &key, ns3::Ptr<ns3::NdnFace> face, uint32_t amount);
+ Tx (const NameComponents &key, Ptr<Face> face, uint32_t amount);
// const LoadStatsNode &
- // Get (const ns3::NdnNameComponents &key) const;
+ // Get (const NameComponents &key) const;
const LoadStatsNode &
- operator [] (const ns3::NdnNameComponents &key) const;
+ operator [] (const NameComponents &key) const;
void
- RemoveFace (ns3::Ptr<ns3::NdnFace> face);
+ RemoveFace (Ptr<Face> face);
private:
const LoadStatsNode &
@@ -86,7 +85,8 @@
std::ostream &
operator << (std::ostream &os, const StatsTree &tree);
-} // ndnSIM
-} // ns3
+} // namespace ndnSIM
+} // namespace ndn
+} // namespace ns3
#endif // STATS_TREE_H
diff --git a/utils/trie-with-policy.h b/utils/trie-with-policy.h
index 12168ea..8afa6f8 100644
--- a/utils/trie-with-policy.h
+++ b/utils/trie-with-policy.h
@@ -23,10 +23,9 @@
#include "trie.h"
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
template<typename FullKey,
typename PayloadTraits,
@@ -236,6 +235,7 @@
};
} // ndnSIM
+} // ndn
} // ns3
#endif // TRIE_WITH_POLICY_H_
diff --git a/utils/trie.h b/utils/trie.h
index fe52d59..4592fa5 100644
--- a/utils/trie.h
+++ b/utils/trie.h
@@ -32,10 +32,9 @@
#include <boost/foreach.hpp>
#include <boost/mpl/if.hpp>
-namespace ns3
-{
-namespace ndnSIM
-{
+namespace ns3 {
+namespace ndn {
+namespace ndnSIM {
/////////////////////////////////////////////////////
// Allow customization for payload
@@ -642,6 +641,7 @@
} // ndnSIM
+} // ndn
} // ns3
#endif // TRIE_H_