Canonical helper for InterestGenerator was added
diff --git a/helper/ndn_stupidinterestgenerator_helper.cc b/helper/ndn_stupidinterestgenerator_helper.cc
new file mode 100644
index 0000000..982f283
--- /dev/null
+++ b/helper/ndn_stupidinterestgenerator_helper.cc
@@ -0,0 +1,65 @@
+//
+// ndn_stupidinterestgenerator_helper.cpp
+// Abstraction
+//
+// Created by Ilya Moiseenko on 05.08.11.
+// Copyright 2011 UCLA. All rights reserved.
+//
+
+#include "ndn_stupidinterestgenerator_helper.h"
+#include "ns3/inet-socket-address.h"
+#include "ns3/packet-socket-address.h"
+#include "ns3/string.h"
+#include "ns3/names.h"
+
+
+namespace ns3 {
+
+ StupidInterestGeneratorHelper::StupidInterestGeneratorHelper (std::string protocol, Address address)
+ {
+ m_factory.SetTypeId ("ns3::StupidInterestGenerator");
+ m_factory.Set ("Protocol", StringValue (protocol));
+ m_factory.Set ("Remote", AddressValue (address));
+ }
+
+ void
+ StupidInterestGeneratorHelper::SetAttribute (std::string name, const AttributeValue &value)
+ {
+ m_factory.Set (name, value);
+ }
+
+ ApplicationContainer
+ StupidInterestGeneratorHelper::Install (Ptr<Node> node) const
+ {
+ return ApplicationContainer (InstallPriv (node));
+ }
+
+ ApplicationContainer
+ StupidInterestGeneratorHelper::Install (std::string nodeName) const
+ {
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ return ApplicationContainer (InstallPriv (node));
+ }
+
+ ApplicationContainer
+ StupidInterestGeneratorHelper::Install (NodeContainer c) const
+ {
+ ApplicationContainer apps;
+ for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
+ {
+ apps.Add (InstallPriv (*i));
+ }
+
+ return apps;
+ }
+
+ Ptr<Application>
+ StupidInterestGeneratorHelper::InstallPriv (Ptr<Node> node) const
+ {
+ Ptr<Application> app = m_factory.Create<Application> ();
+ node->AddApplication (app);
+
+ return app;
+ }
+
+} // namespace ns3
diff --git a/helper/ndn_stupidinterestgenerator_helper.h b/helper/ndn_stupidinterestgenerator_helper.h
new file mode 100644
index 0000000..4f9f6bb
--- /dev/null
+++ b/helper/ndn_stupidinterestgenerator_helper.h
@@ -0,0 +1,86 @@
+//
+// ndn_stupidinterestgenerator_helper.h
+// Abstraction
+//
+// Created by Ilya Moiseenko on 05.08.11.
+// Copyright 2011 UCLA. All rights reserved.
+//
+
+#include "ns3/object-factory.h"
+#include "ns3/ipv4-address.h"
+#include "ns3/node-container.h"
+#include "ns3/application-container.h"
+
+namespace ns3 {
+
+ /**
+ * \brief A helper to make it easier to instantiate an ns3::OnOffApplication
+ * on a set of nodes.
+ */
+ class StupidInterestGeneratorHelper
+ {
+ public:
+ /**
+ * Create an OnOffHelper to make it easier to work with OnOffApplications
+ *
+ * \param protocol the name of the protocol to use to send traffic
+ * by the applications. This string identifies the socket
+ * factory type used to create sockets for the applications.
+ * A typical value would be ns3::UdpSocketFactory.
+ * \param address the address of the remote node to send traffic
+ * to.
+ */
+ StupidInterestGeneratorHelper (std::string protocol, Address address);
+
+ /**
+ * Helper function used to set the underlying application attributes.
+ *
+ * \param name the name of the application attribute to set
+ * \param value the value of the application attribute to set
+ */
+ void SetAttribute (std::string name, const AttributeValue &value);
+
+ /**
+ * Install an ns3::OnOffApplication on each node of the input container
+ * configured with all the attributes set with SetAttribute.
+ *
+ * \param c NodeContainer of the set of nodes on which an OnOffApplication
+ * will be installed.
+ * \returns Container of Ptr to the applications installed.
+ */
+ ApplicationContainer Install (NodeContainer c) const;
+
+ /**
+ * Install an ns3::OnOffApplication on the node configured with all the
+ * attributes set with SetAttribute.
+ *
+ * \param node The node on which an OnOffApplication will be installed.
+ * \returns Container of Ptr to the applications installed.
+ */
+ ApplicationContainer Install (Ptr<Node> node) const;
+
+ /**
+ * Install an ns3::OnOffApplication on the node configured with all the
+ * attributes set with SetAttribute.
+ *
+ * \param nodeName The node on which an OnOffApplication will be installed.
+ * \returns Container of Ptr to the applications installed.
+ */
+ ApplicationContainer Install (std::string nodeName) const;
+
+ private:
+ /**
+ * \internal
+ * Install an ns3::OnOffApplication on the node configured with all the
+ * attributes set with SetAttribute.
+ *
+ * \param node The node on which an OnOffApplication will be installed.
+ * \returns Ptr to the application installed.
+ */
+ Ptr<Application> InstallPriv (Ptr<Node> node) const;
+ std::string m_protocol;
+ Address m_remote;
+ ObjectFactory m_factory;
+ };
+
+} // namespace ns3