Project

General

Profile

Actions

Feature #3987

closed

nfdc: origin argument accepts string

Added by Junxiao Shi almost 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Tools
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
1.50 h

Description

In nfdc command parser, accept strings in addition to numbers for origin field.
Accepted strings should be consistent with ndn::nfd::RouteOrigin type.

Actions #1

Updated by Junxiao Shi over 7 years ago

  • Status changed from New to In Progress
  • Assignee set to Junxiao Shi
  • % Done changed from 0 to 40

https://gerrit.named-data.net/3816 operator>>(std::istream&, RouteOrigin&)

Actions #2

Updated by Junxiao Shi over 7 years ago

it doesn't seem something general enough to warrant a library implementation. As a matter of fact, FacePersistency is parsed in nfdc itself. Why is RouteOrigin different than FacePersistency?

nfdc only accepts 'persistent' and 'permanent' but not 'on-demand', so a general stream extraction operator of FacePersistency would not be useful. Also, it's unlikely for a new FacePersistency to be added.

nfdc can accept any RouteOrigin value, so it can use the stream extraction operator. Also, when a new RouteOrigin is introduced, only ndn-cxx needs to be changed.

Actions #3

Updated by Davide Pesavento over 7 years ago

nfdc only accepts 'persistent' and 'permanent' but not 'on-demand', so a general stream extraction operator of FacePersistency would not be useful. Also, it's unlikely for a new FacePersistency to be added.

Neither of these justifications are particularly convincing. In particular, nfdc could use a generic library-provided parsing function and then reject the "on-demand" value.

My point about not being "general enough" though was referred to the API itself. Why providing operator>> instead of e.g. a "fromString" kind of function?

Actions #4

Updated by Junxiao Shi over 7 years ago

Why providing operator>> instead of e.g. a "fromString" kind of function?

What's the benefit?

Actions #5

Updated by Davide Pesavento over 7 years ago

Junxiao Shi wrote:

Why providing operator>> instead of e.g. a "fromString" kind of function?

What's the benefit?

I don't know. It's more likely that an app has the data to be parsed in a string rather than an istream. But anyway, that's beside the point. I'm just saying that I'm not sure if an operator>> API would be general enough. You already made several choices in that API: accepting an istream, case-insensitive matching, leading/trailing whitespace handling, ...

Actions #6

Updated by Junxiao Shi over 7 years ago

  • Status changed from In Progress to Code review
  • % Done changed from 40 to 100

https://gerrit.named-data.net/3836 changes both input and output of RouteOrigin field to use strings.

Actions #7

Updated by Junxiao Shi over 7 years ago

  • Status changed from Code review to Closed
Actions

Also available in: Atom PDF