NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
ndn-face-container.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 #include "ndn-face-container.hpp"
21 
22 #include <algorithm>
23 
24 namespace ns3 {
25 namespace ndn {
26 
28 
30 {
31  AddAll(other);
32 }
33 
36 {
37  m_faces.clear();
38  AddAll(other);
39 
40  return *this;
41 }
42 
43 void
44 FaceContainer::AddAll(Ptr<FaceContainer> other)
45 {
46  AddAll(*other);
47 }
48 
49 void
51 {
52  if (this == &other) { // adding self to self, need to make a copy
53  auto copyOfFaces = other.m_faces;
54  m_faces.insert(m_faces.end(), copyOfFaces.begin(), copyOfFaces.end());
55  }
56  else {
57  m_faces.insert(m_faces.end(), other.m_faces.begin(), other.m_faces.end());
58  }
59 }
60 
63 {
64  return m_faces.begin();
65 }
66 
68 FaceContainer::End(void) const
69 {
70  return m_faces.end();
71 }
72 
73 uint32_t
75 {
76  return m_faces.size();
77 }
78 
79 void
80 FaceContainer::Add(shared_ptr<Face> face)
81 {
82  m_faces.push_back(face);
83 }
84 
85 shared_ptr<Face>
86 FaceContainer::Get(size_t i) const
87 {
88  return m_faces.at(i);
89 }
90 
91 } // namespace ndn
92 } // namespace ns3
void AddAll(Ptr< FaceContainer > other)
Add all entries from other container.
Copyright (c) 2011-2015 Regents of the University of California.
FaceContainer & operator=(const FaceContainer &other)
Copy operator for FaceContainer.
Iterator Begin() const
Get an iterator which refers to the first pair in the container.
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
Copyright (c) 2011-2015 Regents of the University of California.
void Add(shared_ptr< Face > face)
Add an entry to the container.
uint32_t GetN() const
Get the number of faces stored in this container.
shared_ptr< Face > Get(size_t pos) const
Get a Face stored in the container.
A pool for Ndn faces.
FaceContainer()
Create an empty FaceContainer.
Container::const_iterator Iterator
Iterator over FaceContainer.