src/applications/helper/on-off-helper.cc
changeset 8966 060dba23e9bb
parent 6847 138f00c56381
child 9000 3ec20a64fd08
--- a/src/applications/helper/on-off-helper.cc	Mon Aug 13 10:46:09 2012 -0700
+++ b/src/applications/helper/on-off-helper.cc	Mon Aug 13 16:08:13 2012 -0700
@@ -22,6 +22,7 @@
 #include "ns3/packet-socket-address.h"
 #include "ns3/string.h"
 #include "ns3/names.h"
+#include "ns3/onoff-application.h"
 
 namespace ns3 {
 
@@ -72,4 +73,24 @@
   return app;
 }
 
+int64_t
+OnOffHelper::AssignStreams (NodeContainer c, int64_t stream)
+{
+  int64_t currentStream = stream;
+  Ptr<Node> node;
+  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
+    {
+      node = (*i);
+      for (uint32_t j = 0; j < node->GetNApplications (); j++)
+        {
+          Ptr<OnOffApplication> onoff = DynamicCast<OnOffApplication> (node->GetApplication (j));
+          if (onoff)
+            {
+              currentStream += onoff->AssignStreams (currentStream);
+            }
+        }
+    }
+  return (currentStream - stream);
+}
+
 } // namespace ns3