A DelegationSet holds a list of DelegationSet::Delegation entries which is used as the content of a Link instance. More...
#include <delegation-set.hpp>
Classes | |
class | Delegation |
A DelegationSet::Delegation holds a preference number and delegation name. More... | |
Public Member Functions | |
DelegationSet () | |
Create a DelegationSet with an empty list of delegations. | |
DelegationSet (const DelegationSet &delegationSet) | |
Create a DelegationSet, copying values from the other DelegationSet. More... | |
void | add (int preference, const Name &name) |
Add a new DelegationSet::Delegation to the list of delegations, sorted by preference number then by name. More... | |
void | addUnsorted (const ptr_lib::shared_ptr< Delegation > &delegation) |
Add the DelegationSet::Delegation to the end of the list of delegations, without sorting or updating any existing entries. More... | |
bool | remove (const Name &name) |
Remove every DelegationSet::Delegation with the given name. More... | |
void | clear () |
Clear the list of delegations. | |
size_t | size () const |
Get the number of delegation entries. More... | |
const Delegation & | get (size_t i) const |
Get the delegation at the given index, according to the ordering described in add(). More... | |
int | find (const Name &name) const |
Find the first delegation with the given name and return its index. More... | |
Blob | wireEncode (WireFormat &wireFormat=*WireFormat::getDefaultWireFormat()) const |
Encode this DelegationSet for a particular wire format. More... | |
void | wireDecode (const uint8_t *input, size_t inputLength, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat()) |
Decode the input using a particular wire format and update this DelegationSet. More... | |
void | wireDecode (const std::vector< uint8_t > &input, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat()) |
Decode the input using a particular wire format and update this DelegationSet. More... | |
void | wireDecode (const Blob &input, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat()) |
Decode the input using a particular wire format and update this DelegationSet. More... | |
A DelegationSet holds a list of DelegationSet::Delegation entries which is used as the content of a Link instance.
If you add elements with add(), then the list is a set sorted by preference number then by name. But wireDecode will add the elements from the wire encoding, preserving the given order and possible duplicates (in which case a DelegationSet really holds a "list" and not necessarily a "set").
|
inline |
Create a DelegationSet, copying values from the other DelegationSet.
delegationSet | The DelegationSet to copy values from. |
void ndn::DelegationSet::add | ( | int | preference, |
const Name & | name | ||
) |
Add a new DelegationSet::Delegation to the list of delegations, sorted by preference number then by name.
If there is already a delegation with the same name, update its preference, and remove any extra delegations with the same name.
preference | The preference number. |
name | The delegation name. This makes a copy of the name. |
|
inline |
Add the DelegationSet::Delegation to the end of the list of delegations, without sorting or updating any existing entries.
This is useful for adding preferences from a wire encoding, preserving the supplied ordering and possible duplicates.
preference | The preference number. |
name | The delegation name. This makes a copy of the name. |
int ndn::DelegationSet::find | ( | const Name & | name | ) | const |
Find the first delegation with the given name and return its index.
name | Then name of the delegation to find. |
const DelegationSet::Delegation & ndn::DelegationSet::get | ( | size_t | i | ) | const |
Get the delegation at the given index, according to the ordering described in add().
i | The index of the component, starting from 0. |
runtime_error | If index is out of range. |
bool ndn::DelegationSet::remove | ( | const Name & | name | ) |
Remove every DelegationSet::Delegation with the given name.
name | The name to match the name of the delegation(s) to be removed. |
|
inline |
Get the number of delegation entries.
|
inline |
Decode the input using a particular wire format and update this DelegationSet.
input | The input byte array to be decoded. |
inputLength | The length of input. |
wireFormat | (optional) A WireFormat object used to decode the input. If omitted, use WireFormat::getDefaultWireFormat(). |
|
inline |
Decode the input using a particular wire format and update this DelegationSet.
input | The input byte array to be decoded. |
wireFormat | (optional) A WireFormat object used to decode the input. If omitted, use WireFormat::getDefaultWireFormat(). |
|
inline |
Decode the input using a particular wire format and update this DelegationSet.
input | The input byte array to be decoded as an immutable Blob. |
wireFormat | (optional) A WireFormat object used to decode the input. If omitted, use WireFormat::getDefaultWireFormat(). |
|
inline |
Encode this DelegationSet for a particular wire format.
wireFormat | (optional) A WireFormat object used to encode this DelegationSet. If omitted, use WireFormat::getDefaultWireFormat(). |