ndn::Name Class Reference

Represents an absolute name. More...

#include <ndn-cxx/name.hpp>

+ Inheritance diagram for ndn::Name:
+ Collaboration diagram for ndn::Name:

Public Types

using allocator_type = void
 
using Component = name::Component
 
using const_iterator = const Component *
 
using const_pointer = const Component *
 
using const_reference = const Component &
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 
using difference_type = std::vector< Component >::difference_type
 
using Error = Component::Error
 
using iterator = const Component *
 
using pointer = Component *
 
using reference = Component &
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using size_type = std::vector< Component >::size_type
 
using value_type = Component
 

Public Member Functions

 Name ()
 Create an empty name. More...
 
 Name (const Block &wire)
 Create Name from wire encoding. More...
 
 Name (const char *uri)
 Create name from NDN URI. More...
 
 Name (const std::string &uri)
 Create name from NDN URI. More...
 
 Name (std::string_view uri)
 Create name from NDN URI. More...
 
Nameappend (Component &&component)
 Append a name component. More...
 
Nameappend (const char *str)
 Append a GenericNameComponent, copying the TLV-VALUE from a null-terminated string. More...
 
Nameappend (const Component &component)
 Append a name component. More...
 
Nameappend (const PartialName &name)
 Append a PartialName. More...
 
template<class Iterator >
Nameappend (Iterator first, Iterator last)
 Append a GenericNameComponent, copying the TLV-VALUE from a range. More...
 
Nameappend (span< const uint8_t > value)
 Append a GenericNameComponent, copying the TLV-VALUE from value. More...
 
template<class Iterator >
Nameappend (uint32_t type, Iterator first, Iterator last)
 Append a NameComponent of TLV-TYPE type, copying the TLV-VALUE from a range. More...
 
Nameappend (uint32_t type, span< const uint8_t > value)
 Append a NameComponent of TLV-TYPE type, copying the TLV-VALUE from value. More...
 
NameappendByteOffset (uint64_t offset)
 Append a byte offset component. More...
 
NameappendImplicitSha256Digest (ConstBufferPtr digest)
 Append an ImplicitSha256Digest component. More...
 
NameappendImplicitSha256Digest (span< const uint8_t > digestBytes)
 Append an ImplicitSha256Digest component. More...
 
NameappendKeyword (span< const uint8_t > keyword)
 Append a keyword component. More...
 
NameappendKeyword (std::string_view keyword)
 Append a keyword component. More...
 
NameappendNumber (uint64_t number)
 Append a component with a NonNegativeInteger. More...
 
NameappendNumberWithMarker (uint8_t marker, uint64_t number)
 Append a component with a marked number. More...
 
NameappendParametersSha256Digest (ConstBufferPtr digest)
 Append a ParametersSha256Digest component. More...
 
NameappendParametersSha256Digest (span< const uint8_t > digestBytes)
 Append a ParametersSha256Digest component. More...
 
NameappendParametersSha256DigestPlaceholder ()
 Append a placeholder for a ParametersSha256Digest component. More...
 
NameappendSegment (uint64_t segmentNo)
 Append a segment number (sequential) component. More...
 
NameappendSequenceNumber (uint64_t seqNo)
 Append a sequence number component. More...
 
NameappendTimestamp (const std::optional< time::system_clock::time_point > &timestamp=std::nullopt)
 Append a timestamp component. More...
 
NameappendVersion (const std::optional< uint64_t > &version=std::nullopt)
 Append a version component. More...
 
const Componentat (ssize_t i) const
 Returns an immutable reference to the component at the specified index, with bounds checking. More...
 
const_iterator begin () const noexcept
 Begin iterator. More...
 
void clear ()
 Remove all components. 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...
 
Name deepCopy () const
 Make a deep copy of the name, reallocating the underlying memory buffer. More...
 
bool empty () const noexcept
 Checks if the name is empty, i.e., has no components. More...
 
const_iterator end () const noexcept
 End iterator. More...
 
bool equals (const Name &other) const noexcept
 Check if this name equals another name. More...
 
