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-simple-wifi.cpp b/examples/ndn-simple-wifi.cpp
index db54c93..a2b083f 100644
--- a/examples/ndn-simple-wifi.cpp
+++ b/examples/ndn-simple-wifi.cpp
@@ -30,10 +30,11 @@
using namespace std;
using namespace ns3;
-NS_LOG_COMPONENT_DEFINE ("ndn.WifiExample");
+NS_LOG_COMPONENT_DEFINE("ndn.WifiExample");
//
-// DISCLAIMER: Note that this is an extremely simple example, containing just 2 wifi nodes communicating
+// DISCLAIMER: Note that this is an extremely simple example, containing just 2 wifi nodes
+// communicating
// directly over AdHoc channel.
//
@@ -47,90 +48,89 @@
// }
int
-main (int argc, char *argv[])
+main(int argc, char* argv[])
{
// disable fragmentation
- Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200"));
- Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("2200"));
- Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode", StringValue ("OfdmRate24Mbps"));
+ Config::SetDefault("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue("2200"));
+ Config::SetDefault("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue("2200"));
+ Config::SetDefault("ns3::WifiRemoteStationManager::NonUnicastMode",
+ StringValue("OfdmRate24Mbps"));
CommandLine cmd;
- cmd.Parse (argc,argv);
+ cmd.Parse(argc, argv);
//////////////////////
//////////////////////
//////////////////////
- WifiHelper wifi = WifiHelper::Default ();
+ WifiHelper wifi = WifiHelper::Default();
// wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
- wifi.SetStandard (WIFI_PHY_STANDARD_80211a);
- wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
- "DataMode", StringValue ("OfdmRate24Mbps"));
+ wifi.SetStandard(WIFI_PHY_STANDARD_80211a);
+ wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager", "DataMode",
+ StringValue("OfdmRate24Mbps"));
- YansWifiChannelHelper wifiChannel;// = YansWifiChannelHelper::Default ();
- wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
- wifiChannel.AddPropagationLoss ("ns3::ThreeLogDistancePropagationLossModel");
- wifiChannel.AddPropagationLoss ("ns3::NakagamiPropagationLossModel");
+ YansWifiChannelHelper wifiChannel; // = YansWifiChannelHelper::Default ();
+ wifiChannel.SetPropagationDelay("ns3::ConstantSpeedPropagationDelayModel");
+ wifiChannel.AddPropagationLoss("ns3::ThreeLogDistancePropagationLossModel");
+ wifiChannel.AddPropagationLoss("ns3::NakagamiPropagationLossModel");
- //YansWifiPhy wifiPhy = YansWifiPhy::Default();
- YansWifiPhyHelper wifiPhyHelper = YansWifiPhyHelper::Default ();
- wifiPhyHelper.SetChannel (wifiChannel.Create ());
+ // YansWifiPhy wifiPhy = YansWifiPhy::Default();
+ YansWifiPhyHelper wifiPhyHelper = YansWifiPhyHelper::Default();
+ wifiPhyHelper.SetChannel(wifiChannel.Create());
wifiPhyHelper.Set("TxPowerStart", DoubleValue(5));
wifiPhyHelper.Set("TxPowerEnd", DoubleValue(5));
-
- NqosWifiMacHelper wifiMacHelper = NqosWifiMacHelper::Default ();
+ NqosWifiMacHelper wifiMacHelper = NqosWifiMacHelper::Default();
wifiMacHelper.SetType("ns3::AdhocWifiMac");
- Ptr<UniformRandomVariable> randomizer = CreateObject<UniformRandomVariable> ();
- randomizer->SetAttribute ("Min", DoubleValue (10));
- randomizer->SetAttribute ("Max", DoubleValue (100));
+ Ptr<UniformRandomVariable> randomizer = CreateObject<UniformRandomVariable>();
+ randomizer->SetAttribute("Min", DoubleValue(10));
+ randomizer->SetAttribute("Max", DoubleValue(100));
MobilityHelper mobility;
- mobility.SetPositionAllocator ("ns3::RandomBoxPositionAllocator",
- "X", PointerValue (randomizer),
- "Y", PointerValue (randomizer),
- "Z", PointerValue (randomizer));
+ mobility.SetPositionAllocator("ns3::RandomBoxPositionAllocator", "X", PointerValue(randomizer),
+ "Y", PointerValue(randomizer), "Z", PointerValue(randomizer));
- mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
+ mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
NodeContainer nodes;
- nodes.Create (2);
+ nodes.Create(2);
////////////////
// 1. Install Wifi
- NetDeviceContainer wifiNetDevices = wifi.Install (wifiPhyHelper, wifiMacHelper, nodes);
+ NetDeviceContainer wifiNetDevices = wifi.Install(wifiPhyHelper, wifiMacHelper, nodes);
// 2. Install Mobility model
- mobility.Install (nodes);
+ mobility.Install(nodes);
// 3. Install NDN stack
- NS_LOG_INFO ("Installing NDN stack");
+ NS_LOG_INFO("Installing NDN stack");
ndn::StackHelper ndnHelper;
- // ndnHelper.AddNetDeviceFaceCreateCallback (WifiNetDevice::GetTypeId (), MakeCallback (MyNetDeviceFaceCallback));
- ndnHelper.SetForwardingStrategy ("ns3::ndn::fw::BestRoute");
- ndnHelper.SetContentStore ("ns3::ndn::cs::Lru", "MaxSize", "1000");
- ndnHelper.SetDefaultRoutes (true);
- ndnHelper.Install (nodes);
+ // ndnHelper.AddNetDeviceFaceCreateCallback (WifiNetDevice::GetTypeId (), MakeCallback
+ // (MyNetDeviceFaceCallback));
+ ndnHelper.SetForwardingStrategy("ns3::ndn::fw::BestRoute");
+ ndnHelper.SetContentStore("ns3::ndn::cs::Lru", "MaxSize", "1000");
+ ndnHelper.SetDefaultRoutes(true);
+ ndnHelper.Install(nodes);
// 4. Set up applications
- NS_LOG_INFO ("Installing Applications");
+ NS_LOG_INFO("Installing Applications");
- ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
- consumerHelper.SetPrefix ("/test/prefix");
- consumerHelper.SetAttribute ("Frequency", DoubleValue (10.0));
- consumerHelper.Install (nodes.Get (0));
+ ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
+ consumerHelper.SetPrefix("/test/prefix");
+ consumerHelper.SetAttribute("Frequency", DoubleValue(10.0));
+ consumerHelper.Install(nodes.Get(0));
- ndn::AppHelper producerHelper ("ns3::ndn::Producer");
- producerHelper.SetPrefix ("/");
- producerHelper.SetAttribute ("PayloadSize", StringValue("1200"));
- producerHelper.Install (nodes.Get (1));
+ ndn::AppHelper producerHelper("ns3::ndn::Producer");
+ producerHelper.SetPrefix("/");
+ producerHelper.SetAttribute("PayloadSize", StringValue("1200"));
+ producerHelper.Install(nodes.Get(1));
////////////////
- Simulator::Stop (Seconds (30.0));
+ Simulator::Stop(Seconds(30.0));
- Simulator::Run ();
- Simulator::Destroy ();
+ Simulator::Run();
+ Simulator::Destroy();
return 0;
}