24 #include "detail/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)
86 BOOST_ASSERT(pibImpl !=
nullptr);
87 m_identityNames = pibImpl->getIdentities();
111 return m_identityNames.size();
117 if (m_identityNames.count(identityName) == 0) {
118 m_identityNames.insert(identityName);
119 m_identities[identityName] =
120 shared_ptr<detail::IdentityImpl>(
new detail::IdentityImpl(identityName, m_pibImpl,
true));
122 return get(identityName);
128 m_identityNames.erase(identityName);
129 m_identities.erase(identityName);
130 m_pibImpl->removeIdentity(identityName);
136 shared_ptr<detail::IdentityImpl> id;
137 auto it = m_identities.find(identityName);
139 if (it != m_identities.end()) {
143 id = shared_ptr<detail::IdentityImpl>(
new detail::IdentityImpl(identityName, m_pibImpl,
false));
144 m_identities[identityName] = id;
152 m_identities.clear();
153 m_identityNames = m_pibImpl->getIdentities();
159 return m_identityNames == m_pibImpl->getIdentities();
void remove(const Name &identity)
Remove identity from the container.
Copyright (c) 2013-2017 Regents of the University of California.
void reset()
Reset state of the container.
const_iterator begin() const
#define NDN_CXX_ASSERT_FORWARD_ITERATOR(T)
assert T is a forward iterator
bool operator==(const const_iterator &other)
Identity add(const Name &identityName)
Add identity into the container.
const_iterator end() const
const_iterator find(const Name &keyId) const
Identity get(const Name &identity) const
Get identity from the container.
bool isConsistent() const
Check if the container is consistent with the backend storage.
bool operator!=(const const_iterator &other)
Represents an absolute name.
const_iterator & operator++()
Container of identities of a Pib.
A frontend handle of an Identity.