Simplifying a FIB entry modification (now we can do it directly, without notifying the container)
diff --git a/apps/ccnx-producer.cc b/apps/ccnx-producer.cc
index cfd7b4c..6d36eb3 100644
--- a/apps/ccnx-producer.cc
+++ b/apps/ccnx-producer.cc
@@ -89,11 +89,13 @@
Ptr<CcnxFib> fib = GetNode ()->GetObject<CcnxFib> ();
Ptr<CcnxFibEntry> fibEntry = fib->Add (m_prefix, m_face, 0);
+
+ fibEntry->UpdateStatus (m_face, CcnxFibFaceMetric::NDN_FIB_GREEN);
- // make face green, so it will be used primarily
- StaticCast<CcnxFibImpl> (fib)->modify (fibEntry,
- ll::bind (&CcnxFibEntry::UpdateStatus,
- ll::_1, m_face, CcnxFibFaceMetric::NDN_FIB_GREEN));
+ // // make face green, so it will be used primarily
+ // StaticCast<CcnxFibImpl> (fib)->modify (fibEntry,
+ // ll::bind (&CcnxFibEntry::UpdateStatus,
+ // ll::_1, m_face, CcnxFibFaceMetric::NDN_FIB_GREEN));
}
void
diff --git a/model/ccnx-fib-impl.h b/model/ccnx-fib-impl.h
index 09bd237..cd42ae0 100644
--- a/model/ccnx-fib-impl.h
+++ b/model/ccnx-fib-impl.h
@@ -118,15 +118,15 @@
virtual Ptr<const CcnxFibEntry>
Next (Ptr<const CcnxFibEntry> item);
- /**
- * @brief Modify element in container
- */
- template<typename Modifier>
- bool
- modify (Ptr<CcnxFibEntry> item, Modifier mod)
- {
- return super::modify (StaticCast<CcnxFibEntryImpl> (item)->to_iterator (), mod);
- }
+ // /**
+ // * @brief Modify element in container
+ // */
+ // template<typename Modifier>
+ // bool
+ // modify (Ptr<CcnxFibEntry> item, Modifier mod)
+ // {
+ // return super::modify (StaticCast<CcnxFibEntryImpl> (item)->to_iterator (), mod);
+ // }
protected:
// inherited from Object class
diff --git a/model/ccnx-l3-protocol.cc b/model/ccnx-l3-protocol.cc
index d5f4438..928d015 100644
--- a/model/ccnx-l3-protocol.cc
+++ b/model/ccnx-l3-protocol.cc
@@ -335,9 +335,10 @@
ll::bind (&CcnxPitEntry::RemoveIncoming, ll::_1, incomingFace));
}
- StaticCast<CcnxFibImpl> (m_fib)->modify (pitEntry->m_fibEntry,
- ll::bind (&CcnxFibEntry::UpdateStatus,
- ll::_1, incomingFace, CcnxFibFaceMetric::NDN_FIB_YELLOW));
+ pitEntry->m_fibEntry->UpdateStatus (incomingFace, CcnxFibFaceMetric::NDN_FIB_YELLOW);
+ // StaticCast<CcnxFibImpl> (m_fib)->modify (pitEntry->m_fibEntry,
+ // ll::bind (&CcnxFibEntry::UpdateStatus,
+ // ll::_1, incomingFace, CcnxFibFaceMetric::NDN_FIB_YELLOW));
if (pitEntry->m_incoming.size () == 0) // interest was actually satisfied
{
@@ -486,9 +487,10 @@
// ?? not sure if we need to do that ?? ...
- StaticCast<CcnxFibImpl> (m_fib)->modify(pitEntry->m_fibEntry,
- ll::bind (&CcnxFibEntry::UpdateStatus,
- ll::_1, incomingFace, CcnxFibFaceMetric::NDN_FIB_YELLOW));
+ pitEntry->m_fibEntry->UpdateStatus (incomingFace, CcnxFibFaceMetric::NDN_FIB_YELLOW);
+ // StaticCast<CcnxFibImpl> (m_fib)->modify(pitEntry->m_fibEntry,
+ // ll::bind (&CcnxFibEntry::UpdateStatus,
+ // ll::_1, incomingFace, CcnxFibFaceMetric::NDN_FIB_YELLOW));
}
else
if (!isNew && !isRetransmitted)
@@ -590,11 +592,12 @@
// If we have sent interest for this data via this face, then update stats.
if (out != pitEntry->m_outgoing.end ())
{
- StaticCast<CcnxFibImpl> (m_fib)->modify (pitEntry->m_fibEntry,
- ll::bind (&CcnxFibEntry::UpdateFaceRtt,
- ll::_1,
- incomingFace,
- Simulator::Now () - out->m_sendTime));
+ pitEntry->m_fibEntry->UpdateFaceRtt (incomingFace, Simulator::Now () - out->m_sendTime);
+ // StaticCast<CcnxFibImpl> (m_fib)->modify (pitEntry->m_fibEntry,
+ // ll::bind (&CcnxFibEntry::UpdateFaceRtt,
+ // ll::_1,
+ // incomingFace,
+ // Simulator::Now () - out->m_sendTime));
}
else
{
@@ -617,9 +620,10 @@
}
// Update metric status for the incoming interface in the corresponding FIB entry
- StaticCast<CcnxFibImpl>(m_fib)->modify (pitEntry->m_fibEntry,
- ll::bind (&CcnxFibEntry::UpdateStatus, ll::_1,
- incomingFace, CcnxFibFaceMetric::NDN_FIB_GREEN));
+ pitEntry->m_fibEntry->UpdateStatus (incomingFace, CcnxFibFaceMetric::NDN_FIB_GREEN);
+ // StaticCast<CcnxFibImpl>(m_fib)->modify (pitEntry->m_fibEntry,
+ // ll::bind (&CcnxFibEntry::UpdateStatus, ll::_1,
+ // incomingFace, CcnxFibFaceMetric::NDN_FIB_GREEN));
// Add or update entry in the content store
m_contentStore->Add (header, payload);
diff --git a/model/ccnx-pit-impl.h b/model/ccnx-pit-impl.h
index e5a7f33..3f5fdfc 100644
--- a/model/ccnx-pit-impl.h
+++ b/model/ccnx-pit-impl.h
@@ -67,6 +67,8 @@
, protected CcnxPitEntryImpl::trie
{
public:
+ typedef CcnxPitEntryImpl::trie super;
+
/**
* \brief Interface ID
*
@@ -102,6 +104,16 @@
virtual void
Print (std::ostream &os) const;
+
+ // /**
+ // * @brief Modify element in container
+ // */
+ // template<typename Modifier>
+ // bool
+ // modify (Ptr<CcnxPitEntry> item, Modifier mod)
+ // {
+ // return super::modify (StaticCast<CcnxPitEntryImpl> (item)->to_iterator (), mod);
+ // }
protected:
// inherited from CcnxPit