<div dir="auto"><div>Alex,<div dir="auto"><br></div><div dir="auto">When you say that the strategies aren't intended to be overridden, do you mean those such as MulticastStrategy?</div><div dir="auto"><br></div><div dir="auto">I assume Strategy will still be overridable.</div><div dir="auto"><br></div><div dir="auto">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"><br></div><div dir="auto">I'm ultimately going to use the data collected about interests in the Policy.  So the classes will have to interact.  </div><div dir="auto"><br></div><div dir="auto">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 dir="auto"><br></div><div dir="auto">Thanks,</div><div dir="auto"><br></div><div dir="auto">John</div><br><div class="gmail_extra"><br><div class="gmail_quote">On Jan 6, 2017 7:40 PM, "Alex Afanasyev" <<a href="mailto:aa@cs.ucla.edu">aa@cs.ucla.edu</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>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><br></div><div>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><br></div><div>--</div><div>Alex</div><div><br></div><div>================= begin patch =====================</div><div><div>diff --git a/extensions/<wbr>PopularityStrategy.cpp b/extensions/<wbr>PopularityStrategy.cpp</div><div>index ecae694..36cc08a 100644</div><div>--- a/extensions/<wbr>PopularityStrategy.cpp</div><div>+++ b/extensions/<wbr>PopularityStrategy.cpp</div><div>@@ -5,11 +5,12 @@ using namespace std;</div><div> namespace nfd {</div><div> namespace fw {</div><div><br></div><div>-//const ndn::Name PopularityStrategy::STRATEGY_<wbr>NAME = "ndn:/localhost/nfd/strategy/<wbr>popularity-strategy";</div><div>+const ndn::Name PopularityStrategy::STRATEGY_<wbr>NAME = "ndn:/localhost/nfd/strategy/<wbr>popularity-strategy";</div><div><br></div><div> NFD_REGISTER_STRATEGY(<wbr>PopularityStrategy);</div><div><br></div><div>-PopularityStrategy::<wbr>PopularityStrategy(Forwarder& forwarder, const Name& name) : MulticastStrategy(forwarder, name)</div><div>+PopularityStrategy::<wbr>PopularityStrategy(Forwarder& forwarder, const Name& name)</div><div>+  : MulticastStrategy(forwarder, name)</div><div> {</div><div>    cout<<"Inside ctor for PopularityStrategy"<<endl;</div><div> }//end ctor</div><div>@@ -20,7 +21,7 @@ PopularityStrategy::<wbr>afterReceiveInterest(const Face& inFace,</div><div>                                const shared_ptr<pit::Entry>& pitEntry)</div><div> {</div><div>   //behave just like the multicast strategy</div><div>-  MulticastStrategy::<wbr>afterReceiveInterest(inFace, interest, pitEntry);</div><div>+  // MulticastStrategy::<wbr>afterReceiveInterest(inFace, interest, pitEntry);</div><div><br></div><div>   //also, maintain popularity eventually</div><div>   cout<<"In afterReceiveInterest, with interest: "<<interest.getName().toUri()<<wbr><endl;</div><div>diff --git a/extensions/<wbr>PopularityStrategy.hpp b/extensions/<wbr>PopularityStrategy.hpp</div><div>index 4a0e6b4..447be49 100644</div><div>--- a/extensions/<wbr>PopularityStrategy.hpp</div><div>+++ b/extensions/<wbr>PopularityStrategy.hpp</div><div>@@ -9,8 +9,6 @@</div><div> namespace nfd {</div><div> namespace fw {</div><div><br></div><div>-const ndn::Name STRATEGY_NAME("ndn:/localhost/<wbr>nfd/strategy/popularity-<wbr>strategy");</div><div>-</div><div> class PopularityStrategy : public MulticastStrategy {</div><div><br></div><div> public:</div><div>@@ -20,7 +18,7 @@ public:</div><div>   afterReceiveInterest(const Face& inFace, const Interest& interest,</div><div>                        const shared_ptr<pit::Entry>& pitEntry);</div><div><br></div><div>-  //static const ndn::Name STRATEGY_NAME("ndn:/localhost/<wbr>nfd/strategy/popularity-<wbr>strategy")</div><div>+  static const ndn::Name STRATEGY_NAME;</div></div><div><br></div><div>================== end patch =======================</div><div class="elided-text"><br><div><blockquote type="cite"><div>On Jan 6, 2017, at 1:37 PM, John Baugh <<a href="mailto:jpbaugh@umich.edu" target="_blank">jpbaugh@umich.edu</a>> wrote:</div><br class="m_-4924288599263907378Apple-interchange-newline"><div><div dir="auto">Alex and ndnSIM friends,<div dir="auto"><br></div><div dir="auto">Anyone get a chance to look at this?  I am truly at a loss.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Jan 5, 2017 10:00 PM, "John Baugh" <<a href="mailto:jpbaugh@umich.edu" target="_blank">jpbaugh@umich.edu</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Alex,<div><br></div><div>I think I've got this right.  Let me know if you have any problems downloading the necessary files:</div><div><br></div><div><a href="https://github.com/profjpbaugh/ndnSIM-strategy1" target="_blank">https://github.com/profjpbaugh<wbr>/ndnSIM-strategy1</a><br></div><div><br></div><div>Thanks,</div><div><br></div><div>John</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 5, 2017 at 8:54 PM, Alex Afanasyev <span dir="ltr"><<a href="mailto:aa@cs.ucla.edu" target="_blank">aa@cs.ucla.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">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><br></div><div>--</div><div>Alex</div><div><div class="m_-4924288599263907378m_-9148395641109916029h5"><div><br><div><blockquote type="cite"><div>On Jan 5, 2017, at 5:34 PM, John Baugh <<a href="mailto:jpbaugh@umich.edu" target="_blank">jpbaugh@umich.edu</a>> wrote:</div><br class="m_-4924288599263907378m_-9148395641109916029m_-1910193608114765741Apple-interchange-newline"><div><div dir="ltr"><div><div><div><div><div><div><div><div>Alex and others,<br><br></div>I have updated the code:<br><a href="https://drive.google.com/open?id=0By9ufeKqmJYYY3Rzem5EN0ZyREE" target="_blank">https://drive.google.com/open?<wbr>id=0By9ufeKqmJYYY3Rzem5EN0ZyRE<wbr>E</a><br><br></div>I even included the PolicyToFile class that does successfully print content store related things to the file.<br><br></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><br></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><br></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><br></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><br></div>Thanks,<br><br></div>John<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 5, 2017 at 2:47 AM, Alex Afanasyev <span dir="ltr"><<a href="mailto:aa@cs.ucla.edu" target="_blank">aa@cs.ucla.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">I think you forgot to configure FIBs, e.g., using GlobalRoutingHelper.<div><br></div><div>---</div><div>Alex<br><div><br><div><blockquote type="cite"><div><div class="m_-4924288599263907378m_-9148395641109916029m_-1910193608114765741h5"><div>On Jan 4, 2017, at 11:42 PM, John Baugh <<a href="mailto:jpbaugh@umich.edu" target="_blank">jpbaugh@umich.edu</a>> wrote:</div><br class="m_-4924288599263907378m_-9148395641109916029m_-1910193608114765741m_8144265927015679974Apple-interchange-newline"></div></div><div><div><div class="m_-4924288599263907378m_-9148395641109916029m_-1910193608114765741h5"><div dir="ltr">ndnSIM friends,<div><br></div><div>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><br></div><div>The three involved files, linked in my Google Drive are:</div><div><br></div><div>1. <b>The scenario file:</b>   (jpb-strategy1-test.cpp)</div><div>     <a href="https://drive.google.com/open?id=0By9ufeKqmJYYWXNpbEFYSEI2VWc" target="_blank">https://drive.google.com/open<wbr>?id=0By9ufeKqmJYYWXNpbEFYSEI2V<wbr>Wc</a></div><div><br></div><div>2. <b>The PopularityStrategy.hpp file</b> with my custom strategy specification</div><div>     <a href="https://drive.google.com/open?id=0By9ufeKqmJYYQm5BQVRSQzNjSnc" target="_blank">https://drive.google.com/open<wbr>?id=0By9ufeKqmJYYQm5BQVRSQzNjS<wbr>nc</a></div><div><br></div><div>3.  <b>The PopularityStrategy.cpp file</b> with the implementation of the custom strategy class</div><div>      <a href="https://drive.google.com/open?id=0By9ufeKqmJYYcTFXc1ZUcnpfQTA" target="_blank">https://drive.google.com/open?<wbr>id=0By9ufeKqmJYYcTFXc1ZUcnpfQT<wbr>A</a></div><div><br></div><div><br></div><div>Notes:</div><div>- I have the scenario file in the <b>scenarios</b> directory (I'm using the template from GitHub)</div><div>- I have the PopularityStrategy.[hpp,cpp] files in the <b>extensions </b>directory</div><div>- I subclassed MulticastStrategy to create the PopularityStrategy</div><div>- I did call NFD_REGISTER_STRATEGY at the top of the PopularityStrategy.cpp file</div><div><br></div><div>Everything compiles just fine, but I get <b>no printout from the PopularityStrategy </b>class.  I have cout<< inside both the constructor and the afterReceiveInterest function.</div><div><br></div><div>It's as if it's not being used at all.  </div><div><br></div><div>I am very much at a loss, and would greatly appreciate assistance on this.  It's close.  I can feel it.  :)</div><div><br></div><div>Thanks,</div><div><br></div><div>John</div><div><br></div><div><br></div></div></div></div>
______________________________<wbr>_________________<br>ndnSIM mailing list<br><a href="mailto:ndnSIM@lists.cs.ucla.edu" target="_blank">ndnSIM@lists.cs.ucla.edu</a><br><a href="http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim" target="_blank">http://www.lists.cs.ucla.edu/m<wbr>ailman/listinfo/ndnsim</a><br></div></blockquote></div><br></div></div></div></blockquote></div><br></div>


</div></blockquote></div><br></div></div></div></div></blockquote></div><br></div>
</blockquote></div></div>
</div></blockquote></div><br></div></div></blockquote></div><br></div></div></div>