[ndnSIM] ndnsim packet change.
alexander.afanasyev at ucla.edu
Thu Jun 20 09:10:05 PDT 2013
There is a good chance that PIT is not exactly the right place to update interests, since it is really suppose to store only const reference to interest, which is used only for lookup purposes. Changing it to non-const could result in many unexpected results (side effects). If you really need to make a copy, which you can easily update, you xan use the following:
Ptr<Interest> rwInterest = Create<Interest> (*origInterest);
What you ideally want to do is to weite a forwarding strategy extension, in which you can override some methods/events, and there is a straightforward wag to update interest, since forwarding strategy is the one who owns the interest (non-const pointer).
On Jun 20, 2013, at 7:45 AM, ioannoa at scss.tcd.ie wrote:
> Hello everyone,
> I have been struggling for a few days trying to change a field into my
> packet, but didn't get any luck, so i thought to ask for help.
> I am trying to alter the function into the Pit implementation class named
> Create. My issue is that i want to change a field into my interest packet,
> which is passed as a parameter to this Create function as: Ptr<const
> Interest> interest. I have tried copy constructors, const_cast without
> working though and only managed to change the value into the current
> function. But what i want is my interest packet to have these changes
> afterwards as well so sth temporal inside the function is not helping
> much. An obvious way would be to change the function into passing
> Ptr<Interest> interest without the const but that gives me many other
> classes using it that way, so have to change them as well etc. before
> starting breaking the whole platform down, maybe you have some
> alternatives i could use?
> Kind regards,
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
More information about the ndnSIM