32 Pib::Pib(
const std::string& locator, shared_ptr<PibImpl> impl)
34 , m_impl(std::move(impl))
35 , m_identities(m_impl)
37 BOOST_ASSERT(m_impl !=
nullptr);
40 Pib::~Pib() =
default;
43 Pib::getTpmLocator()
const
45 return m_impl->getTpmLocator();
49 Pib::setTpmLocator(
const std::string& tpmLocator)
51 if (tpmLocator == m_impl->getTpmLocator()) {
57 m_impl->setTpmLocator(tpmLocator);
63 m_impl->setTpmLocator(
"");
64 m_impl->clearIdentities();
65 m_defaultIdentity = {};
70 Pib::addIdentity(
const Name& identityName)
72 BOOST_ASSERT(m_identities.isConsistent());
73 return m_identities.add(identityName);
77 Pib::removeIdentity(
const Name& identityName)
79 BOOST_ASSERT(m_identities.isConsistent());
81 if (m_defaultIdentity && m_defaultIdentity.getName() == identityName) {
83 m_defaultIdentity = {};
85 m_identities.remove(identityName);
89 Pib::getIdentity(
const Name& identity)
const
91 BOOST_ASSERT(m_identities.isConsistent());
92 return m_identities.get(identity);
96 Pib::getIdentities()
const
98 BOOST_ASSERT(m_identities.isConsistent());
103 Pib::setDefaultIdentity(
const Name& identityName)
105 BOOST_ASSERT(m_identities.isConsistent());
107 m_defaultIdentity = m_identities.add(identityName);
108 m_impl->setDefaultIdentity(identityName);
111 BOOST_ASSERT(m_defaultIdentity);
112 return m_defaultIdentity;
116 Pib::getDefaultIdentity()
const
118 BOOST_ASSERT(m_identities.isConsistent());
120 if (!m_defaultIdentity) {
121 m_defaultIdentity = m_identities.get(m_impl->getDefaultIdentity());
122 NDN_LOG_DEBUG(
"Caching default identity " << m_defaultIdentity.getName());
125 BOOST_ASSERT(m_defaultIdentity);
126 BOOST_ASSERT(m_defaultIdentity.getName() == m_impl->getDefaultIdentity());
127 return m_defaultIdentity;
Represents an absolute name.
Container of identities of a PIB.
Frontend handle for an identity in the PIB.
#define NDN_LOG_DEBUG(expression)
Log at DEBUG level.
#define NDN_LOG_INIT(name)
Define a non-member log module.