#include <name.h>
Public Types | |
typedef std::vector < name::Component >::iterator | iterator |
typedef std::vector < name::Component > ::const_iterator | const_iterator |
typedef std::vector < name::Component > ::reverse_iterator | reverse_iterator |
typedef std::vector < name::Component > ::const_reverse_iterator | const_reverse_iterator |
typedef std::vector < name::Component >::reference | reference |
typedef std::vector < name::Component > ::const_reference | const_reference |
typedef name::Component | partial_type |
Public Member Functions | |
Name () | |
Default constructor to create an empty name (zero components, or "/") | |
Name (const Name &other) | |
Copy constructor. More... | |
Name (const std::string &url) | |
Create a name from URL string. More... | |
template<class Iterator > | |
Name (Iterator begin, Iterator end) | |
Create a name from a container of elements [begin, end) More... | |
Name & | operator= (const Name &other) |
Assignment operator. | |
Name & | append (const name::Component &comp) |
Append a binary blob as a name component. More... | |
Name & | appendBySwap (name::Component &comp) |
Append a binary blob as a name component. More... | |
template<class Iterator > | |
Name & | append (Iterator begin, Iterator end) |
Append components a container of elements [begin, end) More... | |
Name & | append (const Name &comp) |
Append components from another ndn::Name object. More... | |
Name & | append (const std::string &compStr) |
Append a string as a name component. More... | |
Name & | append (const void *buf, size_t size) |
Append a binary blob as a name component. More... | |
Name & | appendNumber (uint64_t number) |
Append network-ordered numeric component to the name. More... | |
Name & | appendNumberWithMarker (uint64_t number, unsigned char marker) |
Append network-ordered numeric component to the name with marker. More... | |
Name & | appendSeqNum (uint64_t seqno) |
Helper method to add sequence number to the name (marker = 0x00) More... | |
Name & | appendControlNum (uint64_t control) |
Helper method to add control number to the name (marker = 0xC1) More... | |
Name & | appendBlkId (uint64_t blkid) |
Helper method to add block ID to the name (marker = 0xFB) More... | |
Name & | appendVersion (uint64_t version=Name::nversion) |
Helper method to add version to the name (marker = 0xFD) More... | |
size_t | size () const |
Get number of the name components. More... | |
const name::Component & | get (int index) const |
Get binary blob of name component. More... | |
name::Component & | get (int index) |
Get binary blob of name component. More... | |
Name::const_iterator | begin () const |
Begin iterator (const) | |
Name::iterator | begin () |
Begin iterator. | |
Name::const_iterator | end () const |
End iterator (const) | |
Name::iterator | end () |
End iterator. | |
Name::const_reverse_iterator | rbegin () const |
Reverse begin iterator (const) | |
Name::reverse_iterator | rbegin () |
Reverse begin iterator. | |
Name::const_reverse_iterator | rend () const |
Reverse end iterator (const) | |
Name::reverse_iterator | rend () |
Reverse end iterator. | |
Name | getSubName (size_t pos=0, size_t len=npos) const |
Get a new name, constructed as a subset of components. More... | |
Name | getPrefix (size_t len, size_t skip=0) const |
Get prefix of the name. More... | |
Name | getPostfix (size_t len, size_t skip=0) const |
Get postfix of the name. More... | |
std::string | toUri () const |
Get text representation of the name (URI) | |
void | toUri (std::ostream &os) const |
Write name as URI to the specified output stream. More... | |
int | compare (const Name &name) const |
Compare two names, using canonical ordering for each component. More... | |
bool | operator== (const Name &name) const |
Check if to Name objects are equal (have the same number of components with the same binary data) | |
bool | operator!= (const Name &name) const |
Check if two Name objects are not equal. | |
bool | operator<= (const Name &name) const |
Less or equal comparison of two name objects. | |
bool | operator< (const Name &name) const |
Less comparison of two name objects. | |
bool | operator>= (const Name &name) const |
Great or equal comparison of two name objects. | |
bool | operator> (const Name &name) const |
Great comparison of two name objects. | |
name::Component & | operator[] (int index) |
Operator [] to simplify access to name components. More... | |
const name::Component & | operator[] (int index) const |
Operator [] to simplify access to name components. More... | |
Name | operator+ (const Name &name) const |
Create a new Name object, by copying components from first and second name. | |
template<class T > | |
void | push_back (const T &comp) |
A wrapper for append method. | |
Static Public Attributes | |
static const size_t | npos = static_cast<size_t> (-1) |
Value returned by various member functions when they fail. | |
static const uint64_t | nversion = static_cast<uint64_t> (-1) |
ns3::ndn::Name::Name | ( | const Name & | other | ) |
ns3::ndn::Name::Name | ( | const std::string & | url | ) |
Create a name from URL string.
url | URI-represented name |
ns3::ndn::Name::Name | ( | Iterator | begin, |
Iterator | end | ||
) |
|
inline |
Append a binary blob as a name component.
comp | a binary blob |
Definition at line 429 of file name.h.
References push_back().
Referenced by getSubName(), operator+(), and ns3::ndn::wire::CcnbParser::NameVisitor::visit().
|
inline |
|
inline |
|
inline |
|
inline |
Helper method to add block ID to the name (marker = 0xFB)
blkid | block ID |
|
inline |
|
inline |
Helper method to add control number to the name (marker = 0xC1)
control | control number |
|
inline |
Append network-ordered numeric component to the name.
number | number to be encoded and added as a component |
Number is encoded and added in network order. Tail zero-bytes are not included. For example, if the number is 1, then 1-byte binary blob will be added 0x01. If the number is 256, then 2 binary blob will be added: 0x01 0x01
If the number is zero, an empty component will be added
Definition at line 484 of file name.h.
References ns3::ndn::name::Component::fromNumber().
|
inline |
Append network-ordered numeric component to the name with marker.
number | number to be encoded and added as a component |
marker | byte marker, specified by the desired naming convention |
Currently defined naming conventions of the marker:
This version is almost exactly as appendNumber, with exception that it adds initial marker. The number is formatted in the exactly the same way.
Definition at line 491 of file name.h.
References ns3::ndn::name::Component::fromNumberWithMarker().
|
inline |
Helper method to add sequence number to the name (marker = 0x00)
seqno | sequence number |
Name & ns3::ndn::Name::appendVersion | ( | uint64_t | version = Name::nversion | ) |
Helper method to add version to the name (marker = 0xFD)
version | fully formatted version in a desired format (e.g., timestamp). If version is Name::nversion, then the version number is automatically assigned based on UTC timestamp |
int ns3::ndn::Name::compare | ( | const Name & | name | ) | const |
const name::Component & ns3::ndn::Name::get | ( | int | index | ) | const |
Get binary blob of name component.
index | index of the name component. If less than 0, then getting component from the back: get(-1) getting the last component, get(-2) is getting second component from back, etc. |
If index is out of range, an exception will be thrown
name::Component & ns3::ndn::Name::get | ( | int | index | ) |
|
inline |
|
inline |
Get a new name, constructed as a subset of components.
pos | Position of the first component to be copied to the subname |
len | Number of components to be copied. Value Name::npos indicates that all components till the end of the name. |
Definition at line 184 of file name.cc.
References append().
|
inline |
|
inline |
|
inline |
Get number of the name components.
Definition at line 516 of file name.h.
Referenced by ns3::ndn::Producer::OnInterest().
void ns3::ndn::Name::toUri | ( | std::ostream & | os | ) | const |