[ndnSIM] Compare PitEntryIncomingFace with Face

Alex Afanasyev alexander.afanasyev at ucla.edu
Wed Jan 8 16:40:14 PST 2014


Hi Fabrizio,

On Jan 8, 2014, at 4:16 PM, fabrizio saponaro <fab.batta at gmail.com> wrote:

> Hi Alex,
> thank you for your courtesy, I didn't see that pitEntry->GetIncoming() returns a container.
> I tried your solution but I got this error:
> 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]

Ohh.  This is a small bug in ndn-pit-entry-incoming-face.h.  operator== should be defined as ('const' is missing):

  bool operator== (const IncomingFace &dst) const { return *m_face==*(dst.m_face); }

  bool operator== (Ptr<Face> face) const { return *m_face==*face; }

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.

---
Alex

> I tried also using my GetIncoming2() that returns a no-const object (or this is what I thought), but getting the same error.
> 
> 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.
> I hope I was clear in the explaining.
> 
> Best regards,
> Fabrizio
> 
> 
> 
> 2014/1/7 Alex Afanasyev <alexander.afanasyev at ucla.edu>
> Hi Fabrizio,
> 
> 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.
> 
> 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:
> 
> for (pit::Entry::in_container::iterator face = pitEntry->GetIncoming().begin();
>      face != pitEntry->GetIncoming().end();
>      ++face)
> {
>    if (*face == ndn->GetFace(0))
>    {
>       ...
>    }
> }
> 
> "Incoming face" is another data structure actually, but it can be directly compared to the face.
> 
> ---
> Alex
> 
> On Jan 5, 2014, at 7:26 PM, fabrizio saponaro <fab.batta at gmail.com> wrote:
> 
>> Hi Alex,
>> I want to compare an object of PitEntryIncomingFace with an object of Face.
>> 
>> To get the incoming face of a entry pit I use
>> const pit::Entry::in_container inFace = pitEntry->GetIncoming ();
>> 
>> and to get a Face of my element of forwarding strategy I use:
>> Ptr<L3Protocol> ndn = this->GetObject<L3Protocol> ();
>> Ptr<Face> outFace = ndn->GetFace (0); // 0 for example
>> 
>> I wanted to compare its. In the PitEntryIncomingFace's code exists this operator:
>>   bool operator== (Ptr<Face> face) { return *m_face==*face; }
>> 
>> so I've thought use it in this way:
>> if (inFace == outFace) {...}	, but I got some errors like:
>> ‘const in_container {aka const std::set<ns3::ndn::pit::IncomingFace>}’ is not derived from ‘const ns3::Ptr<T>’
>> 
>> 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:
>> Entry::in_container &
>> Entry::GetIncoming2 () 
>> {
>>   return m_incoming;
>> }
>> 
>> but I got other similar errors like:
>>  ‘ns3::ndn::pit::Entry::in_container {aka std::set<ns3::ndn::pit::IncomingFace>}’ is not derived from ‘const ns3::Ptr<T>’
>> 
>> How could I solve it?
>> Many thanks and best regards,
>> Fabrizio
>> 
>> 
>> _______________________________________________
>> ndnSIM mailing list
>> ndnSIM at lists.cs.ucla.edu
>> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
> 
> 

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


More information about the ndnSIM mailing list