NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
ndn-face-container.cc
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  */
20 
21 #include "ndn-face-container.h"
22 
23 #include <algorithm>
24 
25 #include "ns3/ndn-face.h"
26 
27 namespace ns3 {
28 namespace ndn {
29 
31 {
32 }
33 
35 {
36  AddAll (other);
37 }
38 
41 {
42  m_faces.clear ();
43  AddAll (other);
44 
45  return *this;
46 }
47 
48 
49 void
50 FaceContainer::AddAll (Ptr<FaceContainer> other)
51 {
52  AddAll (*other);
53 }
54 
55 void
57 {
58  m_faces.insert (m_faces.end (),
59  other.m_faces.begin (), other.m_faces.end ());
60 }
61 
64 {
65  return m_faces.begin ();
66 }
67 
69 FaceContainer::End (void) const
70 {
71  return m_faces.end ();
72 }
73 
74 uint32_t
75 FaceContainer::GetN (void) const
76 {
77  return m_faces.size ();
78 }
79 
80 // void
81 // FaceContainer::SetMetricToAll (uint16_t metric)
82 // {
83 // for (FaceContainer::iterator it=m_faces.begin ();
84 // it != m_faces.end ();
85 // it++)
86 // {
87 // (*it)->SetMetric (metric);
88 // }
89 // }
90 
91 void
92 FaceContainer::Add (const Ptr<Face> &face)
93 {
94  m_faces.push_back (face);
95 }
96 
97 Ptr<Face>
99 {
100  return *i;
101 }
102 
103 } // namespace ndn
104 } // namespace ns3
void Add(const Ptr< Face > &face)
Set a metric for all faces in the container.
uint32_t GetN() const
Get the number of faces stored in this container.
Iterator Begin() const
Get an iterator which refers to the first pair in the container.
Ptr< Face > Get(Iterator i) const
Get a smart pointer to Face-derived object stored in the container.
void AddAll(Ptr< FaceContainer > other)
Add all entries from other container.
FaceContainer & operator=(const FaceContainer &other)
Copy operator for FaceContainer.
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
FaceContainer()
Create an empty FaceContainer.
A pool for Ndn faces.
Container::const_iterator Iterator
Iterator over FaceContainer.