More FlowMonitorHelper utility methods
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Wed Apr 29 14:40:52 2009 +0100 (9 months ago)
changeset 3930fba3c9a574fb
parent 3929 cc68fbf6f30a
child 3931 a66c09416874
More FlowMonitorHelper utility methods
src/helper/flow-monitor-helper.cc
src/helper/flow-monitor-helper.h
     1.1 --- a/src/helper/flow-monitor-helper.cc	Wed Apr 29 12:57:03 2009 +0100
     1.2 +++ b/src/helper/flow-monitor-helper.cc	Wed Apr 29 14:40:52 2009 +0100
     1.3 @@ -23,6 +23,7 @@
     1.4  #include "ns3/ipv4-flow-classifier.h"
     1.5  #include "ns3/ipv4-flow-probe.h"
     1.6  #include "ns3/node.h"
     1.7 +#include "ns3/node-list.h"
     1.8  
     1.9  namespace ns3 {
    1.10  
    1.11 @@ -37,14 +38,23 @@
    1.12    m_monitorFactory.Set (n1, v1);
    1.13  }
    1.14  
    1.15 +
    1.16  Ptr<FlowMonitor>
    1.17 -FlowMonitorHelper::Install (Ptr<Node> node)
    1.18 +FlowMonitorHelper::GetMonitor ()
    1.19  {
    1.20    if (!m_flowMonitor)
    1.21      {   
    1.22        m_flowMonitor = m_monitorFactory.Create<FlowMonitor> ();
    1.23        m_flowClassifier = Create<Ipv4FlowClassifier> ();
    1.24 -    }  
    1.25 +    }
    1.26 +  return m_flowMonitor;
    1.27 +}
    1.28 +
    1.29 +
    1.30 +Ptr<FlowMonitor>
    1.31 +FlowMonitorHelper::Install (Ptr<Node> node)
    1.32 +{
    1.33 +  GetMonitor ();
    1.34    Ptr<Ipv4FlowProbe> probe = Create<Ipv4FlowProbe> (m_flowMonitor, m_flowClassifier, node);
    1.35    return m_flowMonitor;
    1.36  }
    1.37 @@ -60,4 +70,15 @@
    1.38    return m_flowMonitor;
    1.39  }
    1.40  
    1.41 +Ptr<FlowMonitor>
    1.42 +FlowMonitorHelper::InstallAll ()
    1.43 +{
    1.44 +  for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i)
    1.45 +    {
    1.46 +      Install (*i);
    1.47 +    }
    1.48 +  return m_flowMonitor;  
    1.49 +}
    1.50 +
    1.51 +
    1.52  } // namespace ns3
     2.1 --- a/src/helper/flow-monitor-helper.h	Wed Apr 29 12:57:03 2009 +0100
     2.2 +++ b/src/helper/flow-monitor-helper.h	Wed Apr 29 14:40:52 2009 +0100
     2.3 @@ -35,9 +35,13 @@
     2.4  public:
     2.5    FlowMonitorHelper ();
     2.6    void SetMonitorAttribute (std::string n1, const AttributeValue &v1);
     2.7 +
     2.8    Ptr<FlowMonitor> Install (NodeContainer nodes);
     2.9    Ptr<FlowMonitor> Install (Ptr<Node> node);
    2.10 +  Ptr<FlowMonitor> InstallAll ();
    2.11  
    2.12 +  Ptr<FlowMonitor> GetMonitor ();
    2.13 +  
    2.14  private:
    2.15    ObjectFactory m_monitorFactory;
    2.16    Ptr<FlowMonitor> m_flowMonitor;