24 #include "ndn-cxx/security/pib/impl/identity-impl.hpp"
34 : m_container(nullptr)
41 , m_container(&container)
48 BOOST_ASSERT(m_container !=
nullptr);
49 return m_container->get(*m_it);
70 bool isThisEnd = m_container ==
nullptr || m_it == m_container->m_identityNames.end();
71 bool isOtherEnd = other.m_container ==
nullptr || other.m_it == other.m_container->m_identityNames.end();
72 return ((isThisEnd || isOtherEnd) ?
73 (isThisEnd == isOtherEnd) :
74 m_container->m_pibImpl == other.m_container->m_pibImpl && m_it == other.m_it);
80 return !(*
this == other);
83 IdentityContainer::IdentityContainer(shared_ptr<PibImpl> pibImpl)
84 : m_pibImpl(std::move(pibImpl))
86 BOOST_ASSERT(m_pibImpl !=
nullptr);
87 m_identityNames = m_pibImpl->getIdentities();
111 return m_identityNames.size();
117 if (m_identityNames.count(identityName) == 0) {
118 m_identityNames.insert(identityName);
119 m_identities[identityName] = make_shared<detail::IdentityImpl>(identityName, m_pibImpl,
true);
121 return get(identityName);
127 m_identityNames.erase(identityName);
128 m_identities.erase(identityName);
129 m_pibImpl->removeIdentity(identityName);
135 shared_ptr<detail::IdentityImpl> id;
136 auto it = m_identities.find(identityName);
138 if (it != m_identities.end()) {
142 id = make_shared<detail::IdentityImpl>(identityName, m_pibImpl,
false);
143 m_identities[identityName] = id;
151 m_identities.clear();
152 m_identityNames = m_pibImpl->getIdentities();
158 return m_identityNames == m_pibImpl->getIdentities();
Represents an absolute name.
const_iterator & operator++()
bool operator==(const const_iterator &other)
bool operator!=(const const_iterator &other)
Container of identities of a Pib.
const_iterator find(const Name &keyId) const
Identity get(const Name &identity) const
Get identity from the container.
const_iterator begin() const
const_iterator end() const
void remove(const Name &identity)
Remove identity from the container.
bool isConsistent() const
Check if the container is consistent with the backend storage.
void reset()
Reset state of the container.
Identity add(const Name &identityName)
Add identity into the container.
A frontend handle of an Identity.
#define NDN_CXX_ASSERT_FORWARD_ITERATOR(T)
assert T is a forward iterator