<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 6, 2017, at 7:14 PM, John Baugh <<a href="mailto:jpbaugh@umich.edu" class="">jpbaugh@umich.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="auto" class=""><div class="">Alex,<div dir="auto" class=""><br class=""></div><div dir="auto" class="">When you say that the strategies aren't intended to be overridden, do you mean those such as MulticastStrategy?</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">I assume Strategy will still be overridable.</div></div></div></div></blockquote><div><br class=""></div><div>Sorry for the confusion.  Yes, I meant only strategy instances such as MulticastStrategy. Strategy is a base class and, of course, will be overridable.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div class=""><div dir="auto" class="">My entire purpose for this code isn't to actually modify the strategy, but to be able to use an existing strategy, with some logging / data collection occurring.</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">I'm ultimately going to use the data collected about interests in the Policy.  So the classes will have to interact.  </div></div></div></div></blockquote><div><br class=""></div><div>You could just copy the code of the strategy and modify that.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div class=""><div dir="auto" class="">Also, from your description, I now assume STRATEGY_NAME must have that exact name, and is used elsewhere besides just setting the default parameter?  Is this behavior / requirement documented anywhere?</div></div></div></div></blockquote><div><br class=""></div><div>I am not sure what you mean here.  The upcoming changes (already pushed to master branch of official NFD repo) include a few changes on how strategy name can be used, including passing additional parameters.  Though, not sure if this was your question.</div><div><br class=""></div><div>--</div><div>Alex</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div class=""><div dir="auto" class=""><br class=""></div><div dir="auto" class="">Thanks,</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">John</div><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Jan 6, 2017 7:40 PM, "Alex Afanasyev" <<a href="mailto:aa@cs.ucla.edu" class="">aa@cs.ucla.edu</a>> wrote:<br type="attribution" class=""><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">Here is a quick patch to "fix" the issue.  It is a requirement to have STRATEGY_NAME **as a static variable** in the strategy class.  Otherwise, strategy is simply not being registered properly.</div><div class=""><br class=""></div><div class="">Also, while possible right now, the strategies are not designed to be overridden.  In the upcoming release, it would result in compilation error.</div><div class=""><br class=""></div><div class="">--</div><div class="">Alex</div><div class=""><br class=""></div><div class="">================= begin patch =====================</div><div class=""><div class="">diff --git a/extensions/<wbr class="">PopularityStrategy.cpp b/extensions/<wbr class="">PopularityStrategy.cpp</div><div class="">index ecae694..36cc08a 100644</div><div class="">--- a/extensions/<wbr class="">PopularityStrategy.cpp</div><div class="">+++ b/extensions/<wbr class="">PopularityStrategy.cpp</div><div class="">@@ -5,11 +5,12 @@ using namespace std;</div><div class=""> namespace nfd {</div><div class=""> namespace fw {</div><div class=""><br class=""></div><div class="">-//const ndn::Name PopularityStrategy::STRATEGY_<wbr class="">NAME = "ndn:/localhost/nfd/strategy/<wbr class="">popularity-strategy";</div><div class="">+const ndn::Name PopularityStrategy::STRATEGY_<wbr class="">NAME = "ndn:/localhost/nfd/strategy/<wbr class="">popularity-strategy";</div><div class=""><br class=""></div><div class=""> NFD_REGISTER_STRATEGY(<wbr class="">PopularityStrategy);</div><div class=""><br class=""></div><div class="">-PopularityStrategy::<wbr class="">PopularityStrategy(Forwarder& forwarder, const Name& name) : MulticastStrategy(forwarder, name)</div><div class="">+PopularityStrategy::<wbr class="">PopularityStrategy(Forwarder& forwarder, const Name& name)</div><div class="">+  : MulticastStrategy(forwarder, name)</div><div class=""> {</div><div class="">    cout<<"Inside ctor for PopularityStrategy"<<endl;</div><div class=""> }//end ctor</div><div class="">@@ -20,7 +21,7 @@ PopularityStrategy::<wbr class="">afterReceiveInterest(const Face& inFace,</div><div class="">                                const shared_ptr<pit::Entry>& pitEntry)</div><div class=""> {</div><div class="">   //behave just like the multicast strategy</div><div class="">-  MulticastStrategy::<wbr class="">afterReceiveInterest(inFace, interest, pitEntry);</div><div class="">+  // MulticastStrategy::<wbr class="">afterReceiveInterest(inFace, interest, pitEntry);</div><div class=""><br class=""></div><div class="">   //also, maintain popularity eventually</div><div class="">   cout<<"In afterReceiveInterest, with interest: "<<interest.getName().toUri()<<wbr class=""><endl;</div><div class="">diff --git a/extensions/<wbr class="">PopularityStrategy.hpp b/extensions/<wbr class="">PopularityStrategy.hpp</div><div class="">index 4a0e6b4..447be49 100644</div><div class="">--- a/extensions/<wbr class="">PopularityStrategy.hpp</div><div class="">+++ b/extensions/<wbr class="">PopularityStrategy.hpp</div><div class="">@@ -9,8 +9,6 @@</div><div class=""> namespace nfd {</div><div class=""> namespace fw {</div><div class=""><br class=""></div><div class="">-const ndn::Name STRATEGY_NAME("ndn:/localhost/<wbr class="">nfd/strategy/popularity-<wbr class="">strategy");</div><div class="">-</div><div class=""> class PopularityStrategy : public MulticastStrategy {</div><div class=""><br class=""></div><div class=""> public:</div><div class="">@@ -20,7 +18,7 @@ public:</div><div class="">   afterReceiveInterest(const Face& inFace, const Interest& interest,</div><div class="">                        const shared_ptr<pit::Entry>& pitEntry);</div><div class=""><br class=""></div><div class="">-  //static const ndn::Name STRATEGY_NAME("ndn:/localhost/<wbr class="">nfd/strategy/popularity-<wbr class="">strategy")</div><div class="">+  static const ndn::Name STRATEGY_NAME;</div></div><div class=""><br class=""></div><div class="">================== end patch =======================</div><div class="elided-text"><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 6, 2017, at 1:37 PM, John Baugh <<a href="mailto:jpbaugh@umich.edu" target="_blank" class="">jpbaugh@umich.edu</a>> wrote:</div><br class="m_-4924288599263907378Apple-interchange-newline"><div class=""><div dir="auto" class="">Alex and ndnSIM friends,<div dir="auto" class=""><br class=""></div><div dir="auto" class="">Anyone get a chance to look at this?  I am truly at a loss.</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Jan 5, 2017 10:00 PM, "John Baugh" <<a href="mailto:jpbaugh@umich.edu" target="_blank" class="">jpbaugh@umich.edu</a>> wrote:<br type="attribution" class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">Alex,<div class=""><br class=""></div><div class="">I think I've got this right.  Let me know if you have any problems downloading the necessary files:</div><div class=""><br class=""></div><div class=""><a href="https://github.com/profjpbaugh/ndnSIM-strategy1" target="_blank" class="">https://github.com/profjpbaugh<wbr class="">/ndnSIM-strategy1</a><br class=""></div><div class=""><br class=""></div><div class="">Thanks,</div><div class=""><br class=""></div><div class="">John</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Jan 5, 2017 at 8:54 PM, Alex Afanasyev <span dir="ltr" class=""><<a href="mailto:aa@cs.ucla.edu" target="_blank" class="">aa@cs.ucla.edu</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">If you can share you scenario repo on github, it would be much easier.  As I will be able to compile and try to run the code.<div class=""><br class=""></div><div class="">--</div><div class="">Alex</div><div class=""><div class="m_-4924288599263907378m_-9148395641109916029h5"><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 5, 2017, at 5:34 PM, John Baugh <<a href="mailto:jpbaugh@umich.edu" target="_blank" class="">jpbaugh@umich.edu</a>> wrote:</div><br class="m_-4924288599263907378m_-9148395641109916029m_-1910193608114765741Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class="">Alex and others,<br class=""><br class=""></div>I have updated the code:<br class=""><a href="https://drive.google.com/open?id=0By9ufeKqmJYYY3Rzem5EN0ZyREE" target="_blank" class="">https://drive.google.com/open?<wbr class="">id=0By9ufeKqmJYYY3Rzem5EN0ZyRE<wbr class="">E</a><br class=""><br class=""></div>I even included the PolicyToFile class that does successfully print content store related things to the file.<br class=""><br class=""></div>But even after adding GlobalRoutingHelper functions, I cannot get this to work.  I'll assume it's not a problem related to me subclassing MulticastStrategy rather than Strategy, is it?<br class=""><br class=""></div>But, I'm doing everything that is in the example on ndnSIM's website.  I used the RandomLoadBalancer as my example.  It still isn't working.<br class=""><br class=""></div>I'm not even at the point where I'm doing much with the actual interests...  I just want to print out information when an interest is received, and when the object is created initially (i.e., when the ctor is called.)<br class=""><br class=""></div>Any help would be greatly appreciated, as always.  If anyone could run the code and see if you can figure out what's going on, I'd be very appeciative (make a umd subdirectory for the Policy class .hpp and .cpp, or change around the includes - doesn't matter, of course)<br class=""><br class=""></div>Thanks,<br class=""><br class=""></div>John<br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Jan 5, 2017 at 2:47 AM, Alex Afanasyev <span dir="ltr" class=""><<a href="mailto:aa@cs.ucla.edu" target="_blank" class="">aa@cs.ucla.edu</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">I think you forgot to configure FIBs, e.g., using GlobalRoutingHelper.<div class=""><br class=""></div><div class="">---</div><div class="">Alex<br class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class=""><div class="m_-4924288599263907378m_-9148395641109916029m_-1910193608114765741h5"><div class="">On Jan 4, 2017, at 11:42 PM, John Baugh <<a href="mailto:jpbaugh@umich.edu" target="_blank" class="">jpbaugh@umich.edu</a>> wrote:</div><br class="m_-4924288599263907378m_-9148395641109916029m_-1910193608114765741m_8144265927015679974Apple-interchange-newline"></div></div><div class=""><div class=""><div class="m_-4924288599263907378m_-9148395641109916029m_-1910193608114765741h5"><div dir="ltr" class="">ndnSIM friends,<div class=""><br class=""></div><div class="">I am continuing a previous attempt at creating a Custom Strategy, for the primary purpose of recording information on Interests as they arrive at a router.</div><div class=""><br class=""></div><div class="">The three involved files, linked in my Google Drive are:</div><div class=""><br class=""></div><div class="">1. <b class="">The scenario file:</b>   (jpb-strategy1-test.cpp)</div><div class="">     <a href="https://drive.google.com/open?id=0By9ufeKqmJYYWXNpbEFYSEI2VWc" target="_blank" class="">https://drive.google.com/open<wbr class="">?id=0By9ufeKqmJYYWXNpbEFYSEI2V<wbr class="">Wc</a></div><div class=""><br class=""></div><div class="">2. <b class="">The PopularityStrategy.hpp file</b> with my custom strategy specification</div><div class="">     <a href="https://drive.google.com/open?id=0By9ufeKqmJYYQm5BQVRSQzNjSnc" target="_blank" class="">https://drive.google.com/open<wbr class="">?id=0By9ufeKqmJYYQm5BQVRSQzNjS<wbr class="">nc</a></div><div class=""><br class=""></div><div class="">3.  <b class="">The PopularityStrategy.cpp file</b> with the implementation of the custom strategy class</div><div class="">      <a href="https://drive.google.com/open?id=0By9ufeKqmJYYcTFXc1ZUcnpfQTA" target="_blank" class="">https://drive.google.com/open?<wbr class="">id=0By9ufeKqmJYYcTFXc1ZUcnpfQT<wbr class="">A</a></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Notes:</div><div class="">- I have the scenario file in the <b class="">scenarios</b> directory (I'm using the template from GitHub)</div><div class="">- I have the PopularityStrategy.[hpp,cpp] files in the <b class="">extensions </b>directory</div><div class="">- I subclassed MulticastStrategy to create the PopularityStrategy</div><div class="">- I did call NFD_REGISTER_STRATEGY at the top of the PopularityStrategy.cpp file</div><div class=""><br class=""></div><div class="">Everything compiles just fine, but I get <b class="">no printout from the PopularityStrategy </b>class.  I have cout<< inside both the constructor and the afterReceiveInterest function.</div><div class=""><br class=""></div><div class="">It's as if it's not being used at all.  </div><div class=""><br class=""></div><div class="">I am very much at a loss, and would greatly appreciate assistance on this.  It's close.  I can feel it.  :)</div><div class=""><br class=""></div><div class="">Thanks,</div><div class=""><br class=""></div><div class="">John</div><div class=""><br class=""></div><div class=""><br class=""></div></div></div></div>
______________________________<wbr class="">_________________<br class="">ndnSIM mailing list<br class=""><a href="mailto:ndnSIM@lists.cs.ucla.edu" target="_blank" class="">ndnSIM@lists.cs.ucla.edu</a><br class=""><a href="http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim" target="_blank" class="">http://www.lists.cs.ucla.edu/m<wbr class="">ailman/listinfo/ndnsim</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div>


</div></blockquote></div><br class=""></div></div></div></div></blockquote></div><br class=""></div>
</blockquote></div></div>
</div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></div>
</div></blockquote></div><br class=""></body></html>