[ndnSIM] How to change prefix name?

Alex Afanasyev alexander.afanasyev at ucla.edu
Wed Jan 14 06:36:41 PST 2015


Hi Wonjun,

Negative indices is just a convenience way to get access name components from the back of the name.  The same (but a little longer) would be to write

x.get(x.size() - 1).toSeqNum();

—
Alex

> On Jan 14, 2015, at 2:28 AM, 최원준 <wonjunchoi001 at gmail.com> wrote:
> 
> Thanks for your comment. btw, I wonder what it means.(-1 index)
> 
> Wonjun, Choi
> 
> 2015-01-14 15:57 GMT+09:00 Alex Afanasyev <alexander.afanasyev at ucla.edu <mailto:alexander.afanasyev at ucla.edu>>:
> While it is possible to do what you're asking, I would actually suggest a different solution.  You can get the number stored in the name component and print it in readable form, instead of just printing the name.
> 
> For example,
> 
> std::cout << x.get(-1).toSeqNum();
> 
> ---
> Alex
> 
> > On Jan 14, 2015, at 1:40 AM, 최원준 <wonjunchoi001 at gmail.com <mailto:wonjunchoi001 at gmail.com>> wrote:
> >
> > Hello.
> >
> > I want to change prefix name like 1, 2, 3, ... instead of /%00Z ...
> > The code below displays the prefix name.
> > ---------------------------------------------------------------
> > for (int i = 0; i < 300; i++) {
> > ndn::Name x;
> > x.appendSeqNum(i);
> > std::cout << i << " = " << x << std::endl;
> > }
> > return 0;
> > ---------------------------------------------------------------
> > how can I set the prefix like /v1/1, /v1/2, ...?
> >
> > Wonjun, Choi
> > _______________________________________________
> > ndnSIM mailing list
> > ndnSIM at lists.cs.ucla.edu <mailto:ndnSIM at lists.cs.ucla.edu>
> > http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim <http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim>
> 
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20150114/853a2f9c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20150114/853a2f9c/attachment.bin>


More information about the ndnSIM mailing list