From 3210ea8f12aea87ba5101f3a1279fc4ecab7eee5 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Fri, 12 Feb 2010 16:44:15 -0800 Subject: [PATCH] move back to mixins for helpers --- src/helper/csma-helper.h | 2 +- src/helper/emu-helper.h | 2 +- src/helper/internet-stack-helper.h | 3 +- src/helper/point-to-point-helper.h | 6 +- src/helper/trace-helper.cc | 110 ++++++++++++++--------------- src/helper/trace-helper.h | 64 ++++------------- src/helper/wifi-helper.h | 2 +- src/helper/yans-wifi-helper.h | 3 +- 8 files changed, 77 insertions(+), 115 deletions(-) diff --git a/src/helper/csma-helper.h b/src/helper/csma-helper.h index 017688e8e..1c202401a 100644 --- a/src/helper/csma-helper.h +++ b/src/helper/csma-helper.h @@ -43,7 +43,7 @@ class Packet; * encapsulates a general attribute or a set of functionality that * may be of interest to many other classes. */ -class CsmaHelper : public TraceHelperForDevice +class CsmaHelper : public PcapHelperForDevice, public AsciiTraceHelperForDevice { public: /** diff --git a/src/helper/emu-helper.h b/src/helper/emu-helper.h index b49d2b265..b3102ea97 100644 --- a/src/helper/emu-helper.h +++ b/src/helper/emu-helper.h @@ -43,7 +43,7 @@ class Packet; * encapsulates a general attribute or a set of functionality that * may be of interest to many other classes. */ -class EmuHelper : public TraceHelperForDevice + class EmuHelper : public PcapHelperForDevice, public AsciiTraceHelperForDevice { public: /* diff --git a/src/helper/internet-stack-helper.h b/src/helper/internet-stack-helper.h index befd26ec0..647d3a583 100644 --- a/src/helper/internet-stack-helper.h +++ b/src/helper/internet-stack-helper.h @@ -52,7 +52,8 @@ class Ipv6RoutingHelper; * encapsulates a general attribute or a set of functionality that * may be of interest to many other classes. */ -class InternetStackHelper : public TraceHelperForProtocol +class InternetStackHelper : public PcapHelperForIpv4, public PcapHelperForIpv6, + public AsciiTraceHelperForIpv4, public AsciiTraceHelperForIpv6 { public: /** diff --git a/src/helper/point-to-point-helper.h b/src/helper/point-to-point-helper.h index 85dd574ea..ff48cb8da 100644 --- a/src/helper/point-to-point-helper.h +++ b/src/helper/point-to-point-helper.h @@ -40,11 +40,9 @@ class Node; * * Normally we eschew multiple inheritance, however, the classes * PcapUserHelperForDevice and AsciiTraceUserHelperForDevice are - * treated as "mixins". A mixin is a self-contained class that - * encapsulates a general attribute or a set of functionality that - * may be of interest to many other classes. + * "mixins". */ -class PointToPointHelper : public TraceHelperForDevice +class PointToPointHelper : public PcapHelperForDevice, public AsciiTraceHelperForDevice { public: /** diff --git a/src/helper/trace-helper.cc b/src/helper/trace-helper.cc index e3bcdb811..efdbc4d2f 100644 --- a/src/helper/trace-helper.cc +++ b/src/helper/trace-helper.cc @@ -480,7 +480,7 @@ PcapHelperForDevice::EnablePcap (std::string prefix, uint32_t nodeid, uint32_t d // Public API // void -TraceHelperForDevice::EnableAscii (std::string prefix, Ptr nd) +AsciiTraceHelperForDevice::EnableAscii (std::string prefix, Ptr nd) { EnableAsciiInternal (Ptr (), prefix, nd); } @@ -489,7 +489,7 @@ TraceHelperForDevice::EnableAscii (std::string prefix, Ptr nd) // Public API // void -TraceHelperForDevice::EnableAscii (Ptr stream, Ptr nd) +AsciiTraceHelperForDevice::EnableAscii (Ptr stream, Ptr nd) { EnableAsciiInternal (stream, std::string (), nd); } @@ -498,7 +498,7 @@ TraceHelperForDevice::EnableAscii (Ptr stream, Ptr (), prefix, ndName); } @@ -507,7 +507,7 @@ TraceHelperForDevice::EnableAscii (std::string prefix, std::string ndName) // Public API // void -TraceHelperForDevice::EnableAscii (Ptr stream, std::string ndName) +AsciiTraceHelperForDevice::EnableAscii (Ptr stream, std::string ndName) { EnableAsciiImpl (stream, std::string (), ndName); } @@ -516,7 +516,7 @@ TraceHelperForDevice::EnableAscii (Ptr stream, std::string n // Private API // void -TraceHelperForDevice::EnableAsciiImpl (Ptr stream, std::string prefix, std::string ndName) +AsciiTraceHelperForDevice::EnableAsciiImpl (Ptr stream, std::string prefix, std::string ndName) { Ptr nd = Names::Find (ndName); EnableAsciiInternal (stream, prefix, nd); @@ -526,7 +526,7 @@ TraceHelperForDevice::EnableAsciiImpl (Ptr stream, std::stri // Public API // void -TraceHelperForDevice::EnableAscii (std::string prefix, NetDeviceContainer d) +AsciiTraceHelperForDevice::EnableAscii (std::string prefix, NetDeviceContainer d) { EnableAsciiImpl (Ptr (), prefix, d); } @@ -535,7 +535,7 @@ TraceHelperForDevice::EnableAscii (std::string prefix, NetDeviceContainer d) // Public API // void -TraceHelperForDevice::EnableAscii (Ptr stream, NetDeviceContainer d) +AsciiTraceHelperForDevice::EnableAscii (Ptr stream, NetDeviceContainer d) { EnableAsciiImpl (stream, std::string (), d); } @@ -544,7 +544,7 @@ TraceHelperForDevice::EnableAscii (Ptr stream, NetDeviceCont // Private API // void -TraceHelperForDevice::EnableAsciiImpl (Ptr stream, std::string prefix, NetDeviceContainer d) +AsciiTraceHelperForDevice::EnableAsciiImpl (Ptr stream, std::string prefix, NetDeviceContainer d) { for (NetDeviceContainer::Iterator i = d.Begin (); i != d.End (); ++i) { @@ -557,7 +557,7 @@ TraceHelperForDevice::EnableAsciiImpl (Ptr stream, std::stri // Public API // void -TraceHelperForDevice::EnableAscii (std::string prefix, NodeContainer n) +AsciiTraceHelperForDevice::EnableAscii (std::string prefix, NodeContainer n) { EnableAsciiImpl (Ptr (), prefix, n); } @@ -566,7 +566,7 @@ TraceHelperForDevice::EnableAscii (std::string prefix, NodeContainer n) // Public API // void -TraceHelperForDevice::EnableAscii (Ptr stream, NodeContainer n) +AsciiTraceHelperForDevice::EnableAscii (Ptr stream, NodeContainer n) { EnableAsciiImpl (stream, std::string (), n); } @@ -575,7 +575,7 @@ TraceHelperForDevice::EnableAscii (Ptr stream, NodeContainer // Private API // void -TraceHelperForDevice::EnableAsciiImpl (Ptr stream, std::string prefix, NodeContainer n) +AsciiTraceHelperForDevice::EnableAsciiImpl (Ptr stream, std::string prefix, NodeContainer n) { NetDeviceContainer devs; for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i) @@ -593,7 +593,7 @@ TraceHelperForDevice::EnableAsciiImpl (Ptr stream, std::stri // Public API // void -TraceHelperForDevice::EnableAsciiAll (std::string prefix) +AsciiTraceHelperForDevice::EnableAsciiAll (std::string prefix) { EnableAsciiImpl (Ptr (), prefix, NodeContainer::GetGlobal ()); } @@ -602,7 +602,7 @@ TraceHelperForDevice::EnableAsciiAll (std::string prefix) // Public API // void -TraceHelperForDevice::EnableAsciiAll (Ptr stream) +AsciiTraceHelperForDevice::EnableAsciiAll (Ptr stream) { EnableAsciiImpl (stream, std::string (), NodeContainer::GetGlobal ()); } @@ -611,7 +611,7 @@ TraceHelperForDevice::EnableAsciiAll (Ptr stream) // Public API // void -TraceHelperForDevice::EnableAscii (Ptr stream, uint32_t nodeid, uint32_t deviceid) +AsciiTraceHelperForDevice::EnableAscii (Ptr stream, uint32_t nodeid, uint32_t deviceid) { EnableAsciiImpl (stream, std::string (), nodeid, deviceid); } @@ -620,7 +620,7 @@ TraceHelperForDevice::EnableAscii (Ptr stream, uint32_t node // Public API // void -TraceHelperForDevice::EnableAscii (std::string prefix, uint32_t nodeid, uint32_t deviceid) +AsciiTraceHelperForDevice::EnableAscii (std::string prefix, uint32_t nodeid, uint32_t deviceid) { EnableAsciiImpl (Ptr (), prefix, nodeid, deviceid); } @@ -629,7 +629,7 @@ TraceHelperForDevice::EnableAscii (std::string prefix, uint32_t nodeid, uint32_t // Private API // void -TraceHelperForDevice::EnableAsciiImpl ( +AsciiTraceHelperForDevice::EnableAsciiImpl ( Ptr stream, std::string prefix, uint32_t nodeid, @@ -646,7 +646,7 @@ TraceHelperForDevice::EnableAsciiImpl ( } NS_ABORT_MSG_IF (deviceid >= node->GetNDevices (), - "TraceHelperForDevice::EnableAscii(): Unknown deviceid = " << deviceid); + "AsciiTraceHelperForDevice::EnableAscii(): Unknown deviceid = " << deviceid); Ptr nd = node->GetDevice (deviceid); @@ -727,7 +727,7 @@ PcapHelperForIpv4::EnablePcapIpv4 (std::string prefix, uint32_t nodeid, uint32_t // Public API // void -PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (std::string prefix, Ptr ipv4, uint32_t interface) +AsciiTraceHelperForIpv4::EnableAsciiIpv4 (std::string prefix, Ptr ipv4, uint32_t interface) { EnableAsciiIpv4Internal (Ptr (), prefix, ipv4, interface); } @@ -736,7 +736,7 @@ PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (std::string prefix, Ptr ipv4, // Public API // void -PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (Ptr stream, Ptr ipv4, uint32_t interface) +AsciiTraceHelperForIpv4::EnableAsciiIpv4 (Ptr stream, Ptr ipv4, uint32_t interface) { EnableAsciiIpv4Internal (stream, std::string (), ipv4, interface); } @@ -745,7 +745,7 @@ PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (Ptr stream, Ptr< // Public API // void -PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (std::string prefix, std::string ipv4Name, uint32_t interface) +AsciiTraceHelperForIpv4::EnableAsciiIpv4 (std::string prefix, std::string ipv4Name, uint32_t interface) { EnableAsciiIpv4Impl (Ptr (), prefix, ipv4Name, interface); } @@ -754,7 +754,7 @@ PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (std::string prefix, std::string ipv4 // Public API // void -PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (Ptr stream, std::string ipv4Name, uint32_t interface) +AsciiTraceHelperForIpv4::EnableAsciiIpv4 (Ptr stream, std::string ipv4Name, uint32_t interface) { EnableAsciiIpv4Impl (stream, std::string (), ipv4Name, interface); } @@ -763,7 +763,7 @@ PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (Ptr stream, std: // Private API // void -PcapAndAsciiHelperForIpv4::EnableAsciiIpv4Impl ( +AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl ( Ptr stream, std::string prefix, std::string ipv4Name, @@ -777,7 +777,7 @@ PcapAndAsciiHelperForIpv4::EnableAsciiIpv4Impl ( // Public API // void -PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (std::string prefix, Ipv4InterfaceContainer c) +AsciiTraceHelperForIpv4::EnableAsciiIpv4 (std::string prefix, Ipv4InterfaceContainer c) { EnableAsciiIpv4Impl (Ptr (), prefix, c); } @@ -786,7 +786,7 @@ PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (std::string prefix, Ipv4InterfaceCon // Public API // void -PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (Ptr stream, Ipv4InterfaceContainer c) +AsciiTraceHelperForIpv4::EnableAsciiIpv4 (Ptr stream, Ipv4InterfaceContainer c) { EnableAsciiIpv4Impl (stream, std::string (), c); } @@ -795,7 +795,7 @@ PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (Ptr stream, Ipv4 // Private API // void -PcapAndAsciiHelperForIpv4::EnableAsciiIpv4Impl (Ptr stream, std::string prefix, Ipv4InterfaceContainer c) +AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl (Ptr stream, std::string prefix, Ipv4InterfaceContainer c) { for (Ipv4InterfaceContainer::Iterator i = c.Begin (); i != c.End (); ++i) { @@ -808,7 +808,7 @@ PcapAndAsciiHelperForIpv4::EnableAsciiIpv4Impl (Ptr stream, // Public API // void -PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (std::string prefix, NodeContainer n) +AsciiTraceHelperForIpv4::EnableAsciiIpv4 (std::string prefix, NodeContainer n) { EnableAsciiIpv4Impl (Ptr (), prefix, n); } @@ -817,7 +817,7 @@ PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (std::string prefix, NodeContainer n) // Public API // void -PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (Ptr stream, NodeContainer n) +AsciiTraceHelperForIpv4::EnableAsciiIpv4 (Ptr stream, NodeContainer n) { EnableAsciiIpv4Impl (stream, std::string (), n); } @@ -826,7 +826,7 @@ PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (Ptr stream, Node // Private API // void -PcapAndAsciiHelperForIpv4::EnableAsciiIpv4Impl (Ptr stream, std::string prefix, NodeContainer n) +AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl (Ptr stream, std::string prefix, NodeContainer n) { for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i) { @@ -846,7 +846,7 @@ PcapAndAsciiHelperForIpv4::EnableAsciiIpv4Impl (Ptr stream, // Public API // void -PcapAndAsciiHelperForIpv4::EnableAsciiIpv4All (std::string prefix) +AsciiTraceHelperForIpv4::EnableAsciiIpv4All (std::string prefix) { EnableAsciiIpv4Impl (Ptr (), prefix, NodeContainer::GetGlobal ()); } @@ -855,7 +855,7 @@ PcapAndAsciiHelperForIpv4::EnableAsciiIpv4All (std::string prefix) // Public API // void -PcapAndAsciiHelperForIpv4::EnableAsciiIpv4All (Ptr stream) +AsciiTraceHelperForIpv4::EnableAsciiIpv4All (Ptr stream) { EnableAsciiIpv4Impl (stream, std::string (), NodeContainer::GetGlobal ()); } @@ -864,7 +864,7 @@ PcapAndAsciiHelperForIpv4::EnableAsciiIpv4All (Ptr stream) // Public API // void -PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (Ptr stream, uint32_t nodeid, uint32_t interface) +AsciiTraceHelperForIpv4::EnableAsciiIpv4 (Ptr stream, uint32_t nodeid, uint32_t interface) { EnableAsciiIpv4Impl (stream, std::string (), nodeid, interface); } @@ -873,7 +873,7 @@ PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (Ptr stream, uint // Public API // void -PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (std::string prefix, uint32_t nodeid, uint32_t interface) +AsciiTraceHelperForIpv4::EnableAsciiIpv4 (std::string prefix, uint32_t nodeid, uint32_t interface) { EnableAsciiIpv4Impl (Ptr (), prefix, nodeid, interface); } @@ -882,7 +882,7 @@ PcapAndAsciiHelperForIpv4::EnableAsciiIpv4 (std::string prefix, uint32_t nodeid, // Private API // void -PcapAndAsciiHelperForIpv4::EnableAsciiIpv4Impl ( +AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl ( Ptr stream, std::string prefix, uint32_t nodeid, @@ -909,20 +909,20 @@ PcapAndAsciiHelperForIpv4::EnableAsciiIpv4Impl ( } void -PcapAndAsciiHelperForIpv4AndPcapHelperForIpv6::EnablePcapIpv6 (std::string prefix, Ptr ipv6, uint32_t interface) +PcapHelperForIpv6::EnablePcapIpv6 (std::string prefix, Ptr ipv6, uint32_t interface) { EnablePcapIpv6Internal (prefix, ipv6, interface); } void -PcapAndAsciiHelperForIpv4AndPcapHelperForIpv6::EnablePcapIpv6 (std::string prefix, std::string ipv6Name, uint32_t interface) +PcapHelperForIpv6::EnablePcapIpv6 (std::string prefix, std::string ipv6Name, uint32_t interface) { Ptr ipv6 = Names::Find (ipv6Name); EnablePcapIpv6 (prefix, ipv6, interface); } void -PcapAndAsciiHelperForIpv4AndPcapHelperForIpv6::EnablePcapIpv6 (std::string prefix, Ipv6InterfaceContainer c) +PcapHelperForIpv6::EnablePcapIpv6 (std::string prefix, Ipv6InterfaceContainer c) { for (Ipv6InterfaceContainer::Iterator i = c.Begin (); i != c.End (); ++i) { @@ -932,7 +932,7 @@ PcapAndAsciiHelperForIpv4AndPcapHelperForIpv6::EnablePcapIpv6 (std::string prefi } void -PcapAndAsciiHelperForIpv4AndPcapHelperForIpv6::EnablePcapIpv6 (std::string prefix, NodeContainer n) +PcapHelperForIpv6::EnablePcapIpv6 (std::string prefix, NodeContainer n) { for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i) { @@ -949,13 +949,13 @@ PcapAndAsciiHelperForIpv4AndPcapHelperForIpv6::EnablePcapIpv6 (std::string prefi } void -PcapAndAsciiHelperForIpv4AndPcapHelperForIpv6::EnablePcapIpv6All (std::string prefix) +PcapHelperForIpv6::EnablePcapIpv6All (std::string prefix) { EnablePcapIpv6 (prefix, NodeContainer::GetGlobal ()); } void -PcapAndAsciiHelperForIpv4AndPcapHelperForIpv6::EnablePcapIpv6 (std::string prefix, uint32_t nodeid, uint32_t interface) +PcapHelperForIpv6::EnablePcapIpv6 (std::string prefix, uint32_t nodeid, uint32_t interface) { NodeContainer n = NodeContainer::GetGlobal (); @@ -980,7 +980,7 @@ PcapAndAsciiHelperForIpv4AndPcapHelperForIpv6::EnablePcapIpv6 (std::string prefi // Public API // void -TraceHelperForProtocol::EnableAsciiIpv6 (std::string prefix, Ptr ipv6, uint32_t interface) +AsciiTraceHelperForIpv6::EnableAsciiIpv6 (std::string prefix, Ptr ipv6, uint32_t interface) { EnableAsciiIpv6Internal (Ptr (), prefix, ipv6, interface); } @@ -989,7 +989,7 @@ TraceHelperForProtocol::EnableAsciiIpv6 (std::string prefix, Ptr ipv6, uin // Public API // void -TraceHelperForProtocol::EnableAsciiIpv6 (Ptr stream, Ptr ipv6, uint32_t interface) +AsciiTraceHelperForIpv6::EnableAsciiIpv6 (Ptr stream, Ptr ipv6, uint32_t interface) { EnableAsciiIpv6Internal (stream, std::string (), ipv6, interface); } @@ -998,7 +998,7 @@ TraceHelperForProtocol::EnableAsciiIpv6 (Ptr stream, Ptr (), prefix, ipv6Name, interface); } @@ -1007,7 +1007,7 @@ TraceHelperForProtocol::EnableAsciiIpv6 (std::string prefix, std::string ipv6Nam // Public API // void -TraceHelperForProtocol::EnableAsciiIpv6 (Ptr stream, std::string ipv6Name, uint32_t interface) +AsciiTraceHelperForIpv6::EnableAsciiIpv6 (Ptr stream, std::string ipv6Name, uint32_t interface) { EnableAsciiIpv6Impl (stream, std::string (), ipv6Name, interface); } @@ -1016,7 +1016,7 @@ TraceHelperForProtocol::EnableAsciiIpv6 (Ptr stream, std::st // Private API // void -TraceHelperForProtocol::EnableAsciiIpv6Impl ( +AsciiTraceHelperForIpv6::EnableAsciiIpv6Impl ( Ptr stream, std::string prefix, std::string ipv6Name, @@ -1030,7 +1030,7 @@ TraceHelperForProtocol::EnableAsciiIpv6Impl ( // Public API // void -TraceHelperForProtocol::EnableAsciiIpv6 (std::string prefix, Ipv6InterfaceContainer c) +AsciiTraceHelperForIpv6::EnableAsciiIpv6 (std::string prefix, Ipv6InterfaceContainer c) { EnableAsciiIpv6Impl (Ptr (), prefix, c); } @@ -1039,7 +1039,7 @@ TraceHelperForProtocol::EnableAsciiIpv6 (std::string prefix, Ipv6InterfaceContai // Public API // void -TraceHelperForProtocol::EnableAsciiIpv6 (Ptr stream, Ipv6InterfaceContainer c) +AsciiTraceHelperForIpv6::EnableAsciiIpv6 (Ptr stream, Ipv6InterfaceContainer c) { EnableAsciiIpv6Impl (stream, std::string (), c); } @@ -1048,7 +1048,7 @@ TraceHelperForProtocol::EnableAsciiIpv6 (Ptr stream, Ipv6Int // Private API // void -TraceHelperForProtocol::EnableAsciiIpv6Impl (Ptr stream, std::string prefix, Ipv6InterfaceContainer c) +AsciiTraceHelperForIpv6::EnableAsciiIpv6Impl (Ptr stream, std::string prefix, Ipv6InterfaceContainer c) { for (Ipv6InterfaceContainer::Iterator i = c.Begin (); i != c.End (); ++i) { @@ -1061,7 +1061,7 @@ TraceHelperForProtocol::EnableAsciiIpv6Impl (Ptr stream, std // Public API // void -TraceHelperForProtocol::EnableAsciiIpv6 (std::string prefix, NodeContainer n) +AsciiTraceHelperForIpv6::EnableAsciiIpv6 (std::string prefix, NodeContainer n) { EnableAsciiIpv6Impl (Ptr (), prefix, n); } @@ -1070,7 +1070,7 @@ TraceHelperForProtocol::EnableAsciiIpv6 (std::string prefix, NodeContainer n) // Public API // void -TraceHelperForProtocol::EnableAsciiIpv6 (Ptr stream, NodeContainer n) +AsciiTraceHelperForIpv6::EnableAsciiIpv6 (Ptr stream, NodeContainer n) { EnableAsciiIpv6Impl (stream, std::string (), n); } @@ -1079,7 +1079,7 @@ TraceHelperForProtocol::EnableAsciiIpv6 (Ptr stream, NodeCon // Private API // void -TraceHelperForProtocol::EnableAsciiIpv6Impl (Ptr stream, std::string prefix, NodeContainer n) +AsciiTraceHelperForIpv6::EnableAsciiIpv6Impl (Ptr stream, std::string prefix, NodeContainer n) { for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i) { @@ -1099,7 +1099,7 @@ TraceHelperForProtocol::EnableAsciiIpv6Impl (Ptr stream, std // Public API // void -TraceHelperForProtocol::EnableAsciiIpv6All (std::string prefix) +AsciiTraceHelperForIpv6::EnableAsciiIpv6All (std::string prefix) { EnableAsciiIpv6Impl (Ptr (), prefix, NodeContainer::GetGlobal ()); } @@ -1108,7 +1108,7 @@ TraceHelperForProtocol::EnableAsciiIpv6All (std::string prefix) // Public API // void -TraceHelperForProtocol::EnableAsciiIpv6All (Ptr stream) +AsciiTraceHelperForIpv6::EnableAsciiIpv6All (Ptr stream) { EnableAsciiIpv6Impl (stream, std::string (), NodeContainer::GetGlobal ()); } @@ -1117,7 +1117,7 @@ TraceHelperForProtocol::EnableAsciiIpv6All (Ptr stream) // Public API // void -TraceHelperForProtocol::EnableAsciiIpv6 (Ptr stream, uint32_t nodeid, uint32_t interface) +AsciiTraceHelperForIpv6::EnableAsciiIpv6 (Ptr stream, uint32_t nodeid, uint32_t interface) { EnableAsciiIpv6Impl (stream, std::string (), nodeid, interface); } @@ -1126,7 +1126,7 @@ TraceHelperForProtocol::EnableAsciiIpv6 (Ptr stream, uint32_ // Public API // void -TraceHelperForProtocol::EnableAsciiIpv6 (std::string prefix, uint32_t nodeid, uint32_t interface) +AsciiTraceHelperForIpv6::EnableAsciiIpv6 (std::string prefix, uint32_t nodeid, uint32_t interface) { EnableAsciiIpv6Impl (Ptr (), prefix, nodeid, interface); } @@ -1135,7 +1135,7 @@ TraceHelperForProtocol::EnableAsciiIpv6 (std::string prefix, uint32_t nodeid, ui // Private API // void -TraceHelperForProtocol::EnableAsciiIpv6Impl ( +AsciiTraceHelperForIpv6::EnableAsciiIpv6Impl ( Ptr stream, std::string prefix, uint32_t nodeid, diff --git a/src/helper/trace-helper.h b/src/helper/trace-helper.h index db2f694ae..06d478f03 100644 --- a/src/helper/trace-helper.h +++ b/src/helper/trace-helper.h @@ -395,18 +395,10 @@ public: }; /** - * @brief Class providing common pcap and ascii trace operations for helpers - * working with devices. - * - * It would be nice to make this class completely independent of the pcap - * trace helper for devices, but pybindgen doesn't support multiple inheritance - * no matter how well behaved, so even mixins are out of the question. Because - * of this, we have a hierarchy of tracing functionality that devices can - * add. If your device helper inherits from PcapHelperForDevice, you get pcap - * tracing. If your device helper inherits from TraceHelperForDevice, you - * get both ascii and pcap tracing. + * \brief Base class providing common user-level ascii trace operations for helpers + * representing net devices. */ -class TraceHelperForDevice : public PcapHelperForDevice +class AsciiTraceHelperForDevice { public: /** @@ -579,7 +571,7 @@ private: }; /** - * \brief Base class providing common user-level pcap operations for helpers + * @brief Base class providing common user-level pcap operations for helpers * representing IPv4 protocols . */ class PcapHelperForIpv4 @@ -652,18 +644,10 @@ public: }; /** - * @brief Base class providing common pcap and ascii trace operations for - * helpers working with Ipv4 interfaces. - * - * It would be nice to make this class completely independent of the pcap - * trace helper for Ipv4, but pybindgen doesn't support multiple inheritance - * no matter how well behaved, so even mixins are out of the question. Because - * of this, we have a hierarchy of tracing functionality that protocol helpers - * can add. If your helper inherits from PcapHelperForIpv4, you get pcap - * tracing. If your helper inherits from PcapAndAsciiHelperForIpv4, you - * get both ascii and pcap tracing. + * @brief Base class providing common user-level ascii trace operations for + * helpers representing IPv4 protocols . */ -class PcapAndAsciiHelperForIpv4 : public PcapHelperForIpv4 +class AsciiTraceHelperForIpv4 { public: /** @@ -847,20 +831,10 @@ private: }; /** - * \brief Base class providing common user-level ascii and pcap tracing - * for Ipv4 protocols plus pcap tracing for IPv6 protocols . - * - * It would be nice to make this class completely independent of the trace - * helpers for Ipv4, but pybindgen doesn't support multiple inheritance - * no matter how well behaved, so even mixins are out of the question. Because - * of this, we have a hierarchy of tracing functionality that protocols can - * add. If your protocol helper inherits from PcapHelperForIpv4, you get pcap - * tracing for Ipv4 protocols. If your protocol helper inherits from - * PcapAndAsciiHelperForIpv4, you get both ascii and pcap tracing for Ipv4 - * protocols. If you inherit from PcapAndAsciiHelperForIpv4AndPcapHelperForIpv6 - * you get both ascii and pcap tracing for Ipv4 and pcap tracing for Ipv6. + * @brief Base class providing common user-level pcap operations for helpers + * representing IPv6 protocols . */ -class PcapAndAsciiHelperForIpv4AndPcapHelperForIpv6 : public PcapAndAsciiHelperForIpv4 +class PcapHelperForIpv6 { public: /** @@ -929,22 +903,10 @@ public: }; /** - * @brief Base class providing common ascii trace operations for helpers - * working with Ipv4 and Ipv6 interfaces. - * - * It would be nice to make this class completely independent of the trace - * helpers for Ipv4, and the pcap helper for Ipv6, but pybindgen doesn't support - * multiple inheritance no matter how well behaved, so even mixins are out of - * the question. Because of this, we have a hierarchy of tracing functionality - * that protocoll helpers can add. If your protocol helper inherits from - * PcapHelperForIpv4, you get pcap tracing for Ipv4 protocols. If your protocol - * helper inherits from PcapAndAsciiHelperForIpv4, you get both ascii and pcap - * tracing for Ipv4 protocols. If your helper inherits from - * PcapAndAsciiHelperForIpv4AndPcapHelperForIpv6 you get both ascii and pcap - * tracing for Ipv4 and pcap tracing for Ipv6. If your device helper inherits - * from TraceHelperForProtocol, you get the full meal deal. + * @brief Base class providing common user-level ascii trace operations for + * helpers representing IPv6 protocols . */ -class TraceHelperForProtocol : public PcapAndAsciiHelperForIpv4AndPcapHelperForIpv6 +class AsciiTraceHelperForIpv6 { public: /** diff --git a/src/helper/wifi-helper.h b/src/helper/wifi-helper.h index 0e68d23bc..a079d0f63 100644 --- a/src/helper/wifi-helper.h +++ b/src/helper/wifi-helper.h @@ -43,7 +43,7 @@ class Node; * This base class must be implemented by new PHY implementation which wish to integrate * with the \ref ns3::WifiHelper class. */ -class WifiPhyHelper : public TraceHelperForDevice +class WifiPhyHelper { public: virtual ~WifiPhyHelper (); diff --git a/src/helper/yans-wifi-helper.h b/src/helper/yans-wifi-helper.h index d00afc590..1081f1092 100644 --- a/src/helper/yans-wifi-helper.h +++ b/src/helper/yans-wifi-helper.h @@ -136,7 +136,8 @@ private: * in this class correspond to PHY-level traces and come to us via WifiPhyHelper * */ -class YansWifiPhyHelper : public WifiPhyHelper +class YansWifiPhyHelper : public WifiPhyHelper, + public PcapHelperForDevice, public AsciiTraceHelperForDevice { public: /**