static inline void clearStrategyInfo(const name_tree::Entry& nameTreeEntry) { NFD_LOG_TRACE("clearStrategyInfo " << nameTreeEntry.getPrefix()); std::for_each(nameTreeEntry.getPitEntries().begin(), nameTreeEntry.getPitEntries().end(), &clearStrategyInfo_pitEntry); if (static_cast<bool>(nameTreeEntry.getMeasurementsEntry())) { nameTreeEntry.getMeasurementsEntry()->clearStrategyInfo(); } }
shared_ptr<Entry> Measurements::get(name_tree::Entry& nte) { shared_ptr<Entry> entry = nte.getMeasurementsEntry(); if (entry != nullptr) return entry; entry = make_shared<Entry>(nte.getPrefix()); nte.setMeasurementsEntry(entry); ++m_nItems; entry->m_expiry = time::steady_clock::now() + getInitialLifetime(); entry->m_cleanup = scheduler::schedule(getInitialLifetime(), bind(&Measurements::cleanup, this, ref(*entry))); return entry; }
static inline void clearStrategyInfo(const name_tree::Entry& nte) { NFD_LOG_TRACE("clearStrategyInfo " << nte.getPrefix()); for (const shared_ptr<pit::Entry>& pitEntry : nte.getPitEntries()) { pitEntry->clearStrategyInfo(); for (const pit::InRecord& inRecord : pitEntry->getInRecords()) { const_cast<pit::InRecord&>(inRecord).clearStrategyInfo(); } for (const pit::OutRecord& outRecord : pitEntry->getOutRecords()) { const_cast<pit::OutRecord&>(outRecord).clearStrategyInfo(); } } if (nte.getMeasurementsEntry() != nullptr) { nte.getMeasurementsEntry()->clearStrategyInfo(); } }
/** \brief a predicate that decides whether StrategyInfo should be reset * * StrategyInfo on a NameTree entry needs to be reset, * if its effective strategy is covered by the changing StrategyChoice entry. */ static inline std::pair<bool,bool> predicate_nameTreeEntry_needResetStrategyChoice(const name_tree::Entry& nameTreeEntry, const name_tree::Entry& rootEntry) { if (&nameTreeEntry == &rootEntry) { return std::make_pair(true, true); } if (static_cast<bool>(nameTreeEntry.getStrategyChoiceEntry())) { return std::make_pair(false, false); } return std::make_pair(true, true); }
static inline bool predicate_NameTreeEntry_hasStrategyChoiceEntry(const name_tree::Entry& entry) { return static_cast<bool>(entry.getStrategyChoiceEntry()); }
static inline bool nteHasFibEntry(const name_tree::Entry& nte) { return nte.getFibEntry() != nullptr; }
static inline bool predicate_NameTreeEntry_hasFibEntry(const name_tree::Entry& entry) { return static_cast<bool>(entry.getFibEntry()); }
static inline bool nteHasStrategyChoiceEntry(const name_tree::Entry& nte) { return nte.getStrategyChoiceEntry() != nullptr; }
static inline bool nteHasPitEntries(const name_tree::Entry& nte) { return nte.hasPitEntries(); }