Represents an absolute name. More...
#include <name.hpp>
Public Types | |
using | Error = name::Component::Error |
using | Component = name::Component |
using | component_container = std::vector< Component > |
using | value_type = Component |
using | allocator_type = void |
using | reference = Component & |
using | const_reference = const Component & |
using | pointer = Component * |
using | const_pointer = const Component * |
using | iterator = const Component * |
using | const_iterator = const Component * |
using | reverse_iterator = std::reverse_iterator< iterator > |
using | const_reverse_iterator = std::reverse_iterator< const_iterator > |
using | difference_type = component_container::difference_type |
using | size_type = component_container::size_type |
Public Member Functions | |
Name () | |
Create an empty name. More... | |
Name (const Block &wire) | |
Decode Name from wire encoding. More... | |
Name (const char *uri) | |
Parse name from NDN URI. More... | |
Name (std::string uri) | |
Create name from NDN URI. More... | |
void | toUri (std::ostream &os, name::UriFormat format=name::UriFormat::DEFAULT) const |
Write URI representation of the name to the output stream. More... | |
std::string | toUri (name::UriFormat format=name::UriFormat::DEFAULT) const |
Get URI representation of the name. More... | |
bool | hasWire () const noexcept |
Check if this instance already has wire encoding. More... | |
template<encoding::Tag TAG> | |
size_t | wireEncode (EncodingImpl< TAG > &encoder) const |
Fast encoding or block size estimation. More... | |
const Block & | wireEncode () const |
Perform wire encoding, or return existing wire encoding. More... | |
void | wireDecode (const Block &wire) |
Decode name from wire encoding. More... | |
Name | deepCopy () const |
Make a deep copy of the name, reallocating the underlying memory buffer. More... | |
NDN_CXX_NODISCARD bool | empty () const |
Checks if the name is empty, i.e. More... | |
size_t | size () const |
Returns the number of components. More... | |
const Component & | get (ssize_t i) const |
Returns an immutable reference to the component at the specified index. More... | |
const Component & | operator[] (ssize_t i) const |
Equivalent to get(i) . More... | |
const Component & | at (ssize_t i) const |
Returns an immutable reference to the component at the specified index, with bounds checking. More... | |
PartialName | getSubName (ssize_t iStartComponent, size_t nComponents=npos) const |
Extracts some components as a sub-name (PartialName). More... | |
PartialName | getPrefix (ssize_t nComponents) const |
Returns a prefix of the name. More... | |
const_iterator | begin () const |
Begin iterator. More... | |
const_iterator | end () const |
End iterator. More... | |
const_reverse_iterator | rbegin () const |
Reverse begin iterator. More... | |
const_reverse_iterator | rend () const |
Reverse end iterator. More... | |
Name & | set (ssize_t i, const Component &component) |
Replace the component at the specified index. More... | |
Name & | set (ssize_t i, Component &&component) |
Replace the component at the specified index. More... | |
Name & | append (const Component &component) |
Append a component. More... | |
Name & | append (Component &&component) |
Append a component. More... | |
Name & | append (uint32_t type, span< const uint8_t > value) |
Append a NameComponent of TLV-TYPE type , copying the TLV-VALUE from value . More... | |
Name & | append (span< const uint8_t > value) |
Append a GenericNameComponent, copying the TLV-VALUE from value . More... | |
Name & | append (uint32_t type, const uint8_t *value, size_t count) |
Append a NameComponent of TLV-TYPE type , copying count bytes at value as TLV-VALUE. More... | |
Name & | append (const uint8_t *value, size_t count) |
Append a GenericNameComponent, copying count bytes at value as TLV-VALUE. More... | |
template<class Iterator > | |
Name & | append (uint32_t type, Iterator first, Iterator last) |
Append a NameComponent of TLV-TYPE type , copying TLV-VALUE from a range. More... | |
template<class Iterator > | |
Name & | append (Iterator first, Iterator last) |
Append a GenericNameComponent, copying TLV-VALUE from a range. More... | |
Name & | append (const char *str) |
Append a GenericNameComponent, copying TLV-VALUE from a null-terminated string. More... | |
Name & | append (const PartialName &name) |
Append a PartialName. More... | |
Name & | appendNumber (uint64_t number) |
Append a component with a NonNegativeInteger. More... | |
Name & | appendNumberWithMarker (uint8_t marker, uint64_t number) |
Append a component with a marked number. More... | |
Name & | appendSegment (uint64_t segmentNo) |
Append a segment number (sequential) component. More... | |
Name & | appendByteOffset (uint64_t offset) |
Append a byte offset component. More... | |
Name & | appendVersion (const optional< uint64_t > &version=nullopt) |
Append a version component. More... | |
Name & | appendTimestamp (const optional< time::system_clock::time_point > ×tamp=nullopt) |
Append a timestamp component. More... | |
Name & | appendSequenceNumber (uint64_t seqNo) |
Append a sequence number component. More... | |
Name & | appendImplicitSha256Digest (ConstBufferPtr digest) |
Append an ImplicitSha256Digest component. More... | |
Name & | appendImplicitSha256Digest (span< const uint8_t > digestBytes) |
Append an ImplicitSha256Digest component. More... | |
Name & | appendParametersSha256Digest (ConstBufferPtr digest) |
Append a ParametersSha256Digest component. More... | |
Name & | appendParametersSha256Digest (span< const uint8_t > digestBytes) |
Append a ParametersSha256Digest component. More... | |
Name & | appendParametersSha256DigestPlaceholder () |
Append a placeholder for a ParametersSha256Digest component. More... | |
Name & | appendKeyword (span< const uint8_t > keyword) |
Append a keyword component. More... | |
Name & | appendKeyword (const char *keyword) |
Append a keyword component. More... | |
template<class T > | |
void | push_back (const T &component) |
Append a component. More... | |
void | erase (ssize_t i) |
Erase the component at the specified index. More... | |
void | clear () |
Remove all components. More... | |
Name | getSuccessor () const |
Get the successor of a name. More... | |
bool | isPrefixOf (const Name &other) const |
Check if this name is a prefix of another name. More... | |
bool | equals (const Name &other) const |
Check if this name equals another name. More... | |
int | compare (const Name &other) const |
Compare this to the other Name using NDN canonical ordering. More... | |
int | compare (size_t pos1, size_t count1, const Name &other, size_t pos2=0, size_t count2=npos) const |
compares [pos1, pos1+count1) components in this Name to [pos2, pos2+count2) components in other More... | |
Static Public Attributes | |
static const size_t | npos = std::numeric_limits<size_t>::max() |
Indicates "until the end" in getSubName() and compare(). More... | |
Friends | |
bool | operator== (const Name &lhs, const Name &rhs) |
bool | operator!= (const Name &lhs, const Name &rhs) |
bool | operator< (const Name &lhs, const Name &rhs) |
bool | operator<= (const Name &lhs, const Name &rhs) |
bool | operator> (const Name &lhs, const Name &rhs) |
bool | operator>= (const Name &lhs, const Name &rhs) |
std::ostream & | operator<< (std::ostream &os, const Name &name) |
Print the URI representation of a name. More... | |
Represents an absolute name.
using ndn::Name::Component = name::Component |
using ndn::Name::component_container = std::vector<Component> |
using ndn::Name::value_type = Component |
using ndn::Name::allocator_type = void |
using ndn::Name::reference = Component& |
using ndn::Name::const_reference = const Component& |
using ndn::Name::pointer = Component* |
using ndn::Name::const_pointer = const Component* |
using ndn::Name::iterator = const Component* |
using ndn::Name::const_iterator = const Component* |
using ndn::Name::reverse_iterator = std::reverse_iterator<iterator> |
using ndn::Name::const_reverse_iterator = std::reverse_iterator<const_iterator> |
using ndn::Name::difference_type = component_container::difference_type |
using ndn::Name::size_type = component_container::size_type |
ndn::Name::Name | ( | ) |
Create an empty name.
Definition at line 54 of file name.cpp.
Referenced by ndn::operator>>().
|
explicit |
Decode Name from wire encoding.
tlv::Error | wire encoding is invalid |
This is a more efficient equivalent for
Definition at line 59 of file name.cpp.
References ndn::Block::parse().
ndn::Name::Name | ( | const char * | uri | ) |
Parse name from NDN URI.
uri | a null-terminated URI string |
ndn::Name::Name | ( | std::string | uri | ) |
Create name from NDN URI.
uri | a URI string |
Definition at line 70 of file name.cpp.
References append(), and ndn::name::Component::fromEscapedString().
void ndn::Name::toUri | ( | std::ostream & | os, |
name::UriFormat | format = name::UriFormat::DEFAULT |
||
) | const |
Write URI representation of the name to the output stream.
Definition at line 349 of file name.cpp.
References empty().
Referenced by ndn::security::pib::KeyContainer::add(), ndn::security::v2::KeyChain::addCertificate(), ndn::security::v2::ValidationPolicySimpleHierarchy::checkPolicy(), ndn::security::v2::validator_config::ValidationPolicyConfig::checkPolicy(), ndn::security::v2::ValidationPolicyCommandInterest::checkPolicy(), ndn::security::tpm::BackEnd::createKey(), ndn::security::v2::CertificateFetcherFromNetwork::dataCallback(), ndn::security::v2::KeyChain::deleteCertificate(), ndn::security::v2::KeyChain::deleteKey(), ndn::security::tpm::BackEndOsx::derivePublicKey(), nfd::RibManager::enableLocalFields(), nfd::TablesConfigSection::ensureConfigured(), ndn::security::tpm::BackEnd::exportKey(), ndn::security::v2::KeyChain::exportSafeBag(), ndn::security::v2::extractIdentityFromCertName(), ndn::security::v2::extractIdentityFromKeyName(), ndn::security::v2::extractIdentityNameFromKeyLocator(), ndn::security::v2::extractKeyNameFromCertName(), ndn::security::pib::CertificateContainer::get(), ndn::security::pib::KeyContainer::get(), ndn::security::pib::PibMemory::getCertificate(), ndn::security::pib::PibSqlite3::getCertificate(), ndn::security::pib::PibMemory::getDefaultCertificateOfKey(), ndn::security::pib::PibSqlite3::getDefaultCertificateOfKey(), ndn::security::pib::PibMemory::getDefaultKeyOfIdentity(), ndn::security::pib::PibSqlite3::getDefaultKeyOfIdentity(), ndn::security::pib::PibMemory::getKeyBits(), ndn::security::pib::PibSqlite3::getKeyBits(), ndn::security::tpm::getKeyRef(), ndn::security::pib::detail::IdentityImpl::IdentityImpl(), ndn::security::tpm::BackEnd::importKey(), ndn::security::v2::KeyChain::importPrivateKey(), ndn::security::v2::KeyChain::importSafeBag(), ndn::MetadataObject::makeData(), ndn::MetadataObject::MetadataObject(), ndn::security::v2::parseLocatorUri(), ndn::security::pib::CertificateContainer::remove(), ndn::security::pib::KeyContainer::remove(), ndn::security::pib::PibMemory::setDefaultCertificateOfKey(), ndn::security::pib::PibSqlite3::setDefaultCertificateOfKey(), ndn::security::pib::PibMemory::setDefaultIdentity(), ndn::security::pib::PibSqlite3::setDefaultIdentity(), ndn::security::v2::KeyChain::setDefaultKey(), ndn::security::pib::PibMemory::setDefaultKeyOfIdentity(), ndn::security::pib::PibSqlite3::setDefaultKeyOfIdentity(), toUri(), ndn::security::v2::Validator::validate(), ndn::security::v2::DataValidationState::~DataValidationState(), and ndn::security::v2::InterestValidationState::~InterestValidationState().
std::string ndn::Name::toUri | ( | name::UriFormat | format = name::UriFormat::DEFAULT | ) | const |
|
inlinenoexcept |
Check if this instance already has wire encoding.
Definition at line 110 of file name.hpp.
References deepCopy(), ndn::Block::hasWire(), NDN_CXX_NODISCARD, wireDecode(), and wireEncode().
size_t ndn::Name::wireEncode | ( | EncodingImpl< TAG > & | encoder | ) | const |
Fast encoding or block size estimation.
Definition at line 117 of file name.cpp.
References ndn::tlv::Name, and ndn::NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS().
Referenced by nfd::DeadNonceList::add(), ndn::security::pib::PibSqlite3::addIdentity(), ndn::security::pib::PibSqlite3::addKey(), nfd::name_tree::computeHash(), nfd::name_tree::computeHashes(), deepCopy(), ndn::security::pib::PibSqlite3::getCertificate(), ndn::security::pib::PibSqlite3::getCertificatesOfKey(), ndn::security::pib::PibSqlite3::getDefaultCertificateOfKey(), ndn::security::pib::PibSqlite3::getDefaultKeyOfIdentity(), ndn::security::pib::PibSqlite3::getKeyBits(), ndn::security::pib::PibSqlite3::getKeysOfIdentity(), ndn::security::pib::PibSqlite3::hasCertificate(), ndn::security::pib::PibSqlite3::hasIdentity(), ndn::security::pib::PibSqlite3::hasKey(), ndn::MetadataObject::makeData(), std::hash< ndn::Name >::operator()(), ndn::security::parse(), ndn::security::pib::PibSqlite3::removeCertificate(), ndn::security::pib::PibSqlite3::removeIdentity(), ndn::security::pib::PibSqlite3::removeKey(), ndn::security::pib::PibSqlite3::setDefaultCertificateOfKey(), ndn::security::pib::PibSqlite3::setDefaultIdentity(), ndn::security::pib::PibSqlite3::setDefaultKeyOfIdentity(), ndn::security::v2::KeyChain::sign(), ndn::security::tpm::BackEndFile::Impl::toFileName(), ndn::nfd::StrategyChoice::wireEncode(), ndn::Data::wireEncode(), ndn::nfd::ControlParameters::wireEncode(), and ndn::Interest::wireEncode().
const Block & ndn::Name::wireEncode | ( | ) | const |
Perform wire encoding, or return existing wire encoding.
Definition at line 132 of file name.cpp.
References ndn::Block::hasWire(), and ndn::Block::parse().
Referenced by hasWire().
void ndn::Name::wireDecode | ( | const Block & | wire | ) |
Decode name from wire encoding.
tlv::Error | wire encoding is invalid |
Definition at line 150 of file name.cpp.
References ndn::tlv::Name, NDN_THROW, ndn::Block::parse(), and ndn::Block::type().
Referenced by hasWire(), ndn::MetadataObject::MetadataObject(), ndn::nfd::StrategyChoice::wireDecode(), ndn::nfd::ControlParameters::wireDecode(), and ndn::Data::wireDecode().
Name ndn::Name::deepCopy | ( | ) | const |
Make a deep copy of the name, reallocating the underlying memory buffer.
Definition at line 160 of file name.cpp.
References ndn::Block::resetWire(), and wireEncode().
Referenced by hasWire().
|
inline |
Checks if the name is empty, i.e.
has no components.
Definition at line 143 of file name.hpp.
References ndn::Block::elements().
Referenced by nfd::fw::AccessStrategy::beforeSatisfyInterest(), nfd::cs::compareQueryWithData(), ndn::security::v2::CertificateBundleFetcher::doFetch(), ndn::Interest::extractSignedRanges(), ndn::Data::getFullName(), nfd::measurements::Measurements::getParent(), getSuccessor(), ndn::Interest::isSigned(), nfd::name_tree::NameTree::lookup(), ndn::MetadataObject::makeData(), toUri(), ndn::nfd::StrategyChoiceUnsetCommand::validateRequest(), and ndn::Interest::wireDecode().
|
inline |
Returns the number of components.
Definition at line 151 of file name.hpp.
References ndn::Block::elements_size().
Referenced by ndn::mgmt::Dispatcher::addStatusDataset(), at(), ndn::security::v2::validator_config::Checker::check(), ndn::security::v2::validator_config::checkNameRelation(), ndn::security::v2::validator_config::ValidationPolicyConfig::checkPolicy(), ndn::security::v2::ValidationPolicyCommandInterest::checkPolicy(), compare(), nfd::cs::compareQueryWithData(), nfd::name_tree::computeHash(), nfd::name_tree::computeHashes(), ndn::InterestFilter::doesMatch(), ndn::security::v2::CertificateBundleFetcher::doFetch(), nfd::RibManager::enableLocalFields(), nfd::name_tree::Entry::Entry(), equals(), nfd::strategy_choice::StrategyChoice::erase(), ndn::security::v2::extractIdentityNameFromKeyLocator(), nfd::FibManager::FibManager(), ndn::security::v2::CertificateCache::find(), nfd::name_tree::NameTree::findExactMatch(), nfd::name_tree::NameTree::findLongestPrefixMatch(), nfd::rib::Rib::findParent(), nfd::measurements::Measurements::get(), get(), nfd::fw::asf::AsfMeasurements::getOrCreateNamespaceInfo(), getPrefix(), getSubName(), nfd::cs::Cs::insert(), nfd::strategy_choice::StrategyChoice::insert(), ndn::Interest::isParametersDigestValid(), isPrefixOf(), ndn::security::v2::isValidKeyName(), ndn::MetadataObject::isValidName(), ndn::security::v2::Certificate::isValidName(), nfd::name_tree::NameTree::lookup(), nfd::CommandAuthenticator::makeAuthorization(), ndn::RegexTopMatcher::match(), ndn::security::v2::validator_config::Filter::match(), ndn::Interest::matchesData(), nfd::Forwarder::onNewNextHop(), ndn::nfd::operator==(), ndn::security::parse(), nfd::fw::Strategy::parseInstanceName(), nfd::pit::Pit::Pit(), ndn::PrefixAnnouncement::PrefixAnnouncement(), ndn::mgmt::Dispatcher::removeTopPrefix(), and set().
|
inline |
Returns an immutable reference to the component at the specified index.
i | zero-based index of the component to return; if negative, it is interpreted as offset from the end of the name |
Definition at line 162 of file name.hpp.
References ndn::Block::elements(), and size().
Referenced by compare(), ndn::security::v2::CertificateBundleFetcher::doFetch(), equals(), isPrefixOf(), ndn::security::v2::isValidKeyName(), ndn::RegexRepeatMatcher::match(), ndn::RegexComponentSetMatcher::match(), ndn::RegexComponentMatcher::match(), ndn::RegexMatcher::match(), ndn::Interest::matchesData(), ndn::mgmt::Dispatcher::removeTopPrefix(), ndn::util::NotificationSubscriberBase::stop(), and ndn::util::SegmentFetcher::stop().
|
inline |
Equivalent to get(i)
.
Definition at line 173 of file name.hpp.
References at(), getSubName(), and npos.
const name::Component & ndn::Name::at | ( | ssize_t | i | ) | const |
Returns an immutable reference to the component at the specified index, with bounds checking.
i | zero-based index of the component to return; if negative, it is interpreted as offset from the end of the name |
Error | The index is out of bounds. |
Definition at line 171 of file name.cpp.
References ndn::Block::elements(), NDN_THROW, size(), nonstd::span_lite::ssize(), and ndn::to_string().
Referenced by ndn::security::v2::validator_config::ValidationPolicyConfig::checkPolicy(), ndn::security::v2::ValidationPolicyCommandInterest::checkPolicy(), ndn::net::computePrefixLength(), ndn::security::v2::CertificateBundleFetcher::doFetch(), ndn::security::v2::Certificate::getIssuerId(), ndn::security::v2::Certificate::getKeyId(), getSubName(), nfd::fw::Strategy::makeInstanceName(), operator[](), nfd::ManagerBase::registerNotificationStream(), and ndn::mgmt::StatusDatasetContext::setPrefix().
PartialName ndn::Name::getSubName | ( | ssize_t | iStartComponent, |
size_t | nComponents = npos |
||
) | const |
Extracts some components as a sub-name (PartialName).
iStartComponent | zero-based index of the first component; if negative, size()+iStartComponent is used instead |
nComponents | number of desired components, starting at iStartComponent ; use npos to return all components until the end of the name |
If iStartComponent
is positive and indexes out of bounds, returns an empty PartialName. If iStartComponent
is negative and indexes out of bounds, the sub-name will start from the beginning of the name instead. If nComponents
is out of bounds, returns all components until the end of the name.
Definition at line 185 of file name.cpp.
References append(), at(), npos, and size().
Referenced by getPrefix(), operator[](), and nfd::fw::Strategy::parseInstanceName().
|
inline |
Returns a prefix of the name.
nComponents | number of components; if negative, size()+nComponents is used instead |
Returns a new PartialName containing a prefix of this name up to size() - nComponents
. For example, getPrefix(-1)
returns the name without the final component.
Definition at line 209 of file name.hpp.
References getSubName(), and size().
Referenced by nfd::fw::AccessStrategy::beforeSatisfyInterest(), ndn::security::v2::validator_config::Checker::check(), ndn::security::v2::CertificateBundleFetcher::doFetch(), nfd::strategy_choice::StrategyChoice::erase(), ndn::security::v2::extractIdentityFromCertName(), ndn::security::v2::extractIdentityFromKeyName(), ndn::security::v2::extractIdentityNameFromKeyLocator(), ndn::security::v2::extractKeyNameFromCertName(), nfd::measurements::Measurements::findLongestPrefixMatch(), nfd::rib::Rib::findParent(), ndn::security::v2::Certificate::getIdentity(), ndn::security::v2::Certificate::getKeyName(), nfd::fw::asf::AsfMeasurements::getOrCreateNamespaceInfo(), getSuccessor(), nfd::rib::HostToGatewayReadvertisePolicy::handleNewRoute(), ndn::security::v2::validator_config::Filter::match(), nfd::fw::Strategy::parseInstanceName(), ndn::PrefixAnnouncement::PrefixAnnouncement(), nfd::name_tree::Entry::setParent(), ndn::util::SegmentFetcher::stop(), and nfd::name_tree::Hashtable::~Hashtable().
|
inline |
Begin iterator.
Definition at line 221 of file name.hpp.
References ndn::Block::elements().
Referenced by rend().
|
inline |
End iterator.
Definition at line 229 of file name.hpp.
References ndn::Block::elements().
Referenced by rbegin().
|
inline |
Reverse begin iterator.
Definition at line 237 of file name.hpp.
References end().
Referenced by nfd::fw::Strategy::makeInstanceName().
|
inline |
Reverse end iterator.
Definition at line 245 of file name.hpp.
References begin().
Referenced by nfd::fw::Strategy::makeInstanceName().
Replace the component at the specified index.
i | zero-based index of the component to replace; if negative, it is interpreted as offset from the end of the name |
component | the new component to use as a replacement |
Definition at line 206 of file name.cpp.
References ndn::Block::elements(), ndn::Block::resetWire(), and size().
Replace the component at the specified index.
i | zero-based index of the component to replace; if negative, it is interpreted as offset from the end of the name |
component | the new component to use as a replacement |
Definition at line 218 of file name.cpp.
References ndn::Block::elements(), nonstd::optional_lite::std11::move(), ndn::Block::resetWire(), and size().
Append a component.
Definition at line 275 of file name.hpp.
References ndn::Block::push_back().
Referenced by ndn::mgmt::Dispatcher::addNotificationStream(), append(), appendByteOffset(), appendImplicitSha256Digest(), appendKeyword(), appendNumber(), appendNumberWithMarker(), appendParametersSha256Digest(), appendParametersSha256DigestPlaceholder(), appendSegment(), appendSequenceNumber(), appendTimestamp(), appendVersion(), ndn::security::v2::constructKeyName(), ndn::security::v2::CertificateBundleFetcher::doFetch(), ndn::RegexTopMatcher::expand(), ndn::nfd::FaceQueryDataset::FaceQueryDataset(), ndn::nfd::StatusDataset::getDatasetPrefix(), getSubName(), getSuccessor(), ndn::security::InterestSigner::makeCommandInterest(), ndn::MetadataObject::makeDiscoveryInterest(), nfd::ManagerBase::makeRelPrefix(), Name(), ndn::security::v2::parseLocatorUri(), push_back(), ndn::security::SigningInfo::setSigningHmacKey(), ndn::security::v2::KeyChain::sign(), and ndn::PrefixAnnouncement::toData().
Append a component.
Definition at line 285 of file name.hpp.
References nonstd::optional_lite::std11::move(), and ndn::Block::push_back().
|
inline |
|
inline |
Append a GenericNameComponent, copying the TLV-VALUE from value
.
Definition at line 306 of file name.hpp.
References append(), and ndn::tlv::GenericNameComponent.
|
inline |
|
inline |
|
inline |
Append a NameComponent of TLV-TYPE type
, copying TLV-VALUE from a range.
Iterator | an InputIterator dereferencing to a one-octet value type. More efficient implementation is available when it is a RandomAccessIterator . |
type | the TLV-TYPE. |
first | beginning of the range. |
last | past-end of the range. |
Definition at line 345 of file name.hpp.
References append().
|
inline |
Append a GenericNameComponent, copying TLV-VALUE from a range.
Iterator | an InputIterator dereferencing to a one-octet value type. More efficient implementation is available when it is a RandomAccessIterator . |
first | beginning of the range. |
last | past-end of the range. |
Definition at line 359 of file name.hpp.
References append(), and ndn::tlv::GenericNameComponent.
|
inline |
Append a GenericNameComponent, copying TLV-VALUE from a null-terminated string.
str | a null-terminated string. Bytes from the string are copied as is, and not interpreted as URI component. |
Definition at line 370 of file name.hpp.
References append().
Name & ndn::Name::append | ( | const PartialName & | name | ) |
|
inline |
Append a component with a NonNegativeInteger.
Definition at line 387 of file name.hpp.
References append(), and ndn::name::Component::fromNumber().
Referenced by ndn::security::v2::CertificateBundleFetcher::doFetch().
|
inline |
Append a component with a marked number.
marker | 1-octet marker |
number | the number |
The component is encoded as a 1-octet marker, followed by a NonNegativeInteger.
Definition at line 403 of file name.hpp.
References append(), and ndn::name::Component::fromNumberWithMarker().
|
inline |
Append a segment number (sequential) component.
Definition at line 415 of file name.hpp.
References append(), and ndn::name::Component::fromSegment().
Referenced by ndn::MetadataObject::makeData(), and ndn::PrefixAnnouncement::toData().
|
inline |
Append a byte offset component.
Definition at line 427 of file name.hpp.
References append(), appendTimestamp(), appendVersion(), ndn::name::Component::fromByteOffset(), nonstd::optional_lite::nullopt, and websocketpp::http::parser::state::version.
Name & ndn::Name::appendVersion | ( | const optional< uint64_t > & | version = nullopt | ) |
Append a version component.
version | the version number to append; if nullopt, the current UNIX time in milliseconds is used |
Definition at line 230 of file name.cpp.
References append(), ndn::name::Component::fromVersion(), ndn::time::system_clock::now(), and ndn::time::toUnixTimestamp().
Referenced by appendByteOffset(), ndn::MetadataObject::makeData(), ndn::security::v2::parseLocatorUri(), ndn::mgmt::StatusDatasetContext::setPrefix(), and ndn::PrefixAnnouncement::toData().
Name & ndn::Name::appendTimestamp | ( | const optional< time::system_clock::time_point > & | timestamp = nullopt | ) |
Append a timestamp component.
timestamp | the timestamp to append; if nullopt, the current system time is used |
Definition at line 236 of file name.cpp.
References append(), ndn::name::Component::fromTimestamp(), and ndn::time::system_clock::now().
Referenced by appendByteOffset().
|
inline |
Append a sequence number component.
Definition at line 460 of file name.hpp.
References append(), and ndn::name::Component::fromSequenceNumber().
Referenced by ndn::mgmt::Dispatcher::addNotificationStream(), ndn::util::NotificationStream< Notification >::postNotification(), and ndn::util::NotificationSubscriberBase::stop().
|
inline |
Append an ImplicitSha256Digest component.
Definition at line 470 of file name.hpp.
References append(), ndn::tlv::ImplicitSha256DigestComponent, and nonstd::optional_lite::std11::move().
Referenced by ndn::Data::getFullName().
|
inline |
Append an ImplicitSha256Digest component.
Definition at line 480 of file name.hpp.
References append(), and ndn::tlv::ImplicitSha256DigestComponent.
|
inline |
Append a ParametersSha256Digest component.
Definition at line 490 of file name.hpp.
References append(), nonstd::optional_lite::std11::move(), and ndn::tlv::ParametersSha256DigestComponent.
|
inline |
Append a ParametersSha256Digest component.
Definition at line 500 of file name.hpp.
References append(), appendParametersSha256DigestPlaceholder(), and ndn::tlv::ParametersSha256DigestComponent.
Name & ndn::Name::appendParametersSha256DigestPlaceholder | ( | ) |
Append a placeholder for a ParametersSha256Digest component.
Definition at line 263 of file name.cpp.
References append(), and ndn::tlv::ParametersSha256DigestComponent.
Referenced by appendParametersSha256Digest().
|
inline |
Append a keyword component.
Definition at line 517 of file name.hpp.
References append(), and ndn::tlv::KeywordNameComponent.
|
inline |
Append a keyword component.
Definition at line 527 of file name.hpp.
References append(), and ndn::tlv::KeywordNameComponent.
|
inline |
Append a component.
std::vector
. Definition at line 539 of file name.hpp.
References append(), clear(), equals(), erase(), getSuccessor(), and isPrefixOf().
Referenced by nfd::name_tree::computeHashes().
void ndn::Name::erase | ( | ssize_t | i | ) |
Erase the component at the specified index.
i | zero-based index of the component to erase; if negative, it is interpreted as offset from the end of the name |
Definition at line 270 of file name.cpp.
References ndn::Block::elements_begin(), ndn::Block::elements_end(), and ndn::Block::erase().
Referenced by push_back(), and ndn::Interest::unsetApplicationParameters().
void ndn::Name::clear | ( | ) |
Remove all components.
empty() == true
Definition at line 281 of file name.cpp.
References ndn::tlv::Name.
Referenced by ndn::security::pib::PibMemory::clearIdentities(), push_back(), ndn::security::pib::PibMemory::removeIdentity(), ndn::Data::resetWire(), ndn::security::SigningInfo::setSha256Signing(), and ndn::Data::wireDecode().
Name ndn::Name::getSuccessor | ( | ) | const |
Get the successor of a name.
The successor of a name is defined as follows:
N represents the set of NDN Names, and X,Y ∈ N. Operator < is defined by canonical order on N. Y is the successor of X, if (a) X < Y, and (b) ∄ Z ∈ N s.t. X < Z < Y.
In plain words, successor of a name is the same name, but with its last component advanced to a next possible value.
Examples:
/
is /sha256digest=0000000000000000000000000000000000000000000000000000000000000000
./sha256digest=0000000000000000000000000000000000000000000000000000000000000000
is /sha256digest=0000000000000000000000000000000000000000000000000000000000000001
./sha256digest=ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
is /2=...
./P/A
is /P/B
./Q/FF
is /Q/%00%00
.Definition at line 289 of file name.cpp.
References append(), empty(), and getPrefix().
Referenced by nfd::cs::Cs::insert(), and push_back().
bool ndn::Name::isPrefixOf | ( | const Name & | other | ) | const |
Check if this name is a prefix of another name.
This name is a prefix of other
if the N components of this name are same as the first N components of other
.
true | this name is a prefix of other |
false | this name is not a prefix of other |
Definition at line 300 of file name.cpp.
Referenced by ndn::mgmt::Dispatcher::addTopPrefix(), nfd::fw::asf::FaceInfo::cancelTimeout(), ndn::security::v2::validator_config::checkNameRelation(), ndn::security::v2::ValidationPolicySimpleHierarchy::checkPolicy(), ndn::InterestFilter::doesMatch(), ndn::InMemoryStorage::erase(), ndn::security::v2::CertificateCache::find(), ndn::security::v2::TrustAnchorContainer::find(), ndn::InMemoryStorage::find(), nfd::rib::Rib::findParent(), nfd::Forwarder::Forwarder(), ndn::Interest::matchesData(), nfd::rib::NfdRibReadvertiseDestination::NfdRibReadvertiseDestination(), nfd::Forwarder::onIncomingData(), nfd::Forwarder::onOutgoingData(), push_back(), ndn::mgmt::Dispatcher::removeTopPrefix(), ndn::InMemoryStorage::selectChild(), ndn::mgmt::StatusDatasetContext::setPrefix(), and ndn::util::DummyClientFace::~DummyClientFace().
bool ndn::Name::equals | ( | const Name & | other | ) | const |
Check if this name equals another name.
Two names are equal if they have the same number of components, and components at each index are equal.
Definition at line 316 of file name.cpp.
Referenced by push_back().
|
inline |
Compare this to the other Name using NDN canonical ordering.
If the first components of each name are not equal, this returns a negative value if the first comes before the second using the NDN canonical ordering for name components, or a positive value if it comes after. If they are equal, this compares the second components of each name, etc. If both names are the same up to the size of the shorter name, this returns a negative value if the first name is shorter than the second or a positive value if it is longer. For example, if you std::sort gives: /a/b/d /a/b/cc /c /c/a /bb . This is intuitive because all names with the prefix /a are next to each other. But it may be also be counter-intuitive because /c comes before /bb according to NDN canonical ordering since it is shorter.
other | The other Name to compare with. |
negative | this comes before other in canonical ordering |
zero | this equals other |
positive | this comes after other in canonical ordering |
Definition at line 629 of file name.hpp.
References npos.
Referenced by compare(), nfd::cs::compareDataWithData(), nfd::cs::compareQueryWithData(), and nfd::name_tree::Hashtable::~Hashtable().
|
friend |
Print the URI representation of a name.
|
static |
Indicates "until the end" in getSubName() and compare().
Definition at line 696 of file name.hpp.
Referenced by nfd::pit::Entry::canMatch(), compare(), getSubName(), and operator[]().