[ndnSIM] How to traverse CS and add a vector in a tag?

Alex Afanasyev alexander.afanasyev at ucla.edu
Fri Feb 14 15:40:48 PST 2014


Hi Teng,

I'm a little bit confused do you need specifically to traverse the specific policy container from strategy or you just need to iterate items within the specific policy?

If within the strategy, there probably no general way to do policy-specific traversal, but you can just traverse all items in content store using ContentStore's iterators:

Ptr<ContentStore> cs = this->GetObject<ContentStore>();
for (Ptr<cs::Entry> i = cs->Begin(); i != cs->End(); i = cs->Next(i))
{
   ...
}

If it is within the policy, then boost::intrusive::multiset has standard STL interface to do the traversal:

for (typename policy_container::iterator i = this->begin(); i != this->end(); i++)
{
   Ptr<cs::Entry> entry = i->payload();
   ...
}


I also not sure what do you mean by "a tag of data". Are you referring to NS-3's packet tags?  Unfortunately, as they are implemented right now, there is very little space available for each tag, and you need to implemented Serialize/Deserialize methods.

---
Alex

On Feb 12, 2014, at 5:14 AM, Teng <tengmingnianzbb at 163.com> wrote:

> Hi Alex,
> 
> I am a new to ndnsim, now I wanna traverse CS ,and I think it is to traverse the vector in a replacement policy.Just as in lfu policy, how can I traverse the policy_container  (typedef boost::intrusive::multiset< Container,boost::intrusive::compare< MemberHookLess< Container > >,Hook > policy_container)?
> 
> And I wonder how to add a vector into a tag of data? For example,I would like  to make a vector to record m_hopCount,if a node cached data,it will add the current m_hopCount into the vector, so every node will know the distances from upstream nodes caching the data according to the vector in tag of data.
> 
> Would you please give me some hint?
> 
> Best Regards!
> 
> 
> 
> 
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20140214/c4b5ed3c/attachment.html>


More information about the ndnSIM mailing list