[ndnSIM] Question about extending forwarding strategy in ndnSIM

Alex Afanasyev alexander.afanasyev at ucla.edu
Wed Feb 20 09:40:02 PST 2013


Hi Yifeng,

PerOutFaceLimits is a templated class and you can define (almost) any Parent class that PerOutFaceLimits is extending.  Examples of these are in model/fw/per-out-face-limits.cc file: 

template class PerOutFaceLimits<BestRoute>;
typedef PerOutFaceLimits<BestRoute> PerOutFaceLimitsBestRoute;
NS_OBJECT_ENSURE_REGISTERED (PerOutFaceLimitsBestRoute);


If you want to extend the limits class, you have several options.  You can do it in a templated way:

template<class Parent>
class Extension : public PerOutFaceLimits<Parent>
...

or you if you know what is the base strategy you want to use with limiting, you can just specialize your extension:

class Extension : public PerOutFaceLimits<BestRoute>
...


If the parent class that you're using is inherited from Nacks class (most of the strategies do: http://ndnsim.net/doxygen/classns3_1_1ndn_1_1_forwarding_strategy.html), then you can directly override any method defined in Nacks class in your extension.   That is, in one extension class you can combine modifications for limits and nacks.

---
Alex

On Feb 20, 2013, at 6:19 AM, Yifeng Li <yifengl at email.arizona.edu> wrote:

> Hello Alex,
> 
> I noticed per-out-face-limits extend Parent, where is Parent defined? I also, if I extend per out face limits, do I also have to extend Nacks as well? There seems to be inheritance conflicts if I extend both.
> 
> Thanks for your help,
> Yifeng

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20130220/57db3292/attachment.html>


More information about the ndnSIM mailing list