<div dir="ltr">Hi Alex,<div><br></div><div>Your solution works well. Putting template before <span style="font-size:14px">GetObject<ns3::Node>() solves the whole problem. </span><span style="font-size:14px">Anyway, I will follow you advice and use </span><span style="font-size:14px">Simulator::GetContext() method.</span></div><div>Thank you so much.</div><div><br></div><div>Best regards,</div><div>Saran Tarnoi</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-12-29 17:14 GMT+09:00 Alex Afanasyev <span dir="ltr"><<a href="mailto:aa@cs.ucla.edu" target="_blank">aa@cs.ucla.edu</a>></span>:<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"><div>You may needed to include <ns3/node.h> header file, use full namespace, and add additional C++ syntax sugar needed, given lru-policy is a template class.  I checked and the following should work, but I would still recommend the simpler Simulator::GetContext() method.</div><div><br></div><div>    item->payload()->GetContentStore()->template GetObject<ns3::Node>()->GetId();</div><div><br></div><div>---</div><div>Alex</div><div><div class="h5"><br><div><blockquote type="cite"><div>On Dec 28, 2015, at 7:46 PM, Saran Tarnoi <<a href="mailto:sarantarnoi@gmail.com" target="_blank">sarantarnoi@gmail.com</a>> wrote:</div><br><div><div dir="ltr">Hi Alex,<div><br></div><div>Thanks a lot for your help. However, I cannot get the first solution to work.</div><div>I got this log:</div><div><div>../src/ndnSIM/model/cs/../../utils/trie/lru-policy.hpp:81:72: error: ‘Node’ was not declared in this scope</div><div>../src/ndnSIM/model/cs/../../utils/trie/lru-policy.hpp:81:78: error: expected primary-expression before ‘)’ token</div></div><div><br></div><div>After including "ns3/node.h", I still got the following errors:</div><div><div>../src/ndnSIM/model/cs/../../utils/trie/lru-policy.hpp:82:76: error: expected primary-expression before ‘>’ token</div><div>../src/ndnSIM/model/cs/../../utils/trie/lru-policy.hpp:82:78: error: expected primary-expression before ‘)’ token</div></div><div><br></div><div>I do not know why GetObject<Node>() failed here. Using GetObject<ns3::Node>() did not help either. The compiler did not get it.</div><div>Did I miss something?</div><div><br></div><div>The second solution (Simulator::GetContext()) works well.</div><div><br></div><div>Regards,</div><div>Saran Tarnoi</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-12-29 2:01 GMT+09:00 Alex Afanasyev <span dir="ltr"><<a href="mailto:aa@cs.ucla.edu" target="_blank">aa@cs.ucla.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Hi Saran,</div><div><br></div><div>The solution you found is getting access to nodeId from the ndnSIM 1.0 strategy.  For the caching policy, you can do the following:</div><div><br></div><div>   item->payload()->GetContentStore()->GetObject<Node>()->GetId()</div><div><br></div><div>You can also use the following (cheaty) solution that can work in most of the places:</div><div><br></div><div>   Simulator::GetContext();  // context ID == nodeId</div><div><br></div><div>--</div><div>Alex</div><div><div><br><div><blockquote type="cite"><div>On Dec 28, 2015, at 1:05 AM, Saran Tarnoi <<a href="mailto:sarantarnoi@gmail.com" target="_blank">sarantarnoi@gmail.com</a>> wrote:</div><br><div><div dir="ltr">Dear All,<div><br></div><div>I would like to get node id (or the node name) while being in lru-policy.hpp for logging purpose.</div><div>I am using ndnSIM-2.0. A solution found at <a href="http://www.lists.cs.ucla.edu/pipermail/ndnsim/2014-May/001307.html" target="_blank">http://www.lists.cs.ucla.edu/pipermail/ndnsim/2014-May/001307.html</a> did not work. I have no idea how I can get a pointer to Node from here.</div><div><br></div><div>Could you give me some pieces of advice?<br></div><div><br></div><div>Thanks a lot in advance for your help.<br clear="all"><div><br></div>-- <br><div><div dir="ltr">Best regards,<div>Saran Tarnoi</div></div></div></div></div></div></blockquote></div></div></div></div></blockquote></div>
</div></div>
</div></blockquote></div><br></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Regards,<div>Saran Tarnoi</div><div>Graduate Student</div><div>Department of Informatics</div><div>The Graduate University for Advanced Studies (Sokendai)</div><div>Tokyo, Japan</div></div></div>
</div>