an initial draft of helper classes. don't work yet.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/csma/csma-helper.cc Thu Feb 14 23:56:54 2008 +0100
@@ -0,0 +1,59 @@
+#include "csma-helper.h"
+
+namespace ns3 {
+
+CsmaHelper::CsmaHelper ()
+{
+ m_queueFactory.SetTypeId ("DropTailQueue");
+ m_deviceFactory.SetTypeId ("CsmaNetDevice");
+ m_deviceChannel.SetTypeId ("CsmaChannel");
+}
+
+void
+CsmaHelper::SetQueue (std::string type,
+ std::string n1, PValue v1,
+ std::string n2, PValue v2,
+ std::string n3, PValue v3,
+ std::string n4, PValue v4)
+{
+ m_queueFactory.SetTypeId (type);
+ m_queueFactory.Set (n1, v1);
+ m_queueFactory.Set (n2, v2);
+ m_queueFactory.Set (n3, v3);
+ m_queueFactory.Set (n4, v4);
+}
+
+ /**
+ * Set these parameters on each PointToPointNetDevice created
+ * by this helper.
+ */
+void
+CsmaHelper::SetDeviceParameter (std::string n1, PValue v1)
+{
+ m_deviceFactory.Set (n1, v1);
+}
+
+void
+CsmaHelper::SetChannelParameter (std::string n1, PValue v1)
+{
+ m_csmaFactory.Set (n1, v1);
+}
+
+NetDeviceContainer
+CsmaHelper::Build (const NodeContainer &c)
+{
+ Ptr<CsmaChannel> channel = m_channelFactory.Create ()->GetObject<CsmaChannel> ();
+ return Build (c, channel);
+}
+
+NetDeviceContainer
+CsmaHelper::Build (const NodeContainer &c, Ptr<CsmaChannel> channel)
+{
+ for (NodeContainer::Iterator i = c.Begin (); i != c.End (); i++)
+ {
+
+ }
+}
+
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/csma/csma-helper.h Thu Feb 14 23:56:54 2008 +0100
@@ -0,0 +1,38 @@
+#ifndef CSMA_HELPER_H
+#define CSMA_HELPER_H
+
+namespace ns3 {
+
+class CsmaHelper
+{
+public:
+ CsmaHelper ();
+
+ void SetQueue (std::string type,
+ std::string n1 = "", PValue v1 = PValue (),
+ std::string n2 = "", PValue v2 = PValue (),
+ std::string n3 = "", PValue v3 = PValue (),
+ std::string n4 = "", PValue v4 = PValue ());
+
+ /**
+ * Set these parameters on each PointToPointNetDevice created
+ * by this helper.
+ */
+ void SetDeviceParameter (std::string n1, PValue v1);
+
+ void SetChannelParameter (std::string n1, PValue v1);
+
+ NetDeviceContainer Build (const NodeContainer &c);
+
+ NetDeviceContainer Build (const NodeContainer &c, Ptr<CsmaChannel> channel);
+
+private:
+ ObjectFactory m_queueFactory;
+ ObjectFactory m_deviceFactory;
+ ObjectFactory m_channelFactory;
+};
+
+
+} // namespace ns3
+
+#endif /* CSMA_HELPER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/point-to-point/point-to-point-helper.cc Thu Feb 14 23:56:54 2008 +0100
@@ -0,0 +1,53 @@
+#include "point-to-point-helper.h"
+#include "point-to-point-net-device.h"
+#include "point-to-point-channel.h"
+#include "ns3/queue.h"
+
+namespace ns3 {
+
+
+PointToPointHelper::PointToPointHelper ()
+{}
+
+void
+PointToPointHelper::SetQueue (std::string type,
+ std::string n1, PValue v1,
+ std::string n2, PValue v2,
+ std::string n3, PValue v3,
+ std::string n4, PValue v4)
+{
+ m_queueFactory.SetTypeId (type);
+ m_queueFactory.Set (n1, v1);
+ m_queueFactory.Set (n2, v2);
+ m_queueFactory.Set (n3, v3);
+ m_queueFactory.Set (n4, v4);
+}
+
+NetDeviceContainer
+PointToPointHelper::Build (NodeContainer c)
+{
+ NS_ASSERT (c.GetN () == 2);
+ return Build (c.Get (0), c.Get (1));
+}
+NetDeviceContainer
+PointToPointHelper::Build (Ptr<Node> a, Ptr<Node> b)
+{
+ NetDeviceContainer container;
+
+ Ptr<PointToPointNetDevice> devA = CreateObject<PointToPointNetDevice> (a);
+ Ptr<Queue> queueA = m_queueFactory.Create ()->GetObject<Queue> ();
+ devA->AddQueue (queueA);
+ Ptr<PointToPointNetDevice> devB = CreateObject<PointToPointNetDevice> (b);
+ Ptr<Queue> queueB = m_queueFactory.Create ()->GetObject<Queue> ();
+ devB->AddQueue (queueB);
+ Ptr<PointToPointChannel> channel = CreateObject<PointToPointChannel> ();
+ devA->Attach (channel);
+ devB->Attach (channel);
+ container.Add (devA);
+ container.Add (devB);
+
+ return container;
+}
+
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/devices/point-to-point/point-to-point-helper.h Thu Feb 14 23:56:54 2008 +0100
@@ -0,0 +1,42 @@
+#ifndef POINT_TO_POINT_HELPER_H
+#define POINT_TO_POINT_HELPER_H
+
+#include "ns3/object-factory.h"
+#include "ns3/net-device-container.h"
+#include "ns3/node-container.h"
+#include <string>
+
+namespace ns3 {
+
+class PointToPointHelper
+{
+public:
+ // by default, create queues of type DropTailQueue.
+ PointToPointHelper ();
+
+ void SetQueue (std::string type,
+ std::string n1 = "", PValue v1 = PValue (),
+ std::string n2 = "", PValue v2 = PValue (),
+ std::string n3 = "", PValue v3 = PValue (),
+ std::string n4 = "", PValue v4 = PValue ());
+
+ /**
+ * Set these parameters on each PointToPointNetDevice created
+ * by this helper.
+ */
+ void SetDeviceParameters (std::string n1, PValue v1,
+ std::string n2 = "", PValue v2 = PValue (),
+ std::string n3 = "", PValue v3 = PValue (),
+ std::string n4 = "", PValue v4 = PValue ());
+
+ NetDeviceContainer Build (NodeContainer c);
+ NetDeviceContainer Build (Ptr<Node> a, Ptr<Node> b);
+
+private:
+ ObjectFactory m_queueFactory;
+};
+
+
+} // namespace ns3
+
+#endif /* POINT_TO_POINT_HELPER_H */