<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hi Fabrizio,</div><br><div><div>On Jan 8, 2014, at 4:16 PM, fabrizio saponaro <<a href="mailto:fab.batta@gmail.com">fab.batta@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hi Alex,<div>thank you for your courtesy, I didn't see that <span style="font-family:arial,sans-serif;font-size:13px">pitEntry->GetIncoming() returns a container</span>.</div><div>I tried your solution but I got this error:</div>
<div>error: passing ‘const ns3::ndn::pit::IncomingFace’ as ‘this’ argument of ‘bool ns3::ndn::pit::IncomingFace::operator==(ns3::Ptr<ns3::ndn::Face>)’ discards qualifiers [-fpermissive]</div></div></blockquote><div><br></div>Ohh.  This is a small bug in ndn-pit-entry-incoming-face.h.  operator== should be defined as ('const' is missing):</div><div><br></div><div><div>  bool operator== (const IncomingFace &dst) const { return *m_face==*(dst.m_face); }</div><div><br></div><div>  bool operator== (Ptr<Face> face) const { return *m_face==*face; }</div><div><br></div><div>The "problem" is not with GetIncoming, but with the incoming faces container itself, which is std::set.  It assumes that all data in it is constant.</div><div><br></div><div>---</div><div>Alex</div><div><br></div><blockquote type="cite"><div dir="ltr">
<div>I tried also using my GetIncoming2() that returns a no-const object (or this is what I thought), but getting the same error.</div><div><br></div><div>My goal is, receiving a Data, get the face from which came the interest related to it. Now I know that GetIncoming() returns a container with many IncomingFace for the Entry Pit, but in my case I can have only one face for the entry pit, so GetIncoming() should returns a container that contains only one element because this Interest is sent one time for one Consumer.</div>
<div>I hope I was clear in the explaining.</div><div><br></div><div>Best regards,</div><div>Fabrizio</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014/1/7 Alex Afanasyev <span dir="ltr"><<a href="mailto:alexander.afanasyev@ucla.edu" target="_blank">alexander.afanasyev@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">Hi Fabrizio,<div><br></div><div>The problem is that you're not comparing the comparable things.  The first thing, pitEntry->GetIncoming() returns you a container (set of incoming faces), while ndn->GetFace(...) returns you just one face.</div>
<div><br></div><div>The solution depends on what you're trying to achieve.  One crazy thing is to compare all incoming faces from PIT entry with the target one:</div><div><br></div><div>for (pit::Entry::in_container::iterator face = pitEntry->GetIncoming().begin();</div>
<div>     face != pitEntry->GetIncoming().end();</div><div>     ++face)</div><div>{</div><div>   if (*face == ndn->GetFace(0))</div><div>   {</div><div>      ...</div><div>   }</div><div>}</div><div><br></div><div>"Incoming face" is another data structure actually, but it can be directly compared to the face.</div>
<div><br></div><div>---</div><div>Alex</div><div><br><div><div><div class="h5"><div>On Jan 5, 2014, at 7:26 PM, fabrizio saponaro <<a href="mailto:fab.batta@gmail.com" target="_blank">fab.batta@gmail.com</a>> wrote:</div>
<br></div></div><blockquote type="cite"><div><div class="h5"><div dir="ltr">Hi Alex,<div>I want to compare an object of PitEntryIncomingFace with an object of Face.</div><div><br></div><div>To get the incoming face of a entry pit I use</div>
<div><i>const pit::Entry::in_container inFace = pitEntry->GetIncoming ();<br>
</i></div><div><br></div><div>and to get a Face of my element of forwarding strategy I use:</div><div><div><i>Ptr<L3Protocol> ndn = this->GetObject<L3Protocol> ();</i></div><div><i>Ptr<Face> outFace = ndn->GetFace (0); // 0 for example</i></div>

</div><div><br></div><div>I wanted to compare its. In the PitEntryIncomingFace's code exists this operator:<br></div><div><i>  bool operator== (Ptr<Face> face) { return *m_face==*face; }</i></div><div><i><br></i></div>

<div>so <span style="background-color:rgb(250,250,250);font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:15px">I've thought use it in this way:</span></div><div><font face="Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif"><span style="line-height:15px">if (inFace == outFace) {...}<span style="white-space:pre-wrap">    </span></span></font><span style="background-color:rgb(250,250,250);font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:15px">, but I got some errors like:</span></div>

<div><span style="background-color:rgb(250,250,250)"><div style="font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:15px"><i>‘const in_container {aka const std::set<ns3::ndn::pit::IncomingFace>}’ is not derived from ‘const ns3::Ptr<T>’</i></div>

<div style="font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:15px"><i><br></i></div><div style="font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:15px">

I know that these errors are due to the use of const by the GetIncoming method in the EntryPit class, so I created this method:</div><div><div><font face="Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif"><span style="line-height:15px"><i>Entry::in_container &</i></span></font></div>

<div><font face="Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif"><span style="line-height:15px"><i>Entry::GetIncoming2 () </i></span></font></div><div><font face="Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif"><span style="line-height:15px"><i>{</i></span></font></div>

<div><font face="Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif"><span style="line-height:15px"><i>  return m_incoming;</i></span></font></div><div><font face="Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif"><span style="line-height:15px"><i>}</i></span></font></div>

</div><div><font face="Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif"><span style="line-height:15px"><i><br></i></span></font></div><div style="font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:15px">

but I got other similar errors like:</div><div style="font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:15px"><div><i> ‘ns3::ndn::pit::Entry::in_container {aka std::set<ns3::ndn::pit::IncomingFace>}’ is not derived from ‘const ns3::Ptr<T>’</i></div>

</div><div style="font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:15px"><br></div><div style="font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:15px">

How could I solve it?</div><div style="font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:15px">Many thanks and best regards,</div><div style="font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:15px">

Fabrizio</div><div style="font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:15px"><i><br></i></div><div style="font-family:Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif;font-size:13px;line-height:15px">

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