[ndnSIM] Compare PitEntryIncomingFace with Face

Alex Afanasyev alexander.afanasyev at ucla.edu
Mon Jan 6 20:37:52 PST 2014


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/20140106/bc13a738/attachment.html>


More information about the ndnSIM mailing list