33 : m_container(nullptr)
40 , m_container(&container)
47 BOOST_ASSERT(m_container !=
nullptr);
48 return m_container->get(*m_it);
61 BOOST_ASSERT(m_container !=
nullptr);
70 bool isThisEnd = m_container ==
nullptr || m_it == m_container->m_certNames.end();
71 bool isOtherEnd = other.m_container ==
nullptr || other.m_it == other.m_container->m_certNames.end();
72 return ((isThisEnd || isOtherEnd) ?
73 (isThisEnd == isOtherEnd) :
74 m_container->m_pib == other.m_container->m_pib && m_it == other.m_it);
80 return !(*
this == other);
83 CertificateContainer::CertificateContainer(
const Name& keyName, shared_ptr<PibImpl> pibImpl)
85 , m_pib(std::move(pibImpl))
87 BOOST_ASSERT(m_pib !=
nullptr);
88 m_certNames = m_pib->getCertificatesOfKey(keyName);
94 return {m_certNames.begin(), *
this};
106 return {m_certNames.find(certName), *
this};
112 return m_certNames.size();
120 "does not match key name"));
123 m_certNames.insert(certName);
124 m_certs[certName] = certificate;
125 m_pib->addCertificate(certificate);
132 NDN_THROW(std::invalid_argument(
"Certificate name `" + certName.
toUri() +
"` "
133 "is invalid or does not match key name"));
136 m_certNames.erase(certName);
137 m_certs.erase(certName);
138 m_pib->removeCertificate(certName);
144 auto it = m_certs.find(certName);
146 if (it != m_certs.end())
150 NDN_THROW(std::invalid_argument(
"Certificate name `" + certName.
toUri() +
"` "
151 "is invalid or does not match key name"));
154 m_certs[certName] = m_pib->getCertificate(certName);
155 return m_certs[certName];
161 return m_certNames == m_pib->getCertificatesOfKey(m_keyName);
const Name & getName() const noexcept
Get name.
Represents an absolute name.
void toUri(std::ostream &os, name::UriFormat format=name::UriFormat::DEFAULT) const
Write URI representation of the name to the output stream.
const_iterator & operator++()
bool operator==(const const_iterator &other) const
bool operator!=(const const_iterator &other) const
Container of certificates of a key.
const_iterator find(const Name &certName) const
const_iterator begin() const
Certificate get(const Name &certName) const
Get a certificate with certName from the container.
void remove(const Name &certName)
Remove a certificate with certName from the container.
bool isConsistent() const
Check if the container is consistent with the backend storage.
void add(const Certificate &certificate)
Add certificate into the container.
const_iterator end() const
Represents an NDN certificate following the version 2.0 format.
Name getKeyName() const
Get key name.
#define NDN_CXX_ASSERT_FORWARD_ITERATOR(T)
assert T is a forward iterator
Name extractKeyNameFromCertName(const Name &certName)
Extract key name from the certificate name certName.