blob: f25ea5e45091dba812278b0065c9cce8fefe4629 [file] [log] [blame]
Alexander Afanasyev45b92d42011-08-14 23:11:38 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
3#include "ccnx-face-container.h"
4#include "ns3/node-list.h"
5#include "ns3/names.h"
6
7namespace ns3 {
8
9CcnxFaceContainer::CcnxFaceContainer ()
10{
11}
12
13void
14CcnxFaceContainer::Add (CcnxFaceContainer other)
15{
16 for (FaceVector::const_iterator i = other.m_faces.begin (); i != other.m_faces.end (); i++)
17 {
18 m_faces.push_back (*i);
19 }
20}
21
22CcnxFaceContainer::Iterator
23CcnxFaceContainer::Begin (void) const
24{
25 return m_faces.begin ();
26}
27
28CcnxFaceContainer::Iterator
29CcnxFaceContainer::End (void) const
30{
31 return m_faces.end ();
32}
33
34uint32_t
35CcnxFaceContainer::GetN (void) const
36{
37 return m_faces.size ();
38}
39
40// CcnxAddress
41// CcnxFaceContainer::GetAddress (uint32_t i, uint32_t j) const
42// {
43// Ptr<Ccnx> ccnx = m_faces[i].first;
44// uint32_t face = m_faces[i].second;
45// return ccnx->GetAddress (face, j).GetLocal ();
46// }
47
48void
49CcnxFaceContainer::SetMetric (uint32_t i, uint16_t metric)
50{
51 Ptr<Ccnx> ccnx = m_faces[i].first;
52 uint32_t face = m_faces[i].second;
53 ccnx->SetMetric (face, metric);
54}
55
56void
57CcnxFaceContainer::Add (Ptr<Ccnx> ccnx, uint32_t face)
58{
59 m_faces.push_back (std::make_pair (ccnx, face));
60}
61
62void CcnxFaceContainer::Add (std::pair<Ptr<Ccnx>, uint32_t> a)
63{
64 Add (a.first, a.second);
65}
66
67void
68CcnxFaceContainer::Add (std::string ccnxName, uint32_t face)
69{
70 Ptr<Ccnx> ccnx = Names::Find<Ccnx> (ccnxName);
71 m_faces.push_back (std::make_pair (ccnx, face));
72}
73
74std::pair<Ptr<Ccnx>, uint32_t>
75CcnxFaceContainer::Get (uint32_t i) const
76{
77 return m_faces[i];
78}
79
80
81} // namespace ns3