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();
bool equals(const Name &name) const
Check if this name has the same component count and components as the given name. ...
PartialName getPrefix(ssize_t nComponents) const
Extract a prefix (PartialName) of the name, containing first nComponents components.
Copyright (c) 2011-2015 Regents of the University of California.
name::Component Component
std::string toUri() const
Encode this name as a URI.
const Block & wireEncode() const
const Component & at(ssize_t i) const
Get component at the specified index.
Name & appendNumber(uint64_t number)
Append a component with the number encoded as nonNegativeInteger.
Name & append(const char *value)
Append name component that represented as a string.
bool operator<(const Name &other) const
Return true if this is less than the other Name in the NDN canonical ordering.
const_iterator end() const
End iterator (const).
const Component & operator[](ssize_t i) const
std::ostream & operator<<(std::ostream &os, const Data &data)
component_container::size_type size_type
const Component const_reference
Name getSuccessor() const
Get the successor of a name.
const_reverse_iterator rend() const
Reverse end iterator (const).
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.
const_reverse_iterator rbegin() const
Reverse begin iterator (const).
static time_point now() noexcept
Copyright (c) 2013-2015 Regents of the University of California.
bool operator==(const Name &name) const
Check if this name has the same component count and components as the given name. ...
Name & appendSequenceNumber(uint64_t seqNo)
Append sequence number using NDN naming conventions.
Error that can be thrown from Name.
boost::reverse_iterator< iterator > reverse_iterator
int compare(const Name &other) const
Compare this to the other Name using NDN canonical ordering.
Name & appendSegmentOffset(uint64_t offset)
Append segment byte offset using NDN naming conventions.
const Component * const_iterator
Name & appendSegment(uint64_t segmentNo)
Append segment number (sequential) using NDN naming conventions.
Name & append(const Block &value)
const Component * const_pointer
bool operator>(const Name &other) const
Return true if this is greater than the other Name in the NDN canonical ordering. ...
bool operator>=(const Name &other) const
Return true if this is less than or equal to the other Name in the NDN canonical ordering.
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.
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...
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)
const_iterator begin() const
Begin iterator (const).
void push_back(const T &component)
Append the component.
size_t size() const
Get the number of components.
bool operator<=(const Name &other) const
Return true if this is less than or equal to the other Name in the NDN canonical ordering.
bool operator!=(const Name &name) const
Check if this name has the same component count and components as the given name. ...
Component holds a read-only name component value.
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.
DEPRECATED(void set(const char *uri))
bool empty() const
Check if name is emtpy.
component_container::difference_type difference_type
Name PartialName
Partial name abstraction to represent an arbitrary sequence of name components.
shared_ptr< const Buffer > ConstBufferPtr
void wireDecode(const Block &wire)
boost::reverse_iterator< const_iterator > const_reverse_iterator
void clear()
Clear all the components.
PartialName getSubName(ssize_t iStartComponent, size_t nComponents=npos) const
Extract a sub-name (PartialName) of nComponents components starting from iStartComponent.
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.
bool hasWire() const
Check if already has wire.
Name & appendImplicitSha256Digest(const ConstBufferPtr &digest)
Append ImplicitSha256Digest.