utils: Fixes compilation of tracers
This commit also replaces use of boost::tuple with std::tuple and
boost::shared_ptr with std::shared_ptr
L3AggregateTracer is completely removed, as its functionality is
duplicated and extended by L3RateTracer
diff --git a/utils/tracers/ndn-cs-tracer.cpp b/utils/tracers/ndn-cs-tracer.cpp
index f470aae..11fd803 100644
--- a/utils/tracers/ndn-cs-tracer.cpp
+++ b/utils/tracers/ndn-cs-tracer.cpp
@@ -26,8 +26,8 @@
#include "ns3/names.h"
#include "ns3/callback.h"
-#include "ns3/ndn-app.hpp"
-#include "ns3/ndn-content-store.hpp"
+#include "apps/ndn-app.hpp"
+#include "model/cs/ndn-content-store.hpp"
#include "ns3/simulator.h"
#include "ns3/node-list.h"
#include "ns3/log.h"
@@ -38,18 +38,10 @@
NS_LOG_COMPONENT_DEFINE("ndn.CsTracer");
-using namespace std;
-
namespace ns3 {
namespace ndn {
-static std::list<boost::tuple<boost::shared_ptr<std::ostream>, std::list<Ptr<CsTracer>>>> g_tracers;
-
-template<class T>
-static inline void
-NullDeleter(T* ptr)
-{
-}
+static std::list<std::tuple<shared_ptr<std::ostream>, std::list<Ptr<CsTracer>>>> g_tracers;
void
CsTracer::Destroy()
@@ -64,9 +56,9 @@
using namespace std;
std::list<Ptr<CsTracer>> tracers;
- boost::shared_ptr<std::ostream> outputStream;
+ shared_ptr<std::ostream> outputStream;
if (file != "-") {
- boost::shared_ptr<std::ofstream> os(new std::ofstream());
+ shared_ptr<std::ofstream> os(new std::ofstream());
os->open(file.c_str(), std::ios_base::out | std::ios_base::trunc);
if (!os->is_open()) {
@@ -77,7 +69,7 @@
outputStream = os;
}
else {
- outputStream = boost::shared_ptr<std::ostream>(&std::cout, NullDeleter<std::ostream>);
+ outputStream = shared_ptr<std::ostream>(&std::cout, std::bind([]{}));
}
for (NodeList::Iterator node = NodeList::Begin(); node != NodeList::End(); node++) {
@@ -91,7 +83,7 @@
*outputStream << "\n";
}
- g_tracers.push_back(boost::make_tuple(outputStream, tracers));
+ g_tracers.push_back(std::make_tuple(outputStream, tracers));
}
void
@@ -102,9 +94,9 @@
using namespace std;
std::list<Ptr<CsTracer>> tracers;
- boost::shared_ptr<std::ostream> outputStream;
+ shared_ptr<std::ostream> outputStream;
if (file != "-") {
- boost::shared_ptr<std::ofstream> os(new std::ofstream());
+ shared_ptr<std::ofstream> os(new std::ofstream());
os->open(file.c_str(), std::ios_base::out | std::ios_base::trunc);
if (!os->is_open()) {
@@ -115,7 +107,7 @@
outputStream = os;
}
else {
- outputStream = boost::shared_ptr<std::ostream>(&std::cout, NullDeleter<std::ostream>);
+ outputStream = shared_ptr<std::ostream>(&std::cout, std::bind([]{}));
}
for (NodeContainer::Iterator node = nodes.Begin(); node != nodes.End(); node++) {
@@ -129,7 +121,7 @@
*outputStream << "\n";
}
- g_tracers.push_back(boost::make_tuple(outputStream, tracers));
+ g_tracers.push_back(std::make_tuple(outputStream, tracers));
}
void
@@ -140,9 +132,9 @@
using namespace std;
std::list<Ptr<CsTracer>> tracers;
- boost::shared_ptr<std::ostream> outputStream;
+ shared_ptr<std::ostream> outputStream;
if (file != "-") {
- boost::shared_ptr<std::ofstream> os(new std::ofstream());
+ shared_ptr<std::ofstream> os(new std::ofstream());
os->open(file.c_str(), std::ios_base::out | std::ios_base::trunc);
if (!os->is_open()) {
@@ -153,7 +145,7 @@
outputStream = os;
}
else {
- outputStream = boost::shared_ptr<std::ostream>(&std::cout, NullDeleter<std::ostream>);
+ outputStream = shared_ptr<std::ostream>(&std::cout, std::bind([]{}));
}
Ptr<CsTracer> trace = Install(node, outputStream, averagingPeriod);
@@ -165,11 +157,11 @@
*outputStream << "\n";
}
- g_tracers.push_back(boost::make_tuple(outputStream, tracers));
+ g_tracers.push_back(std::make_tuple(outputStream, tracers));
}
Ptr<CsTracer>
-CsTracer::Install(Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream,
+CsTracer::Install(Ptr<Node> node, shared_ptr<std::ostream> outputStream,
Time averagingPeriod /* = Seconds (0.5)*/)
{
NS_LOG_DEBUG("Node: " << node->GetId());
@@ -184,21 +176,21 @@
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
-CsTracer::CsTracer(boost::shared_ptr<std::ostream> os, Ptr<Node> node)
+CsTracer::CsTracer(shared_ptr<std::ostream> os, Ptr<Node> node)
: m_nodePtr(node)
, m_os(os)
{
- m_node = boost::lexical_cast<string>(m_nodePtr->GetId());
+ m_node = boost::lexical_cast<std::string>(m_nodePtr->GetId());
Connect();
- string name = Names::FindName(node);
+ std::string name = Names::FindName(node);
if (!name.empty()) {
m_node = name;
}
}
-CsTracer::CsTracer(boost::shared_ptr<std::ostream> os, const std::string& node)
+CsTracer::CsTracer(shared_ptr<std::ostream> os, const std::string& node)
: m_node(node)
, m_os(os)
{