void erase (ssize_t i)
 Erase the component at the specified index. More...
 
const Componentget (ssize_t i) const noexcept
 Returns an immutable reference to the component at the specified index. More...
 
PartialName getPrefix (ssize_t nComponents) const
 Returns a prefix of the name. More...
 
PartialName getSubName (ssize_t iStartComponent, size_t nComponents=npos) const
 Extracts some components as a sub-name (PartialName). More...
 
Name getSuccessor () const
 Get the successor of a name. More...
 
bool hasWire () const noexcept
 Check if this instance already has wire encoding. More...
 
bool isPrefixOf (const Name &other) const noexcept
 Check if this name is a prefix of another name. More...
 
const Componentoperator[] (ssize_t i) const noexcept
 Equivalent to get(). More...
 
const_reverse_iterator rbegin () const noexcept
 Reverse begin iterator. More...
 
const_reverse_iterator rend () const noexcept
 Reverse end iterator. More...
 
Nameset (ssize_t i, Component &&component)
 Replace the component at the specified index. More...
 
Nameset (ssize_t i, const Component &component)
 Replace the component at the specified index. More...
 
size_t size () const noexcept
 Returns the number of components. More...
 
std::string toUri (name::UriFormat format=name::UriFormat::DEFAULT) const
 Get URI representation of the name. More...
 
void toUri (std::ostream &os, name::UriFormat format=name::UriFormat::DEFAULT) const
 Write URI representation of the name to the output stream. More...
 
void wireDecode (const Block &wire)
 Decode name from wire encoding. More...
 
const BlockwireEncode () const
 Perform wire encoding, or return existing (cached) wire encoding. More...
 
template<encoding::Tag TAG>
size_t wireEncode (EncodingImpl< TAG > &encoder) const
 Prepend wire encoding to encoder. More...
 

Static Public Attributes

static constexpr 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)
 
std::ostream & operator<< (std::ostream &os, const Name &name)
 Print the URI representation of a name. More...
 
bool operator== (const Name &lhs, const Name &rhs) noexcept
 

Detailed Description

Represents an absolute name.

See also
https://docs.named-data.net/NDN-packet-spec/0.3/name.html

Definition at line 44 of file name.hpp.

Member Typedef Documentation

◆ allocator_type

Definition at line 52 of file name.hpp.

◆ Component

Definition at line 47 of file name.hpp.

◆ const_iterator

Definition at line 58 of file name.hpp.

◆ const_pointer

Definition at line 56 of file name.hpp.

◆ const_reference

Definition at line 54 of file name.hpp.

◆ const_reverse_iterator

using ndn::Name::const_reverse_iterator = std::reverse_iterator<const_iterator>

Definition at line 60 of file name.hpp.

◆ difference_type

Definition at line 61 of file name.hpp.

◆ Error

Definition at line 48 of file name.hpp.

◆ iterator

Definition at line 57 of file name.hpp.

◆ pointer

Definition at line 55 of file name.hpp.

◆ reference

Definition at line 53 of file name.hpp.

◆ reverse_iterator

using ndn::Name::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 59 of file name.hpp.

◆ size_type

using ndn::Name::size_type = std::vector<Component>::size_type

Definition at line 62 of file name.hpp.

◆ value_type

Definition at line 51 of file name.hpp.

Constructor & Destructor Documentation

◆ Name() [1/5]

ndn::Name::Name ( )
default

Create an empty name.

Postcondition
empty() == true

◆ Name() [2/5]

ndn::Name::Name ( const Block wire)
explicit

Create Name from wire encoding.

Parameters
wireTLV element of type tlv::Name

This is equivalent to:

Name name;
name.wireDecode(wire);
Name()
Create an empty name.
Exceptions
tlv::ErrorThe wire encoding is invalid.

Definition at line 41 of file name.cpp.

◆ Name() [3/5]

ndn::Name::Name ( std::string_view  uri)
explicit

Create name from NDN URI.

See also
https://docs.named-data.net/NDN-packet-spec/0.3/name.html#ndn-uri-scheme

Definition at line 46 of file name.cpp.

