<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">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 class=""><br class=""></div><div class="">    item->payload()->GetContentStore()->template GetObject<ns3::Node>()->GetId();</div><div class=""><br class=""></div><div class="">---</div><div class="">Alex</div><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 28, 2015, at 7:46 PM, 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="">Hi Alex,<div class=""><br class=""></div><div class="">Thanks a lot for your help. However, I cannot get the first solution to work.</div><div class="">I got this log:</div><div class=""><div class="">../src/ndnSIM/model/cs/../../utils/trie/lru-policy.hpp:81:72: error: ‘Node’ was not declared in this scope</div><div class="">../src/ndnSIM/model/cs/../../utils/trie/lru-policy.hpp:81:78: error: expected primary-expression before ‘)’ token</div></div><div class=""><br class=""></div><div class="">After including "ns3/node.h", I still got the following errors:</div><div class=""><div class="">../src/ndnSIM/model/cs/../../utils/trie/lru-policy.hpp:82:76: error: expected primary-expression before ‘>’ token</div><div class="">../src/ndnSIM/model/cs/../../utils/trie/lru-policy.hpp:82:78: error: expected primary-expression before ‘)’ token</div></div><div class=""><br class=""></div><div class="">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 class="">Did I miss something?</div><div class=""><br class=""></div><div class="">The second solution (Simulator::GetContext()) works well.</div><div class=""><br class=""></div><div class="">Regards,</div><div class="">Saran Tarnoi</div><div class=""><br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">2015-12-29 2:01 GMT+09:00 Alex Afanasyev <span dir="ltr" class=""><<a href="mailto:aa@cs.ucla.edu" target="_blank" class="">aa@cs.ucla.edu</a>></span>:<br class=""><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" class=""><div class="">Hi Saran,</div><div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">   item->payload()->GetContentStore()->GetObject<Node>()->GetId()</div><div class=""><br class=""></div><div class="">You can also use the following (cheaty) solution that can work in most of the places:</div><div class=""><br class=""></div><div class="">   Simulator::GetContext();  // context ID == nodeId</div><div class=""><br class=""></div><div class="">--</div><div class="">Alex</div><div class=""><div class="h5"><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 28, 2015, at 1:05 AM, Saran Tarnoi <<a href="mailto:sarantarnoi@gmail.com" target="_blank" class="">sarantarnoi@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Dear All,<div class=""><br class=""></div><div class="">I would like to get node id (or the node name) while being in lru-policy.hpp for logging purpose.</div><div class="">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" class="">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 class=""><br class=""></div><div class="">Could you give me some pieces of advice?<br class=""></div><div class=""><br class=""></div><div class="">Thanks a lot in advance for your help.<br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class=""><div dir="ltr" class="">Best regards,<div class="">Saran Tarnoi</div></div></div></div></div></div></blockquote></div></div></div></div></blockquote></div>
</div></div>
</div></blockquote></div><br class=""></body></html>