94 Name(
const char* uri);
100 Name(std::string uri);
115 return m_wire.hasWire();
120 template<encoding::Tag TAG>
148 return m_wire.elements().empty();
156 return m_wire.elements_size();
169 return reinterpret_cast<const Component&
>(m_wire.elements()[i]);
200 getSubName(ssize_t iStartComponent,
size_t nComponents =
npos)
const;
224 return reinterpret_cast<const_iterator>(m_wire.elements().data());
232 return reinterpret_cast<const_iterator>(m_wire.elements().data() + m_wire.elements().size());
292 template<
class Iterator>
296 static_assert(
sizeof(std::iterator_traits<Iterator>::value_type) == 1,
297 "iterator does not dereference to one-octet value type");
531 compare(
size_t pos1,
size_t count1,
532 const Name& other,
size_t pos2 = 0,
size_t count2 =
npos)
const;
540 mutable Block m_wire;
606 #endif // NDN_NAME_HPP static Component fromNumber(uint64_t number)
Create a component encoded as nonNegativeInteger.
static Component fromSequenceNumber(uint64_t seqNo)
Create sequence number component using NDN naming conventions.
Copyright (c) 2011-2015 Regents of the University of California.
Name & appendTimestamp()
Append a timestamp component based on current time.
const_iterator begin() const
Begin iterator.
static Component fromNumberWithMarker(uint8_t marker, uint64_t number)
Create a component encoded as NameComponentWithMarker.
Name & appendTimestamp(const time::system_clock::TimePoint &timePoint)
Append a timestamp component.
Name getSuccessor() const
Get the successor of a name.
Name & append(const char *value)
Append a component, copying from a zero-terminated byte string.
std::reverse_iterator< iterator > reverse_iterator
std::ostream & operator<<(std::ostream &os, const Data &data)
Name & appendVersion(uint64_t version)
Append a version component.
static Component fromTimestamp(const time::system_clock::TimePoint &timePoint)
Create sequence number component using NDN naming conventions.
static const size_t npos
indicates "until the end" in getSubName and compare
Represents a TLV element of NDN packet format.
bool operator<=(const Delegation &lhs, const Delegation &rhs)
bool operator!=(const Data &lhs, const Data &rhs)
Name & appendNumber(uint64_t number)
Append a component with a nonNegativeInteger.
Name & append(const Component &component)
Append a component.
static Component fromSegmentOffset(uint64_t offset)
Create segment offset component using NDN naming conventions.
const Component & operator[](ssize_t i) const
Equivalent to get(i)
std::reverse_iterator< const_iterator > const_reverse_iterator
static Component fromSegment(uint64_t segmentNo)
Create segment number component using NDN naming conventions.
std::string toUri() const
Get URI representation of the name.
const Block & wireEncode() const
Perform wire encoding, or return existing wire encoding.
const_iterator end() const
End iterator.
bool equals(const Name &other) const
Check if this name equals another name.
const_reverse_iterator rend() const
Reverse end iterator.
Name & appendSegmentOffset(uint64_t offset)
Append a segment byte offset component.
bool hasWire() const
Check if this Name instance already has wire encoding.
Name & append(const Block &value)
Append a component, decoding from a Block.
component_container::size_type size_type
name::Component Component
size_t size() const
Get number of components.
Name & appendSequenceNumber(uint64_t seqNo)
Append a sequence number component.
std::istream & operator>>(std::istream &is, Name &name)
Parse URI from stream as Name.
Represents an absolute name.
bool isPrefixOf(const Name &other) const
Check if this name is a prefix of another name.
Name & append(Iterator first, Iterator last)
Append a component, copying from [first, last)
Error(const std::string &what)
const Component & at(ssize_t i) const
Get the component at the given index.
void push_back(const T &component)
Append a component.
const_reverse_iterator rbegin() const
Reverse begin iterator.
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(Exclude)
uint32_t type() const
Get TLV-TYPE.
bool operator>(const Delegation &lhs, const Delegation &rhs)
Component holds a read-only name component value.
static Component fromImplicitSha256Digest(const ConstBufferPtr &digest)
Create ImplicitSha256DigestComponent component.
int compare(const Name &other) const
Compare this to the other Name using NDN canonical ordering.
bool operator>=(const Delegation &lhs, const Delegation &rhs)
Name deepCopy() const
Make a deep copy of the name, reallocating the underlying memory buffer.
Name & append(const uint8_t *value, size_t valueLength)
Append a component, copying from [value, value + valueLength)
bool empty() const
Check if name is empty.
PartialName getSubName(ssize_t iStartComponent, size_t nComponents=npos) const
Extract some components as a sub-name (PartialName)
PartialName getPrefix(ssize_t nComponents) const
Extract a prefix of the name.
bool operator==(const Data &lhs, const Data &rhs)
Name & appendImplicitSha256Digest(const uint8_t *digest, size_t digestSize)
Append an ImplicitSha256Digest component.
static Component fromVersion(uint64_t version)
Create version component using NDN naming conventions.
component_container::difference_type difference_type
Name & appendNumberWithMarker(uint8_t marker, uint64_t number)
Append a component with a marked number.
void wireDecode(const Block &wire)
Decode name from wire encoding.
std::vector< Component > component_container
void clear()
Remove all components.
bool operator<(const Delegation &lhs, const Delegation &rhs)
Name & appendSegment(uint64_t segmentNo)
Append a segment number (sequential) component.
Name & appendImplicitSha256Digest(const ConstBufferPtr &digest)
Append an ImplicitSha256Digest component.
Name & appendVersion()
Append a version component based on current time.
Name()
Create an empty name.
Error that can be thrown from name::Component.
shared_ptr< const Buffer > ConstBufferPtr