◆ Name() [4/5]

ndn::Name::Name ( const char *  uri)
inline

Create name from NDN URI.

See also
https://docs.named-data.net/NDN-packet-spec/0.3/name.html#ndn-uri-scheme
Note
This constructor enables implicit conversion from a string literal.

Definition at line 98 of file name.hpp.

◆ Name() [5/5]

ndn::Name::Name ( const std::string &  uri)
inline

Create name from NDN URI.

See also
https://docs.named-data.net/NDN-packet-spec/0.3/name.html#ndn-uri-scheme
Note
This constructor enables implicit conversion from std::string.

Definition at line 108 of file name.hpp.

Member Function Documentation

◆ append() [1/8]

Name& ndn::Name::append ( Component &&  component)
inline

Append a name component.

Returns
A reference to this Name, to allow chaining.

Definition at line 319 of file name.hpp.

◆ append() [2/8]

Name& ndn::Name::append ( const char *  str)
inline

Append a GenericNameComponent, copying the TLV-VALUE from a null-terminated string.

Parameters
stra null-terminated string. Bytes from the string are copied as is, and not interpreted as a URI component.
Returns
A reference to this Name, to allow chaining.

Definition at line 383 of file name.hpp.

◆ append() [3/8]

Name& ndn::Name::append ( const Component component)
inline

Append a name component.

Returns
A reference to this Name, to allow chaining.

Definition at line 308 of file name.hpp.

◆ append() [4/8]

Name & ndn::Name::append ( const PartialName name)

Append a PartialName.

Parameters
namethe components to append
Returns
A reference to this Name, to allow chaining.

Definition at line 217 of file name.cpp.

◆ append() [5/8]

template<class Iterator >
Name& ndn::Name::append ( Iterator  first,
Iterator  last 
)
inline

Append a GenericNameComponent, copying the TLV-VALUE from a range.

Template Parameters
Iteratoran InputIterator dereferencing to a one-octet value type. More efficient implementation is available when it is a RandomAccessIterator.
Parameters
firstbeginning of the range.
lastpast-end of the range.
Returns
A reference to this Name, to allow chaining.

Definition at line 371 of file name.hpp.

◆ append() [6/8]

Name& ndn::Name::append ( span< const uint8_t >  value)
inline

Append a GenericNameComponent, copying the TLV-VALUE from value.

Returns
A reference to this Name, to allow chaining.

Definition at line 340 of file name.hpp.

◆ append() [7/8]

template<class Iterator >
Name& ndn::Name::append ( uint32_t  type,
Iterator  first,
Iterator  last 
)
inline

Append a NameComponent of TLV-TYPE type, copying the TLV-VALUE from a range.

Template Parameters
Iteratoran InputIterator dereferencing to a one-octet value type. More efficient implementation is available when it is a RandomAccessIterator.
Parameters
typethe TLV-TYPE.
firstbeginning of the range.
lastpast-end of the range.
Returns
A reference to this Name, to allow chaining.

Definition at line 356 of file name.hpp.

◆ append() [8/8]

Name& ndn::Name::append ( uint32_t  type,
span< const uint8_t >  value 
)
inline

Append a NameComponent of TLV-TYPE type, copying the TLV-VALUE from value.

Returns
A reference to this Name, to allow chaining.

Definition at line 330 of file name.hpp.

◆ appendByteOffset()

Name& ndn::Name::appendByteOffset ( uint64_t  offset)
inline

Append a byte offset component.

Returns
A reference to this Name, to allow chaining.
See also
NDN Naming Conventions https://named-data.net/publications/techreports/ndn-tr-22-3-ndn-memo-naming-conventions/

Definition at line 443 of file name.hpp.

◆ appendImplicitSha256Digest() [1/2]

Name& ndn::Name::appendImplicitSha256Digest ( ConstBufferPtr  digest)
inline

Append an ImplicitSha256Digest component.

Returns
A reference to this Name, to allow chaining.

Definition at line 486 of file name.hpp.

◆ appendImplicitSha256Digest() [2/2]

