src: Updating code style to conform (more or less) to ndn-cxx style
Also, adding .clang-format that describes the applied style. Note that
this style requires a slightly customized version of clang-format.
diff --git a/examples/ndn-grid.cpp b/examples/ndn-grid.cpp
index 8b75165..d475dfd 100644
--- a/examples/ndn-grid.cpp
+++ b/examples/ndn-grid.cpp
@@ -35,7 +35,7 @@
* | | |
* ( ) ------ ( ) -- (producer)
*
- * All links are 1Mbps with propagation 10ms delay.
+ * All links are 1Mbps with propagation 10ms delay.
*
* FIB is populated using NdnGlobalRoutingHelper.
*
@@ -51,59 +51,59 @@
*/
int
-main (int argc, char *argv[])
+main(int argc, char* argv[])
{
// Setting default parameters for PointToPoint links and channels
- Config::SetDefault ("ns3::PointToPointNetDevice::DataRate", StringValue ("1Mbps"));
- Config::SetDefault ("ns3::PointToPointChannel::Delay", StringValue ("10ms"));
- Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue ("10"));
+ Config::SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("1Mbps"));
+ Config::SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"));
+ Config::SetDefault("ns3::DropTailQueue::MaxPackets", StringValue("10"));
// Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize
CommandLine cmd;
- cmd.Parse (argc, argv);
+ cmd.Parse(argc, argv);
// Creating 3x3 topology
PointToPointHelper p2p;
- PointToPointGridHelper grid (3, 3, p2p);
- grid.BoundingBox(100,100,200,200);
+ PointToPointGridHelper grid(3, 3, p2p);
+ grid.BoundingBox(100, 100, 200, 200);
// Install NDN stack on all nodes
ndn::StackHelper ndnHelper;
- ndnHelper.SetForwardingStrategy ("ns3::ndn::fw::BestRoute");
- ndnHelper.InstallAll ();
+ ndnHelper.SetForwardingStrategy("ns3::ndn::fw::BestRoute");
+ ndnHelper.InstallAll();
// Installing global routing interface on all nodes
ndn::GlobalRoutingHelper ndnGlobalRoutingHelper;
- ndnGlobalRoutingHelper.InstallAll ();
+ ndnGlobalRoutingHelper.InstallAll();
// Getting containers for the consumer/producer
- Ptr<Node> producer = grid.GetNode (2, 2);
+ Ptr<Node> producer = grid.GetNode(2, 2);
NodeContainer consumerNodes;
- consumerNodes.Add (grid.GetNode (0,0));
+ consumerNodes.Add(grid.GetNode(0, 0));
// Install NDN applications
std::string prefix = "/prefix";
- ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
- consumerHelper.SetPrefix (prefix);
- consumerHelper.SetAttribute ("Frequency", StringValue ("100")); // 100 interests a second
- consumerHelper.Install (consumerNodes);
+ ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
+ consumerHelper.SetPrefix(prefix);
+ consumerHelper.SetAttribute("Frequency", StringValue("100")); // 100 interests a second
+ consumerHelper.Install(consumerNodes);
- ndn::AppHelper producerHelper ("ns3::ndn::Producer");
- producerHelper.SetPrefix (prefix);
- producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
- producerHelper.Install (producer);
+ ndn::AppHelper producerHelper("ns3::ndn::Producer");
+ producerHelper.SetPrefix(prefix);
+ producerHelper.SetAttribute("PayloadSize", StringValue("1024"));
+ producerHelper.Install(producer);
// Add /prefix origins to ndn::GlobalRouter
- ndnGlobalRoutingHelper.AddOrigins (prefix, producer);
+ ndnGlobalRoutingHelper.AddOrigins(prefix, producer);
// Calculate and install FIBs
- ndn::GlobalRoutingHelper::CalculateRoutes ();
+ ndn::GlobalRoutingHelper::CalculateRoutes();
- Simulator::Stop (Seconds (20.0));
+ Simulator::Stop(Seconds(20.0));
- Simulator::Run ();
- Simulator::Destroy ();
+ Simulator::Run();
+ Simulator::Destroy();
return 0;
}