<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 Nov 6, 2015, at 5:28 AM, Saran Tarnoi <<a href="mailto:sarantarnoi@gmail.com" class="">sarantarnoi@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Dear All,<div class=""><br class=""></div><div class="">I want to add a new cache replacement policy to ndnSIM. Until now, I have been hard-coding existing files, such as lru-policy.h, to get a desired result. This method is obviously inefficient for real simulation.</div><div class=""><br class=""></div><div class="">I would like to have a separate new policy file and make it callable from scenario files through a configuration in ndnHealper. For example, the following line of a scenario file allows CS to run NewPolicy.</div><div class=""><pre style="padding: 5px; line-height: 17.6000003814697px; border-top-width: 1px; border-bottom-width: 1px; border-style: solid none; border-top-color: rgb(170, 204, 153); border-bottom-color: rgb(170, 204, 153); font-size: 15px; text-align: justify;" class=""><span class="">ndnHelper</span><span class="">.</span><span class="">SetOldContentStore</span><span class="">(</span><span class="" style="color:rgb(64,112,160)">"ns3::ndn::cs::NewPolicy"</span><span class="">,</span> <span class="" style="color:rgb(64,112,160)">"MaxSize"</span><span class="">,</span> <span class="" style="color:rgb(64,112,160)">"10000"</span><span class="">);</span></pre></div><div class=""><br class=""></div><div class="">Which files do I should modify to get this ability?</div></div></div></blockquote><div><br class=""></div><div>Hi Saran,</div><div><br class=""></div><div>Just create your new policy file, and then in src/ndnSIM/model/cs/content-store-impl.cpp  add the following:</div><div><br class=""></div><div>template class ContentStoreImpl<your_policy_traits>;</div><div><div>NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, your_policy_traits);</div></div><div><br class=""></div><div>Essentially, you need to instantiate a new content policy class with your policy.  After the class is instantiated, you can use it in ndnHelper.</div><div><br class=""></div>--</div><div>Alex</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">Your answers will be highly appreciated. </div><div class="">Thank you. </div><div class=""><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature"><div dir="ltr" class="">Yours sincerely,<div class="">Saran</div></div></div></div></div></div></blockquote></div></body></html>