Alexander Afanasyev | 7112f48 | 2011-08-17 14:05:57 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2011 University of California, Los Angeles |
| 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: Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 19 | */ |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 20 | |
Alexander Afanasyev | 0c39537 | 2014-12-20 15:54:02 -0800 | [diff] [blame^] | 21 | #include "ndn-face-container.hpp" |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 22 | |
Alexander Afanasyev | 7112f48 | 2011-08-17 14:05:57 -0700 | [diff] [blame] | 23 | #include <algorithm> |
| 24 | |
Alexander Afanasyev | 0c39537 | 2014-12-20 15:54:02 -0800 | [diff] [blame^] | 25 | #include "ns3/ndn-face.hpp" |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 26 | |
| 27 | namespace ns3 { |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 28 | namespace ndn { |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 29 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 30 | FaceContainer::FaceContainer () |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 31 | { |
| 32 | } |
| 33 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 34 | FaceContainer::FaceContainer (const FaceContainer &other) |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 35 | { |
Alexander Afanasyev | 7112f48 | 2011-08-17 14:05:57 -0700 | [diff] [blame] | 36 | AddAll (other); |
| 37 | } |
| 38 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 39 | FaceContainer& |
| 40 | FaceContainer::operator= (const FaceContainer &other) |
Alexander Afanasyev | 7112f48 | 2011-08-17 14:05:57 -0700 | [diff] [blame] | 41 | { |
| 42 | m_faces.clear (); |
| 43 | AddAll (other); |
| 44 | |
| 45 | return *this; |
| 46 | } |
| 47 | |
| 48 | |
| 49 | void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 50 | FaceContainer::AddAll (Ptr<FaceContainer> other) |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 51 | { |
| 52 | AddAll (*other); |
| 53 | } |
| 54 | |
| 55 | void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 56 | FaceContainer::AddAll (const FaceContainer &other) |
Alexander Afanasyev | 7112f48 | 2011-08-17 14:05:57 -0700 | [diff] [blame] | 57 | { |
| 58 | m_faces.insert (m_faces.end (), |
| 59 | other.m_faces.begin (), other.m_faces.end ()); |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 60 | } |
| 61 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 62 | FaceContainer::Iterator |
| 63 | FaceContainer::Begin (void) const |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 64 | { |
| 65 | return m_faces.begin (); |
| 66 | } |
| 67 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 68 | FaceContainer::Iterator |
| 69 | FaceContainer::End (void) const |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 70 | { |
| 71 | return m_faces.end (); |
| 72 | } |
| 73 | |
| 74 | uint32_t |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 75 | FaceContainer::GetN (void) const |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 76 | { |
| 77 | return m_faces.size (); |
| 78 | } |
| 79 | |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 80 | // void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 81 | // FaceContainer::SetMetricToAll (uint16_t metric) |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 82 | // { |
| 83 | // for (FaceContainer::iterator it=m_faces.begin (); |
| 84 | // it != m_faces.end (); |
| 85 | // it++) |
| 86 | // { |
| 87 | // (*it)->SetMetric (metric); |
| 88 | // } |
| 89 | // } |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 90 | |
| 91 | void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 92 | FaceContainer::Add (const Ptr<Face> &face) |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 93 | { |
Alexander Afanasyev | 7112f48 | 2011-08-17 14:05:57 -0700 | [diff] [blame] | 94 | m_faces.push_back (face); |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 95 | } |
| 96 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 97 | Ptr<Face> |
| 98 | FaceContainer::Get (FaceContainer::Iterator i) const |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 99 | { |
Alexander Afanasyev | 7112f48 | 2011-08-17 14:05:57 -0700 | [diff] [blame] | 100 | return *i; |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 101 | } |
| 102 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 103 | } // namespace ndn |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 104 | } // namespace ns3 |