Project

General

Profile

Actions

Feature #3449

closed

Name class API extension

Added by Alex Afanasyev about 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Start date:
Due date:
02/29/2016
% Done:

0%

Estimated time:

Description

There are several valuable methods in Name class that are not currently available:

  • isPrefixOf
  • compare(int, int, Name, int, int)
  • getSubName
  • getSuccessor

For documentation and reference implementation refer to ndn-cxx.

Actions #1

Updated by Jeff Burke about 8 years ago

Agree they're useful. Just let us know priority of this, and for what libraries first.

Actions #2

Updated by Alex Afanasyev about 8 years ago

I would use them in Python and Java

Actions #3

Updated by Anonymous about 8 years ago

  • Due date set to 02/29/2016
  • Assignee set to Anonymous
Actions #4

Updated by Alex Afanasyev about 8 years ago

Yes, I guess I missed it.

Actions #5

Updated by Anonymous about 8 years ago

  • Status changed from New to In Progress

Hi Alex. The ndn-cxx doc for compare(int, int, Name, int, int) says "This is equivalent to this->getSubName(pos1, count1).compare(other.getSubName(pos2, count2))". But getSubName treats a negative position as indexing back from the end of the name. However, compare does not do this.

In jNDN, etc. I will go ahead and support negative indexes in compare. Does that sound right? Should I submit an ndn-cxx issue either to fix the doc for compare, or to support negative positions?

Actions #6

Updated by Alex Afanasyev about 8 years ago

I don't have much opinion. The idea for compare was to have an optimized version to compare parts of the names. Implementing negative indices can help simplifying code (good), but will have a minor performance hit (could be ok).

Actions #7

Updated by Anonymous about 8 years ago

Then I'll support negative indexes. An application could easily compare the last two components of one name with the last two of another.

Actions #8

Updated by Anonymous about 8 years ago

  • Status changed from In Progress to Closed

Added isPrefixOf, getSuccessor and compare(int, int, Name, int, int) to NDN-CPP, PyNDN, NDN-JS and jNDN. Merged to the master branch.

Actions

Also available in: Atom PDF