<div dir="ltr">Chengb,<div><br></div><div>Perhaps this would help a bit:</div><div><br></div><div>You basically create a callback function with the behavior you want - you pass the function pointer (similar to a delegate method, or closure in some other languages) to the static Schedule method of the Simulator.</div><div><br></div><div>So, you'd create a method like this:</div><div><br></div><div><div><b><font face="monospace, monospace">void</font></b></div><div><b><font face="monospace, monospace">handler(ofstream* outfile, int iteration) </font></b></div><div><b><font face="monospace, monospace">{</font></b></div><div><b><font face="monospace, monospace"> (*outfile)<<"Testing iteration "<<iteration<<std::endl; </font></b></div><div><b><font face="monospace, monospace">}//end handler</font></b></div></div><div><br></div><div><br></div><div>Then, in your scenario, you schedule it to occur at a particular interval:</div><div><br></div><div><b><font face="monospace, monospace">Simulator::Schedule(Seconds(1), &handler, &outfile, i);</font></b><br></div><div><br></div><div>This example is quite trivial, but you can make them arbitrarily complex. I.e., you can, after the initial &handler, pass any of the necessary parameters that your handler takes, to the Schedule method.</div><div><br></div><div>Also, this page might be useful (just search for Schedule) : <a href="http://ndnsim.net/2.4/applications.html">http://ndnsim.net/2.4/applications.html</a></div><div><br></div><div><br></div><div>Thanks,</div><div><br></div><div>John</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 21, 2017 at 11:46 AM, Spyridon (Spyros) Mastorakis <span dir="ltr"><<a href="mailto:mastorakis@cs.ucla.edu" target="_blank">mastorakis@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">Hi,<div><br></div><div>this is some custom functionality that you will have to implement on your own. You can schedule periodic events with the Simulator::Schedule method of NS-3 and iterate over the CS entries with the CS iterators. Take a look here for more details:</div><div><br></div><div><a href="https://www.nsnam.org/doxygen/classns3_1_1_simulator.html#a81c1ade622b5266d81908b2a99a330d2" target="_blank">https://www.nsnam.org/doxygen/<wbr>classns3_1_1_simulator.html#<wbr>a81c1ade622b5266d81908b2a99a33<wbr>0d2</a></div><div><a href="https://github.com/named-data/NFD/blob/master/daemon/table/cs.hpp#L147-L153" target="_blank">https://github.com/named-data/<wbr>NFD/blob/master/daemon/table/<wbr>cs.hpp#L147-L153</a></div><div><br></div><div>Thanks,</div><div><br><div>
<div><div><div><span style="float:none;display:inline!important">Spyridon (Spyros) Mastorakis</span><br><span style="float:none;display:inline!important">Personal Website: </span><a href="http://cs.ucla.edu/~mastorakis/" target="_blank">http://cs.ucla.edu/~<wbr>mastorakis/</a><br><span style="float:none;display:inline!important">Internet Research Laboratory</span><br><span style="float:none;display:inline!important">Computer Science Department</span><br><span style="float:none;display:inline!important">UCLA</span></div><div><br></div></div></div></div><div><div class="h5"><div><blockquote type="cite"><div>On Dec 20, 2017, at 4:35 PM, Chengb Cao <<a href="mailto:chengbcao@gmail.com" target="_blank">chengbcao@gmail.com</a>> wrote:</div><br class="m_4831828181197146721Apple-interchange-newline"><div><div dir="ltr">Hi,all<div><br></div><div>Is there any way to get the CS entries periodically during my simulation, and what methods should i use? </div><div><br></div><div>using ndnSIM 2.4 here.</div><div><br></div><div><br></div><div>Thanks.</div></div></div></blockquote></div><br></div></div></div></div><br>______________________________<wbr>_________________<br>
ndnSIM mailing list<br>
<a href="mailto:ndnSIM@lists.cs.ucla.edu">ndnSIM@lists.cs.ucla.edu</a><br>
<a href="http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim" rel="noreferrer" target="_blank">http://www.lists.cs.ucla.edu/<wbr>mailman/listinfo/ndnsim</a><br>
<br></blockquote></div><br></div>