NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
identity-container.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_SECURITY_PIB_IDENTITY_CONTAINER_HPP
23 #define NDN_SECURITY_PIB_IDENTITY_CONTAINER_HPP
24 
25 #include "identity.hpp"
26 
27 #include <set>
28 #include <unordered_map>
29 
30 namespace ndn {
31 namespace security {
32 namespace pib {
33 
34 class PibImpl;
35 
36 namespace detail {
37 class IdentityImpl;
38 } // namespace detail
39 
46 class IdentityContainer : noncopyable
47 {
48 public:
49  class const_iterator : public std::iterator<std::forward_iterator_tag, const Identity>
50  {
51  public:
53 
54  Identity
55  operator*();
56 
58  operator++();
59 
61  operator++(int);
62 
63  bool
64  operator==(const const_iterator& other);
65 
66  bool
67  operator!=(const const_iterator& other);
68 
69  private:
70  const_iterator(std::set<Name>::const_iterator it, const IdentityContainer& container);
71 
72  private:
73  std::set<Name>::const_iterator m_it;
74  const IdentityContainer* m_container;
75 
76  friend class IdentityContainer;
77  };
78 
80 
81 public:
83  begin() const;
84 
86  end() const;
87 
89  find(const Name& keyId) const;
90 
91  size_t
92  size() const;
93 
97  Identity
98  add(const Name& identityName);
99 
103  void
104  remove(const Name& identity);
105 
110  Identity
111  get(const Name& identity) const;
112 
119  void
120  reset();
121 
127  bool
128  isConsistent() const;
129 
135  explicit
136  IdentityContainer(shared_ptr<PibImpl> pibImpl);
137 
138  const std::set<Name>&
140  {
141  return m_identityNames;
142  }
143 
144  const std::unordered_map<Name, shared_ptr<detail::IdentityImpl>>&
146  {
147  return m_identities;
148  }
149 
150 private:
151  std::set<Name> m_identityNames;
153  mutable std::unordered_map<Name, shared_ptr<detail::IdentityImpl>> m_identities;
154 
155  shared_ptr<PibImpl> m_pibImpl;
156 
157  friend class Pib;
158 };
159 
160 } // namespace pib
161 
163 
164 } // namespace security
165 } // namespace ndn
166 
167 #endif // NDN_SECURITY_PIB_IDENTITY_CONTAINER_HPP
Copyright (c) 2011-2015 Regents of the University of California.
void reset()
Reset state of the container.
const std::set< Name > & getIdentityNames() const
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:43
Table::const_iterator iterator
Definition: cs-internal.hpp:41
Identity add(const Name &identityName)
Add identity into the container.
const_iterator find(const Name &keyId) const
Represents an absolute name.
Definition: name.hpp:42
Container of identities of a Pib.
bool isConsistent() const
Check if the container is consistent with the backend storage.
A frontend handle of an Identity.
Definition: identity.hpp:42
const std::unordered_map< Name, shared_ptr< detail::IdentityImpl > > & getLoadedIdentities() const
represents the PIB
Definition: pib.hpp:52