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();
const_iterator end() const
Identity get(const Name &identity) const
Get identity from the container.
void remove(const Name &identity)
Remove identity from the container.
Copyright (c) 2011-2015 Regents of the University of California.
void reset()
Reset state of the container.
NDN_CXX_ASSERT_FORWARD_ITERATOR(CertificateContainer::const_iterator)
bool operator==(const const_iterator &other)
Identity add(const Name &identityName)
Add identity into the container.
const_iterator find(const Name &keyId) const
bool operator!=(const const_iterator &other)
Represents an absolute name.
const_iterator & operator++()
const_iterator begin() const
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.