[ndnSIM] Ways to create new Interest object

Mudasir Qazi mudasirqazi00 at gmail.com
Tue Apr 3 08:20:04 PDT 2018


Hi,

*My requirement:*
I need to create new Interest from an existing Interest so that all
properties will be copied to newly created Interest, than I need to set its
name using setName method. I know following two ways to do this:

*Method #1:* Creating empty Interest and setting name like this:
const Name& tempName = "---";
shared_ptr<Interest> tempInterest = make_shared<Interest>();
tempInterest->setName(tempName);
This method does not copy other properties, but only creates empty Interest
and sets its name. And it works fine.

*Method #2:* Creating Interest from an existing Interest like this:
const Name& tempName = "---";
Interest tempInterest = Interest(interest.wireEncode());
tempInterest.setName(tempName);

*My problem:*
Now, I know Method#2 is the official way that meets my requirements. But
the thing is, when I use method#2 it gives error on *findOrInsert* method
in *pit.cpp* file and I don't understand its reason.
auto entry = make_shared<Entry>(interest);

Can anybody help me with this? Why I'm getting this error? Which method
should I continue with?

-- 
Regards,
Mudasir Qazi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20180403/bb76fb9e/attachment.html>


More information about the ndnSIM mailing list