[ndnSIM] How to get node id in lru-policy.hpp

Saran Tarnoi sarantarnoi at gmail.com
Mon Dec 28 19:46:41 PST 2015


Hi Alex,

Thanks a lot for your help. However, I cannot get the first solution to
work.
I got this log:
../src/ndnSIM/model/cs/../../utils/trie/lru-policy.hpp:81:72: error: ‘Node’
was not declared in this scope
../src/ndnSIM/model/cs/../../utils/trie/lru-policy.hpp:81:78: error:
expected primary-expression before ‘)’ token

After including "ns3/node.h", I still got the following errors:
../src/ndnSIM/model/cs/../../utils/trie/lru-policy.hpp:82:76: error:
expected primary-expression before ‘>’ token
../src/ndnSIM/model/cs/../../utils/trie/lru-policy.hpp:82:78: error:
expected primary-expression before ‘)’ token

I do not know why GetObject<Node>() failed here. Using
GetObject<ns3::Node>() did not help either. The compiler did not get it.
Did I miss something?

The second solution (Simulator::GetContext()) works well.

Regards,
Saran Tarnoi


2015-12-29 2:01 GMT+09:00 Alex Afanasyev <aa at cs.ucla.edu>:

> Hi Saran,
>
> The solution you found is getting access to nodeId from the ndnSIM 1.0
> strategy.  For the caching policy, you can do the following:
>
>    item->payload()->GetContentStore()->GetObject<Node>()->GetId()
>
> You can also use the following (cheaty) solution that can work in most of
> the places:
>
>    Simulator::GetContext();  // context ID == nodeId
>
> --
> Alex
>
> On Dec 28, 2015, at 1:05 AM, Saran Tarnoi <sarantarnoi at gmail.com> wrote:
>
> Dear All,
>
> I would like to get node id (or the node name) while being in
> lru-policy.hpp for logging purpose.
> I am using ndnSIM-2.0. A solution found at
> http://www.lists.cs.ucla.edu/pipermail/ndnsim/2014-May/001307.html did
> not work. I have no idea how I can get a pointer to Node from here.
>
> Could you give me some pieces of advice?
>
> Thanks a lot in advance for your help.
>
> --
> Best regards,
> Saran Tarnoi
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20151229/a1a5ce1a/attachment.html>


More information about the ndnSIM mailing list