A NameLite::Component holds a pointer to the component value. More...
#include <name-lite.hpp>
Public Member Functions | |
Component () | |
Create a NameLite::Component of zero size. | |
Component (const uint8_t *value, size_t valueLength) | |
Create a NameLite::Component with the given value. More... | |
Component (const BlobLite &value) | |
Create a NameLite::Component taking the pointer and size from the BlobLite value. More... | |
const BlobLite & | getValue () const |
bool | isSegment () const |
Check if this component is a segment number according to NDN naming conventions for "Segment number" (marker 0x00) and return an integer. More... | |
bool | isSegmentOffset () const |
Check if this component is a segment byte offset according to NDN naming conventions for "Byte offset" (marker 0xFB) and return an integer. More... | |
bool | isVersion () const |
Check if this component is a version number according to NDN naming conventions for "Versioning" (marker 0xFD) and return an integer. More... | |
bool | isTimestamp () const |
Check if this component is a timestamp according to NDN naming conventions for "Timestamp" (marker 0xFC) and return an integer. More... | |
bool | isSequenceNumber () const |
Check if this component is a sequence number according to NDN naming conventions for "Sequencing" (marker 0xFE) and return an integer. More... | |
uint64_t | toNumber () const |
Interpret the name component as a network-ordered number and return an integer. More... | |
ndn_Error | toNumberWithMarker (uint8_t marker, uint64_t &result) const |
Interpret the name component as a network-ordered number with a marker and return an integer. More... | |
ndn_Error | toNumberWithPrefix (const uint8_t *prefix, size_t prefixLength, uint64_t &result) const |
Interpret the name component as a network-ordered number with a prefix and return an integer. More... | |
bool | hasPrefix (const uint8_t *prefix, size_t prefixLength) const |
Check if this name component begins with the given prefix. More... | |
ndn_Error | toSegment (uint64_t &result) const |
Interpret this name component as a segment number according to NDN naming conventions for "Segment number" (marker 0x00). More... | |
ndn_Error | toSegmentOffset (uint64_t &result) const |
Interpret this name component as a segment byte offset according to NDN naming conventions for segment "Byte offset" (marker 0xFB). More... | |
ndn_Error | toVersion (uint64_t &result) const |
Interpret this name component as a version number according to NDN naming conventions for "Versioning" (marker 0xFD). More... | |
ndn_Error | toTimestamp (uint64_t &result) const |
Interpret this name component as a timestamp according to NDN naming conventions for "Timestamp" (marker 0xFC). More... | |
ndn_Error | toSequenceNumber (uint64_t &result) const |
Interpret this name component as a sequence number according to NDN naming conventions for "Sequencing" (marker 0xFE). More... | |
int | compare (const Component &other) const |
Compare this component to the other component using NDN component ordering. More... | |
Static Public Member Functions | |
static Component & | downCast (ndn_NameComponent &component) |
Downcast the reference to the ndn_NameComponent struct to a NameLite::Component. More... | |
static const Component & | downCast (const ndn_NameComponent &component) |
A NameLite::Component holds a pointer to the component value.
ndn::NameLite::Component::Component | ( | const uint8_t * | value, |
size_t | valueLength | ||
) |
Create a NameLite::Component with the given value.
value | The pre-allocated buffer for the value. |
valueLength | The number of bytes in value. |
ndn::NameLite::Component::Component | ( | const BlobLite & | value | ) |
Create a NameLite::Component taking the pointer and size from the BlobLite value.
value | The BlobLite with the pointer to use for this component. |
int ndn::NameLite::Component::compare | ( | const Component & | other | ) | const |
Compare this component to the other component using NDN component ordering.
A component is less if it is shorter, otherwise if equal length do a byte comparison.
other | The other name component to compare with. |
|
inlinestatic |
Downcast the reference to the ndn_NameComponent struct to a NameLite::Component.
component | A reference to the ndn_NameComponent struct. |
bool ndn::NameLite::Component::hasPrefix | ( | const uint8_t * | prefix, |
size_t | prefixLength | ||
) | const |
Check if this name component begins with the given prefix.
prefix | The required prefix of the component. |
prefixLength | The length of prefix. |
bool ndn::NameLite::Component::isSegment | ( | ) | const |
Check if this component is a segment number according to NDN naming conventions for "Segment number" (marker 0x00) and return an integer.
http://named-data.net/doc/tech-memos/naming-conventions.pdf
bool ndn::NameLite::Component::isSegmentOffset | ( | ) | const |
Check if this component is a segment byte offset according to NDN naming conventions for "Byte offset" (marker 0xFB) and return an integer.
http://named-data.net/doc/tech-memos/naming-conventions.pdf
bool ndn::NameLite::Component::isSequenceNumber | ( | ) | const |
Check if this component is a sequence number according to NDN naming conventions for "Sequencing" (marker 0xFE) and return an integer.
http://named-data.net/doc/tech-memos/naming-conventions.pdf
bool ndn::NameLite::Component::isTimestamp | ( | ) | const |
Check if this component is a timestamp according to NDN naming conventions for "Timestamp" (marker 0xFC) and return an integer.
http://named-data.net/doc/tech-memos/naming-conventions.pdf
bool ndn::NameLite::Component::isVersion | ( | ) | const |
Check if this component is a version number according to NDN naming conventions for "Versioning" (marker 0xFD) and return an integer.
http://named-data.net/doc/tech-memos/naming-conventions.pdf
uint64_t ndn::NameLite::Component::toNumber | ( | ) | const |
Interpret the name component as a network-ordered number and return an integer.
ndn_Error ndn::NameLite::Component::toNumberWithMarker | ( | uint8_t | marker, |
uint64_t & | result | ||
) | const |
Interpret the name component as a network-ordered number with a marker and return an integer.
marker | The required first byte of the component. |
result | Return the integer number. |
ndn_Error ndn::NameLite::Component::toNumberWithPrefix | ( | const uint8_t * | prefix, |
size_t | prefixLength, | ||
uint64_t & | result | ||
) | const |
Interpret the name component as a network-ordered number with a prefix and return an integer.
prefix | The required prefix of the component. |
prefixLength | The length of prefix. |
result | Return the integer number. |
ndn_Error ndn::NameLite::Component::toSegment | ( | uint64_t & | result | ) | const |
Interpret this name component as a segment number according to NDN naming conventions for "Segment number" (marker 0x00).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
result | Return the integer segment number. |
ndn_Error ndn::NameLite::Component::toSegmentOffset | ( | uint64_t & | result | ) | const |
Interpret this name component as a segment byte offset according to NDN naming conventions for segment "Byte offset" (marker 0xFB).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
result | Return the integer segment byte offset. |
ndn_Error ndn::NameLite::Component::toSequenceNumber | ( | uint64_t & | result | ) | const |
Interpret this name component as a sequence number according to NDN naming conventions for "Sequencing" (marker 0xFE).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
result | Return the integer sequence number. |
ndn_Error ndn::NameLite::Component::toTimestamp | ( | uint64_t & | result | ) | const |
Interpret this name component as a timestamp according to NDN naming conventions for "Timestamp" (marker 0xFC).
http://named-data.net/doc/tech-memos/naming-conventions.pdf
result | Return the number of microseconds since the UNIX epoch (Thursday, 1 January 1970) not counting leap seconds. |
ndn_Error ndn::NameLite::Component::toVersion | ( | uint64_t & | result | ) | const |
Interpret this name component as a version number according to NDN naming conventions for "Versioning" (marker 0xFD).
Note that this returns the exact number from the component without converting it to a time representation.
result | Return the integer version number. |