Name& ndn::Name::appendImplicitSha256Digest ( span< const uint8_t >  digestBytes)
inline

Append an ImplicitSha256Digest component.

Returns
A reference to this Name, to allow chaining.

Definition at line 496 of file name.hpp.

◆ appendKeyword() [1/2]

Name& ndn::Name::appendKeyword ( span< const uint8_t >  keyword)
inline

Append a keyword component.

Returns
A reference to this Name, to allow chaining.

Definition at line 533 of file name.hpp.

◆ appendKeyword() [2/2]

Name& ndn::Name::appendKeyword ( std::string_view  keyword)
inline

Append a keyword component.

Returns
A reference to this Name, to allow chaining.

Definition at line 543 of file name.hpp.

◆ appendNumber()

Name& ndn::Name::appendNumber ( uint64_t  number)
inline

Append a component with a NonNegativeInteger.

Returns
A reference to this Name, to allow chaining.
See also
https://docs.named-data.net/NDN-packet-spec/0.3/tlv.html#non-negative-integer-encoding

Definition at line 402 of file name.hpp.

◆ appendNumberWithMarker()

Name& ndn::Name::appendNumberWithMarker ( uint8_t  marker,
uint64_t  number 
)
inline

Append a component with a marked number.

Parameters
marker1-octet marker
numberthe number

The component is encoded as a 1-octet marker, followed by a NonNegativeInteger.

Returns
A reference to this Name, to allow chaining.
See also
NDN Naming Conventions revision 1 (obsolete) https://named-data.net/wp-content/uploads/2014/08/ndn-tr-22-ndn-memo-naming-conventions.pdf

Definition at line 419 of file name.hpp.

◆ appendParametersSha256Digest() [1/2]

Name& ndn::Name::appendParametersSha256Digest ( ConstBufferPtr  digest)
inline

Append a ParametersSha256Digest component.

Returns
A reference to this Name, to allow chaining.

Definition at line 506 of file name.hpp.

◆ appendParametersSha256Digest() [2/2]

Name& ndn::Name::appendParametersSha256Digest ( span< const uint8_t >  digestBytes)
inline

Append a ParametersSha256Digest component.

Returns
A reference to this Name, to allow chaining.

Definition at line 516 of file name.hpp.

◆ appendParametersSha256DigestPlaceholder()

Name & ndn::Name::appendParametersSha256DigestPlaceholder ( )

Append a placeholder for a ParametersSha256Digest component.

Returns
A reference to this Name, to allow chaining.

Definition at line 238 of file name.cpp.

◆ appendSegment()

Name& ndn::Name::appendSegment ( uint64_t  segmentNo)
inline

Append a segment number (sequential) component.

Returns
A reference to this Name, to allow chaining.
See also
NDN Naming Conventions https://named-data.net/publications/techreports/ndn-tr-22-3-ndn-memo-naming-conventions/

Definition at line 431 of file name.hpp.

◆ appendSequenceNumber()

Name& ndn::Name::appendSequenceNumber ( uint64_t  seqNo)
inline

Append a sequence number component.

Returns
A reference to this Name, to allow chaining.
See also
NDN Naming Conventions https://named-data.net/publications/techreports/ndn-tr-22-3-ndn-memo-naming-conventions/

Definition at line 476 of file name.hpp.

◆ appendTimestamp()

Name & ndn::Name::appendTimestamp ( const std::optional< time::system_clock::time_point > &  timestamp = std::nullopt)

Append a timestamp component.

Parameters
timestampthe timestamp to append; if nullopt, the current system time is used
Returns
A reference to this Name, to allow chaining.
See also
NDN Naming Conventions https://named-data.net/publications/techreports/ndn-tr-22-3-ndn-memo-naming-conventions/

Definition at line 211 of file name.cpp.

◆ appendVersion()

Name & ndn::Name::appendVersion ( const std::optional< uint64_t > &  version = std::nullopt)

Append a version component.

Parameters
versionthe version number to append; if nullopt, the current UNIX time in milliseconds is used
Returns
A reference to this Name, to allow chaining.
See also
NDN Naming Conventions https://named-data.net/publications/techreports/ndn-tr-22-3-ndn-memo-naming-conventions/

