OLD | NEW |
(Empty) | |
| 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2015 Amir Modarresi |
| 4 * |
| 5 * This program is free software; you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 2 as |
| 7 * published by the Free Software Foundation; |
| 8 * |
| 9 * This program is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with this program; if not, write to the Free Software |
| 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 * |
| 18 * Author: Amir Modarresi <amodarresi@ittc.ku.edu> |
| 19 * |
| 20 * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director |
| 21 * ResiliNets Research Group http://wiki.ittc.ku.edu/resilinets |
| 22 * Information and Telecommunication Technology Center (ITTC) |
| 23 * and Department of Electrical Engineering and Computer Science |
| 24 * The University of Kansas Lawrence, KS USA. |
| 25 * |
| 26 * Work supported in part by NSF FIND (Future Internet Design) Program |
| 27 * under grant CNS-0626918 (Postmodern Internet Architecture), |
| 28 * NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimenta
tion on GENI), |
| 29 * US Department of Defense (DoD), and ITTC at The University of Kansas. |
| 30 */ |
| 31 |
| 32 #include <iostream> |
| 33 #include "sift-main-helper.h" |
| 34 #include "ns3/sift-helper.h" |
| 35 #include "ns3/sift-routing.h" |
| 36 #include "ns3/node-list.h" |
| 37 #include "ns3/names.h" |
| 38 #include "ns3/log.h" |
| 39 #include "ns3/ptr.h" |
| 40 #include "ns3/node.h" |
| 41 |
| 42 |
| 43 NS_LOG_COMPONENT_DEFINE ("SiftMainHelper"); |
| 44 |
| 45 namespace ns3 { |
| 46 · |
| 47 |
| 48 SiftMainHelper::SiftMainHelper () |
| 49 : m_siftHelper (0) |
| 50 { |
| 51 NS_LOG_FUNCTION (this); |
| 52 } |
| 53 |
| 54 SiftMainHelper::SiftMainHelper (const SiftMainHelper &o) |
| 55 { |
| 56 NS_LOG_FUNCTION (this); |
| 57 m_siftHelper = o.m_siftHelper->Copy (); |
| 58 } |
| 59 |
| 60 SiftMainHelper::~SiftMainHelper () |
| 61 { |
| 62 NS_LOG_FUNCTION (this); |
| 63 delete m_siftHelper; |
| 64 } |
| 65 |
| 66 SiftMainHelper & |
| 67 SiftMainHelper::operator = (const SiftMainHelper &o) |
| 68 { |
| 69 if (this == &o) |
| 70 { |
| 71 return *this; |
| 72 } |
| 73 m_siftHelper = o.m_siftHelper->Copy (); |
| 74 return *this; |
| 75 } |
| 76 |
| 77 void |
| 78 SiftMainHelper::Install (SiftHelper &siftHelper, NodeContainer nodes) |
| 79 { |
| 80 NS_LOG_DEBUG ("Passed node container"); |
| 81 delete m_siftHelper; |
| 82 m_siftHelper = siftHelper.Copy (); |
| 83 for (NodeContainer::Iterator i = nodes.Begin (); i != nodes.End (); ++i) |
| 84 { |
| 85 Install (*i); |
| 86 ······ |
| 87 } |
| 88 } |
| 89 |
| 90 void |
| 91 SiftMainHelper::Install (Ptr<Node> node) |
| 92 { |
| 93 NS_LOG_FUNCTION (node); |
| 94 Ptr<ns3::sift::SiftRouting> sift = m_siftHelper->Create (node); |
| 95 sift->SetNode (node); |
| 96 } |
| 97 |
| 98 void |
| 99 SiftMainHelper::SetSiftHelper (SiftHelper &siftHelper) |
| 100 { |
| 101 NS_LOG_FUNCTION (this); |
| 102 delete m_siftHelper; |
| 103 m_siftHelper = siftHelper.Copy (); |
| 104 } |
| 105 |
| 106 · |
| 107 } // namespace ns3 |
OLD | NEW |