<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hi Wassim,</div><div><br></div><div>Cache is organized as a hash-based container, so it is expected that entries are not in any particular order.  To get access to policy-based ordering (FIFO in your case), you would need a little bit more complex code.  Here is a basic example:</div><div><br></div><div><div>#include "ns3/ndnSIM/model/cs/content-store-impl.h"</div><div>#include "ns3/ndnSIM/utils/trie/fifo-policy.h"</div><div>#include "ns3/ndnSIM/utils/trie/random-policy.h"</div></div><div><br></div><div>...</div><div><br></div><div><br></div><div><div>  // typedef ns3::ndn::ndnSIM::random_policy_traits policy;</div><div>  typedef ns3::ndn::ndnSIM::fifo_policy_traits policy;</div><div>  </div><div>  typedef ns3::ndn::cs::ContentStoreImpl<policy> CS;</div><div>  typedef CS::super::policy_container Policy;</div><div><br></div><div>  Ptr<CS> cs = DynamicCast<CS> (NodeList::GetNode(1)->GetObject<ndn::ContentStore> ());</div><div>  if (!cs)</div><div>    {</div><div>      std::cerr << "Please select the right CS policy" << std::endl;</div><div>      exit (1);</div><div>    }</div><div><br></div><div>  for (Policy::iterator it = cs->GetPolicy().begin ();</div><div>       it != cs->GetPolicy().end();</div><div>       it++)</div><div>    {</div><div>      std::cout << it->payload()->GetName() << std::endl;</div><div>    }</div></div><div><br></div><div>---</div><div>Alex</div><br><div><div>On Nov 17, 2013, at 3:37 AM, Wassim Drira <<a href="mailto:drirawassim+ndnsim@gmail.com">drirawassim+ndnsim@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div><div>Hi all,<br></div><div><br></div><div><span style="font-family:arial,helvetica,sans-serif">I am using </span><span style="font-family:courier new,monospace"><span style="font-family:arial,helvetica,sans-serif">ContentStore
 to store some msgs in reception order. I am using the fifo variant. The
 issue is when printing the content of the cache, it looks not ordered 
as you can see below (sequence number in the end of the name)</span>.<br>
<br></span></div><div><span style="font-family:courier new,monospace"><span style="font-family:arial,helvetica,sans-serif">Do you have an idea about the cause and may be a solution to this issue...</span><br></span></div>


<div><span style="font-family:courier new,monospace"><br></span></div><b>%%%%%%%% ----- Code ----- %%%%%%%</b><br><span style="font-family:courier new,monospace">ObjectFactory m_contentStoreFactory;<br>m_contentStoreFactory.SetTypeId ("ns3::ndn::cs::Stats::Fifo");<br>


m_contentStoreFactory.Set("MaxSize", StringValue ("50"));<br>m_pubCS = m_contentStoreFactory.Create<ContentStore> ();<br>......<br>Ptr<ns3::ndn::cs::Entry> entry = m_pubCS->Begin();<br>

while(entry){<br>
        NS_LOG_DEBUG("Cache Entry:"<< entry->GetData()->GetName());<br>        entry = m_pubCS->Next(entry);<br>}</span><br><b>%%%%%%%% ----- OutPut ----- %%%%%%%</b><br>18.0186s 1 ndn.ANode:OnMsg(): [DEBUG] Cache Entry:/news/2/%00%02<br>


18.0186s 1 ndn.ANode:OnMsg(): [DEBUG] Cache Entry:/news/2/%00%01<br>18.0186s 1 ndn.ANode:OnMsg(): [DEBUG] Cache Entry:/news/2/%00%04<br>18.0186s 1 ndn.ANode:OnMsg(): [DEBUG] Cache Entry:/news/2/%00%03<br>18.0186s 1 ndn.ANode:OnMsg(): [DEBUG] Cache Entry:/news/2/%00%06<br>


18.0186s 1 ndn.ANode:OnMsg(): [DEBUG] Cache Entry:/news/2/%00%05<br>18.0186s 1 ndn.ANode:OnMsg(): [DEBUG] Cache Entry:/news/2/%00%08<br>18.0186s 1 ndn.ANode:OnMsg(): [DEBUG] Cache Entry:/news/2/%00%07<br>18.0186s 1 ndn.ANode:OnMsg(): [DEBUG] Cache Entry:/news/2/%00%0A<br>


18.0186s 1 ndn.ANode:OnMsg(): [DEBUG] Cache Entry:/news/2/%00%09<br>18.0186s 1 ndn.ANode:OnMsg(): [DEBUG] Cache Entry:/news/2/%00%0C<br>18.0186s 1 ndn.ANode:OnMsg(): [DEBUG] Cache Entry:/news/2/%00%0B<br>18.0186s 1 ndn.ANode:OnMsg(): [DEBUG] Cache Entry:/news/2/%00%0E<br>


18.0186s 1 ndn.ANode:OnMsg(): [DEBUG] Cache Entry:/news/2/%00%0D<br>18.0186s 1 ndn.ANode:OnMsg(): [DEBUG] Cache Entry:/news/2/%00%10<br>18.0186s 1 ndn.ANode:OnMsg(): [DEBUG] Cache Entry:/news/2/%00%0F<br><br><br></div>Best regards</div>

_______________________________________________<br>ndnSIM mailing list<br><a href="mailto:ndnSIM@lists.cs.ucla.edu">ndnSIM@lists.cs.ucla.edu</a><br>http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim<br></blockquote></div><br></body></html>