Definition at line 205 of file name.cpp.

◆ at()

const name::Component & ndn::Name::at ( ssize_t  i) const

Returns an immutable reference to the component at the specified index, with bounds checking.

Parameters
izero-based index of the component to return; if negative, it is interpreted as offset from the end of the name
Exceptions
ErrorThe index is out of bounds.

Definition at line 146 of file name.cpp.

◆ begin()

const_iterator ndn::Name::begin ( ) const
inlinenoexcept

Begin iterator.

Definition at line 253 of file name.hpp.

◆ clear()

void ndn::Name::clear ( )

Remove all components.

Postcondition
empty() == true

Definition at line 256 of file name.cpp.

◆ compare() [1/2]

int ndn::Name::compare ( const Name other) const
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.

Parameters
otherThe other Name to compare with.
Return values
negativethis comes before other in canonical ordering
zerothis equals other
positivethis comes after other in canonical ordering
See also
https://docs.named-data.net/NDN-packet-spec/0.3/name.html#canonical-order

Definition at line 634 of file name.hpp.

◆ compare() [2/2]

int ndn::Name::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.

Equivalent to getSubName(pos1, count1).compare(other.getSubName(pos2, count2)).

Definition at line 305 of file name.cpp.

◆ deepCopy()

Name ndn::Name::deepCopy ( ) const

Make a deep copy of the name, reallocating the underlying memory buffer.

Definition at line 135 of file name.cpp.

◆ empty()

bool ndn::Name::empty ( ) const
inlinenoexcept

Checks if the name is empty, i.e., has no components.

Definition at line 171 of file name.hpp.

◆ end()

const_iterator ndn::Name::end ( ) const
inlinenoexcept

End iterator.

Definition at line 261 of file name.hpp.

◆ equals()

bool ndn::Name::equals ( const Name other) const
noexcept

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 291 of file name.cpp.

◆ erase()

void ndn::Name::erase ( ssize_t  i)

Erase the component at the specified index.

Parameters
izero-based index of the component to erase; if negative, it is interpreted as offset from the end of the name
Warning
No bounds checking is performed, using an out-of-range index is undefined behavior.

Definition at line 245 of file name.cpp.

◆ get()

const Component& ndn::Name::get ( ssize_t  i) const
inlinenoexcept

Returns an immutable reference to the component at the specified index.

Parameters
izero-based index of the component to return; if negative, it is interpreted as offset from the end of the name
Warning
No bounds checking is performed, using an out-of-range index is undefined behavior.

Definition at line 192 of file name.hpp.

◆ getPrefix()

PartialName ndn::Name::getPrefix ( ssize_t  nComponents) const
inline

Returns a prefix of the name.

Parameters
nComponentsnumber 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 241 of file name.hpp.

◆ getSubName()

PartialName ndn::Name::getSubName ( ssize_t  iStartComponent,
size_t  nComponents = npos 
) const

Extracts some components as a sub-name (PartialName).

Parameters
iStartComponentzero-based index of the first component; if negative, size()+iStartComponent is used instead
nComponentsnumber of desired components, starting at iStartComponent; use npos to return all components until the end of the name
Returns
a new PartialName containing the extracted components

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 160 of file name.cpp.

◆ getSuccessor()

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:

  • successor of / is /sha256digest=0000000000000000000000000000000000000000000000000000000000000000.
  • successor of /sha256digest=0000000000000000000000000000000000000000000000000000000000000000 is /sha256digest=0000000000000000000000000000000000000000000000000000000000000001.
  • successor of /sha256digest=ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff is /2=....
  • successor of /P/A is /P/B.
  • successor of /Q/FF is /Q/%00%00.
Returns
a new Name containing the successor

Definition at line 264 of file name.cpp.

◆ hasWire()

bool ndn::Name::hasWire ( ) const
inlinenoexcept

Check if this instance already has wire encoding.

Definition at line 133 of file name.hpp.

