src/helper/on-off-helper.cc
changeset 3848 affd0834debc
parent 2965 4b28e9740e3b
child 4140 6bbf05bf4826
equal deleted inserted replaced
3846:265004d6dc15 3848:affd0834debc
    36 {
    36 {
    37   m_factory.Set (name, value);
    37   m_factory.Set (name, value);
    38 }
    38 }
    39 
    39 
    40 ApplicationContainer
    40 ApplicationContainer
    41 OnOffHelper::Install (NodeContainer c)
    41 OnOffHelper::Install (Ptr<Node> node) const
       
    42 {
       
    43   return ApplicationContainer (InstallPriv (node));
       
    44 }
       
    45 
       
    46 ApplicationContainer
       
    47 OnOffHelper::Install (NodeContainer c) const
    42 {
    48 {
    43   ApplicationContainer apps;
    49   ApplicationContainer apps;
    44   for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
    50   for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
    45     {
    51     {
    46       Ptr<Node> node = *i;
    52       apps.Add (InstallPriv (*i));
    47       Ptr<Application> app = m_factory.Create<Application> ();
       
    48       node->AddApplication (app);
       
    49       apps.Add (app);
       
    50     }
    53     }
       
    54 
    51   return apps;
    55   return apps;
    52 }
    56 }
    53 
    57 
       
    58 Ptr<Application>
       
    59 OnOffHelper::InstallPriv (Ptr<Node> node) const
       
    60 {
       
    61   Ptr<Application> app = m_factory.Create<Application> ();
       
    62   node->AddApplication (app);
       
    63 
       
    64   return app;
       
    65 }
    54 
    66 
    55 } // namespace ns3
    67 } // namespace ns3