DelegationSet Class

A DelegationSet holds a list of DelegationSet.Delegation entries which is used as the content of a Link instance. If you add elements with DelegationSet.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”).

[C++]:
#include <ndn-cpp/delegation-set.hpp>
Namespace: ndn
[Python]:Module: pyndn
[Java]:Package: net.named_data.jndn

DelegationSet.add Method

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.

[C++]:
void add(
    int preference,
    const Name& name
);
[Python]:
def add(self,
    preference,  # int
    name         # Name
)
[JavaScript]:
DelegationSet.prototype.add = function(
    preference,  // number
    name         // Name
)
[Java]:
public final void add(
    int preference,
    Name name
)
Parameters:
  • preference
    The preference number.
  • name
    The delegation name. This makes a copy of the name.

DelegationSet.clear Method

Clear the list of delegations.

[C++]:
void clear();
[Python]:
def clear(self)
[JavaScript]:
DelegationSet.prototype.clear = function()
[Java]:
public final void clear()

DelegationSet.find Method

Find the first delegation with the given name and return its index.

[C++]:
int find(
    const Name& name
) const;
[Python]:
# Returns int
def find(self,
    name  # Name
)
[JavaScript]:
// Returns number
DelegationSet.prototype.find = function(
    name  // Name
)
[Java]:
public final int find(
    Name name
)
Parameters:
  • name
    Then name of the delegation to find.
Returns:

The index of the delegation, or -1 if not found.

DelegationSet.get Method

Get the delegation at the given index, according to the ordering described in DelegationSet.add.

[C++]:
const DelegationSet::Delegation& get(
    size_t i
) const;
[Python]:
# Returns DelegationSet.Delegation
def get(self,
    i  # int
)
[JavaScript]:
// Returns DelegationSet.Delegation
DelegationSet.prototype.get = function(
    i  // number
)
[Java]:
public final DelegationSet.Delegation get(
    int i
)
Parameters:
  • i
    The index of the component, starting from 0.
Returns:

The DelegationSet.Delegation at the index.

DelegationSet.remove Method

Remove every delegation entry with the given name.

[C++]:
bool remove(
    const Name& name
);
[Python]:
# Returns bool
def remove(self,
    name  # Name
)
[JavaScript]:
// Returns boolean
DelegationSet.prototype.remove = function(
    name  // Name
)
[Java]:
public final boolean remove(
    Name name
)
Parameters:
  • name
    Then name to match the name of the delegation(s) to be removed.
Returns:

True if a delegation was removed, otherwise false.

DelegationSet.size Method

Get the number of delegation entries.

[C++]:
size_t size() const;
[Python]:
# Returns int
def size(self)
[JavaScript]:
// Returns number
DelegationSet.prototype.size = function()
[Java]:
public final int size()
Returns:

The number of delegation entries.

DelegationSet.Delegation Class

A DelegationSet.Delegation holds a preference number and delegation name. You do not construct a DelegationSet.Delegation directly, but use DelegationSet.add or get delegations after decoding a Link instance.

[C++]:
#include <ndn-cpp/delegation-set.hpp>
Namespace: ndn
[Python]:Module: pyndn
[Java]:Package: net.named_data.jndn

DelegationSet.Delegation.getPreference Method

Get the preference number.

[C++]:
const int getPreference() const;
[Python]:
# Returns int
def getPreference(self)
[JavaScript]:
// Returns number
DelegationSet.Delegation.prototype.getPreference = function()
[Java]:
public final int getPreference()
Returns:

The preference number.

DelegationSet.Delegation.getName Method

Get the delegation name.

[C++]:
const Name& getName() const;
[Python]:
# Returns Name
def getName(self)
[JavaScript]:
// Returns Name
DelegationSet.Delegation.prototype.getName = function()
[Java]:
public final Name getName()
Returns:

The delegation name.