32 #include <boost/iterator/reverse_iterator.hpp> 46 class Name :
public enable_shared_from_this<Name>
102 Name(
const char* uri);
108 Name(
const std::string& uri);
113 template<encoding::Tag TAG>
134 set(
const char* uri));
141 set(
const std::string& uri));
148 append(
const uint8_t* value,
size_t valueLength)
163 template<
class Iterator>
238 getSubName(ssize_t iStartComponent,
size_t nComponents =
npos)
const;
252 return getSubName(0, m_nameBlock.elements_size() + nComponents);
400 return m_nameBlock.elements().empty();
410 return m_nameBlock.elements_size();
422 return reinterpret_cast<const Component&
>(m_nameBlock.elements()[i]);
424 return reinterpret_cast<const Component&
>(m_nameBlock.elements()[
size() + i]);
444 if ((i >= 0 && static_cast<size_t>(i) >=
size()) ||
445 (i < 0 && static_cast<size_t>(-i) >
size()))
446 BOOST_THROW_EXCEPTION(
Error(
"Requested component does not exist (out of bounds)"));
485 compare(
size_t pos1,
size_t count1,
486 const Name& other,
size_t pos2 = 0,
size_t count2 =
npos)
const;
492 template<
class T>
void 578 return reinterpret_cast<const_iterator
>(&*m_nameBlock.elements().begin());
589 return reinterpret_cast<const_iterator
>(&*m_nameBlock.elements().end());
595 const_reverse_iterator
604 const_reverse_iterator
612 construct(
const char* uri);
620 mutable Block m_nameBlock;
632 return m_nameBlock.hasWire();
Copyright (c) 2011-2015 Regents of the University of California.
name::Component Component
bool operator!=(const Name &name) const
Check if this name has the same component count and components as the given name. ...
const_iterator begin() const
Begin iterator (const).
Name & appendNumber(uint64_t number)
Append a component with the number encoded as nonNegativeInteger.
Name getSuccessor() const
Get the successor of a name.
Name & append(const char *value)
Append name component that represented as a string.
std::ostream & operator<<(std::ostream &os, const Data &data)
bool operator==(const Name &name) const
Check if this name has the same component count and components as the given name. ...
component_container::size_type size_type
const Component const_reference
Name & append(const Component &value)
Append component value.
static const size_t npos
indicates "until the end" in getSubName and compare
std::vector< Component > component_container
Class representing a wire element of NDN-TLV packet format.
static time_point now() noexcept
Copyright (c) 2013-2014 Regents of the University of California.
const Component & operator[](ssize_t i) const
Name & appendSequenceNumber(uint64_t seqNo)
Append sequence number using NDN naming conventions.
Error that can be thrown from Name.
std::string toUri() const
Encode this name as a URI.
bool operator>=(const Name &other) const
Return true if this is less than or equal to the other Name in the NDN canonical ordering.
const Block & wireEncode() const
boost::reverse_iterator< iterator > reverse_iterator
Name & appendSegmentOffset(uint64_t offset)
Append segment byte offset using NDN naming conventions.
const_iterator end() const
End iterator (const).
const Component * const_iterator
const_reverse_iterator rend() const
Reverse end iterator (const).
Name & appendSegment(uint64_t segmentNo)
Append segment number (sequential) using NDN naming conventions.
bool hasWire() const
Check if already has wire.
Name & append(const Block &value)
const Component * const_pointer
bool operator<=(const Name &other) const
Return true if this is less than or equal to the other Name in the NDN canonical ordering.
size_t size() const
Get the number of components.
Name & appendTimestamp(const time::system_clock::TimePoint &timePoint=time::system_clock::now())
Append timestamp using NDN naming conventions.
std::istream & operator>>(std::istream &is, Name &name)
Name abstraction to represent an absolute name.
Name & append(Iterator first, Iterator last)
Append a new component, copying from value frome the range [first, last) of bytes.
Error(const std::string &what)
void push_back(const T &component)
Append the component.
const_reverse_iterator rbegin() const
Reverse begin iterator (const).
Component holds a read-only name component value.
bool operator>(const Name &other) const
Return true if this is greater than the other Name in the NDN canonical ordering. ...
int compare(const Name &other) const
Compare this to the other Name using NDN canonical ordering.
bool operator<(const Name &other) const
Return true if this is less than the other Name in the NDN canonical ordering.
Name & appendNumberWithMarker(uint8_t marker, uint64_t number)
Create a component encoded as NameComponentWithMarker.
Name & append(const uint8_t *value, size_t valueLength)
Append a new component, copying from value of length valueLength.
bool empty() const
Check if name is emtpy.
bool isPrefixOf(const Name &name) const
Check if the N components of this name are the same as the first N components of the given name...
DEPRECATED(void set(const char *uri))
PartialName getSubName(ssize_t iStartComponent, size_t nComponents=npos) const
Extract a sub-name (PartialName) of nComponents components starting from iStartComponent.
PartialName getPrefix(ssize_t nComponents) const
Extract a prefix (PartialName) of the name, containing first nComponents components.
component_container::difference_type difference_type
Name PartialName
Partial name abstraction to represent an arbitrary sequence of name components.
bool equals(const Name &name) const
Check if this name has the same component count and components as the given name. ...
shared_ptr< const Buffer > ConstBufferPtr
void wireDecode(const Block &wire)
boost::reverse_iterator< const_iterator > const_reverse_iterator
void clear()
Clear all the components.
const Component & at(ssize_t i) const
Get component at the specified index.
Name & appendVersion()
Append version using NDN naming conventions based on current UNIX timestamp in milliseconds.
Name()
Create a new Name with no components.
Error that can be thrown from name::Component.
Name & appendImplicitSha256Digest(const ConstBufferPtr &digest)
Append ImplicitSha256Digest.