blob: 69e90c90de03d724fc404c4ef21fbdefec9772d6 [file] [log] [blame]
Alexander Afanasyev7112f482011-08-17 14:05:57 -07001/* -*- 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 Afanasyev45b92d42011-08-14 23:11:38 -070020
Alexander Afanasyev0c395372014-12-20 15:54:02 -080021#include "ndn-face-container.hpp"
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070022
Alexander Afanasyev7112f482011-08-17 14:05:57 -070023#include <algorithm>
24
Alexander Afanasyev0c395372014-12-20 15:54:02 -080025#include "ns3/ndn-face.hpp"
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070026
27namespace ns3 {
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070028namespace ndn {
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070029
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070030FaceContainer::FaceContainer ()
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070031{
32}
33
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070034FaceContainer::FaceContainer (const FaceContainer &other)
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070035{
Alexander Afanasyev7112f482011-08-17 14:05:57 -070036 AddAll (other);
37}
38
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070039FaceContainer&
40FaceContainer::operator= (const FaceContainer &other)
Alexander Afanasyev7112f482011-08-17 14:05:57 -070041{
42 m_faces.clear ();
43 AddAll (other);
44
45 return *this;
46}
47
48
49void
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070050FaceContainer::AddAll (Ptr<FaceContainer> other)
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070051{
52 AddAll (*other);
53}
54
55void
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070056FaceContainer::AddAll (const FaceContainer &other)
Alexander Afanasyev7112f482011-08-17 14:05:57 -070057{
58 m_faces.insert (m_faces.end (),
59 other.m_faces.begin (), other.m_faces.end ());
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070060}
61
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070062FaceContainer::Iterator
63FaceContainer::Begin (void) const
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070064{
65 return m_faces.begin ();
66}
67
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070068FaceContainer::Iterator
69FaceContainer::End (void) const
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070070{
71 return m_faces.end ();
72}
73
74uint32_t
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070075FaceContainer::GetN (void) const
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070076{
77 return m_faces.size ();
78}
79
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070080// void
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070081// FaceContainer::SetMetricToAll (uint16_t metric)
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070082// {
83// for (FaceContainer::iterator it=m_faces.begin ();
84// it != m_faces.end ();
85// it++)
86// {
87// (*it)->SetMetric (metric);
88// }
89// }
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070090
91void
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070092FaceContainer::Add (const Ptr<Face> &face)
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070093{
Alexander Afanasyev7112f482011-08-17 14:05:57 -070094 m_faces.push_back (face);
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070095}
96
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070097Ptr<Face>
98FaceContainer::Get (FaceContainer::Iterator i) const
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070099{
Alexander Afanasyev7112f482011-08-17 14:05:57 -0700100 return *i;
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700101}
102
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700103} // namespace ndn
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700104} // namespace ns3