NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
key-container.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #include "key-container.hpp"
23 #include "pib-impl.hpp"
24 
25 namespace ndn {
26 namespace security {
27 
28 KeyContainer::const_iterator::const_iterator(const Name& identity,
29  std::set<name::Component>::const_iterator it,
30  shared_ptr<PibImpl> impl)
31  : m_identity(identity)
32  , m_it(it)
33  , m_impl(impl)
34 {
35 }
36 
37 Key
38 KeyContainer::const_iterator::operator*()
39 {
40  return Key(m_identity, *m_it, m_impl);
41 }
42 
44 KeyContainer::const_iterator::operator++()
45 {
46  ++m_it;
47  return *this;
48 }
49 
51 KeyContainer::const_iterator::operator++(int)
52 {
53  const_iterator it(*this);
54  ++m_it;
55  return it;
56 }
57 
58 bool
60 {
61  return (m_impl == other.m_impl && m_identity == other.m_identity && m_it == other.m_it);
62 }
63 
64 bool
66 {
67  return !(*this == other);
68 }
69 
70 KeyContainer::KeyContainer()
71 {
72 }
73 
74 KeyContainer::KeyContainer(const Name& identity,
75  std::set<name::Component>&& keyIds,
76  shared_ptr<PibImpl> impl)
77  : m_identity(identity)
78  , m_keyIds(keyIds)
79  , m_impl(impl)
80 {
81 }
82 
85 {
86  return const_iterator(m_identity, m_keyIds.begin(), m_impl);
87 }
88 
91 {
92  return const_iterator(m_identity, m_keyIds.end(), m_impl);
93 }
94 
97 {
98  return const_iterator(m_identity, m_keyIds.find(keyId), m_impl);
99 }
100 
101 size_t
103 {
104  return m_keyIds.size();
105 }
106 
107 } // namespace security
108 } // namespace ndn
Copyright (c) 2011-2015 Regents of the University of California.
represents a key
Definition: key.hpp:45
const_iterator end() const
const_iterator begin() const
Name abstraction to represent an absolute name.
Definition: name.hpp:46
const_iterator find(const name::Component &keyId) const
bool operator!=(const GlobalRouter::Incidency &a, const GlobalRouter::Incidency &b)
Component holds a read-only name component value.
bool operator==(const GlobalRouter::Incidency &a, const GlobalRouter::Incidency &b)