blob: 8a7a9e2911e57cd921a81b6277ba163afd68abda [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
21#include "ccnx-face-container.h"
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070022
Alexander Afanasyev7112f482011-08-17 14:05:57 -070023#include <algorithm>
24
25#include "ns3/ccnx-face.h"
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070026
27namespace ns3 {
28
29CcnxFaceContainer::CcnxFaceContainer ()
30{
31}
32
Alexander Afanasyev7112f482011-08-17 14:05:57 -070033CcnxFaceContainer::CcnxFaceContainer (const CcnxFaceContainer &other)
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070034{
Alexander Afanasyev7112f482011-08-17 14:05:57 -070035 AddAll (other);
36}
37
38CcnxFaceContainer&
39CcnxFaceContainer::operator= (const CcnxFaceContainer &other)
40{
41 m_faces.clear ();
42 AddAll (other);
43
44 return *this;
45}
46
47
48void
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070049CcnxFaceContainer::AddAll (Ptr<CcnxFaceContainer> other)
50{
51 AddAll (*other);
52}
53
54void
Alexander Afanasyev7112f482011-08-17 14:05:57 -070055CcnxFaceContainer::AddAll (const CcnxFaceContainer &other)
56{
57 m_faces.insert (m_faces.end (),
58 other.m_faces.begin (), other.m_faces.end ());
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070059}
60
61CcnxFaceContainer::Iterator
62CcnxFaceContainer::Begin (void) const
63{
64 return m_faces.begin ();
65}
66
67CcnxFaceContainer::Iterator
68CcnxFaceContainer::End (void) const
69{
70 return m_faces.end ();
71}
72
73uint32_t
74CcnxFaceContainer::GetN (void) const
75{
76 return m_faces.size ();
77}
78
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070079// void
80// CcnxFaceContainer::SetMetricToAll (uint16_t metric)
81// {
82// for (FaceContainer::iterator it=m_faces.begin ();
83// it != m_faces.end ();
84// it++)
85// {
86// (*it)->SetMetric (metric);
87// }
88// }
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070089
90void
Alexander Afanasyev7112f482011-08-17 14:05:57 -070091CcnxFaceContainer::Add (const Ptr<CcnxFace> &face)
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070092{
Alexander Afanasyev7112f482011-08-17 14:05:57 -070093 m_faces.push_back (face);
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070094}
95
Alexander Afanasyev7112f482011-08-17 14:05:57 -070096Ptr<CcnxFace>
97CcnxFaceContainer::Get (CcnxFaceContainer::Iterator i) const
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070098{
Alexander Afanasyev7112f482011-08-17 14:05:57 -070099 return *i;
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700100}
101
102
103} // namespace ns3