◆ isPrefixOf()

bool ndn::Name::isPrefixOf ( const Name other) const
noexcept

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.

Return values
truethis name is a prefix of other
falsethis name is not a prefix of other

Definition at line 275 of file name.cpp.

◆ operator[]()

const Component& ndn::Name::operator[] ( ssize_t  i) const
inlinenoexcept

Equivalent to get().

Definition at line 204 of file name.hpp.

◆ rbegin()

const_reverse_iterator ndn::Name::rbegin ( ) const
inlinenoexcept

Reverse begin iterator.

Definition at line 269 of file name.hpp.

◆ rend()

const_reverse_iterator ndn::Name::rend ( ) const
inlinenoexcept

Reverse end iterator.

Definition at line 277 of file name.hpp.

◆ set() [1/2]

Name & ndn::Name::set ( ssize_t  i,
Component &&  component 
)

Replace the component at the specified index.

Parameters
izero-based index of the component to replace; if negative, it is interpreted as offset from the end of the name
componentthe new component to use as a replacement
Returns
A reference to this Name, to allow chaining.
Warning
No bounds checking is performed, using an out-of-range index is undefined behavior.

Definition at line 193 of file name.cpp.

◆ set() [2/2]

Name & ndn::Name::set ( ssize_t  i,
const Component component 
)

Replace the component at the specified index.

Parameters
izero-based index of the component to replace; if negative, it is interpreted as offset from the end of the name
componentthe new component to use as a replacement
Returns
A reference to this Name, to allow chaining.
Warning
No bounds checking is performed, using an out-of-range index is undefined behavior.

Definition at line 181 of file name.cpp.

◆ size()

size_t ndn::Name::size ( ) const
inlinenoexcept

Returns the number of components.

Definition at line 180 of file name.hpp.

◆ toUri() [1/2]

std::string ndn::Name::toUri ( name::UriFormat  format = name::UriFormat::DEFAULT) const

Get URI representation of the name.

Returns
URI representation; the "ndn:" scheme identifier is not included.
Note
To print the URI representation to a stream, it is more efficient to use os << name.
See also
https://docs.named-data.net/NDN-packet-spec/0.3/name.html#ndn-uri-scheme

Definition at line 338 of file name.cpp.

◆ toUri() [2/2]

void ndn::Name::toUri ( std::ostream &  os,
name::UriFormat  format = name::UriFormat::DEFAULT 
) const

Write URI representation of the name to the output stream.

See also
https://docs.named-data.net/NDN-packet-spec/0.3/name.html#ndn-uri-scheme

Definition at line 324 of file name.cpp.

◆ wireDecode()

void ndn::Name::wireDecode ( const Block wire)

Decode name from wire encoding.

Exceptions
tlv::ErrorThe wire encoding is invalid.
Postcondition
hasWire() == true

Definition at line 125 of file name.cpp.

◆ wireEncode() [1/2]

const Block & ndn::Name::wireEncode ( ) const

Perform wire encoding, or return existing (cached) wire encoding.

Postcondition
hasWire() == true

Definition at line 107 of file name.cpp.

◆ wireEncode() [2/2]

template<encoding::Tag TAG>
size_t ndn::Name::wireEncode ( EncodingImpl< TAG > &  encoder) const

Prepend wire encoding to encoder.

Definition at line 92 of file name.cpp.

Friends And Related Function Documentation

◆ operator<

bool operator< ( const Name lhs,
const Name rhs 
)
friend

Definition at line 659 of file name.hpp.

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Name name 
)
friend

Print the URI representation of a name.

See also
https://docs.named-data.net/NDN-packet-spec/0.3/name.html#ndn-uri-scheme

Definition at line 669 of file name.hpp.

◆ operator==

bool operator== ( const Name lhs,
const Name rhs 
)
friend

Definition at line 654 of file name.hpp.

Member Data Documentation

◆ npos

constexpr size_t ndn::Name::npos = std::numeric_limits<size_t>::max()
staticconstexpr

Indicates "until the end" in getSubName() and compare().

Definition at line 680 of file name.hpp.