model: Small extension of printing out entries of the content store
(printing more specific data for specialized versions of the content stores)
diff --git a/model/cs/content-store-with-freshness.h b/model/cs/content-store-with-freshness.h
index dab654c..81f8856 100644
--- a/model/cs/content-store-with-freshness.h
+++ b/model/cs/content-store-with-freshness.h
@@ -42,6 +42,9 @@
static TypeId
GetTypeId ();
+ virtual inline void
+ Print (std::ostream &os) const;
+
virtual inline bool
Add (Ptr<const ContentObject> header, Ptr<const Packet> packet);
@@ -156,6 +159,22 @@
RescheduleCleaning ();
}
+template<class Policy>
+void
+ContentStoreWithFreshness< Policy >::Print (std::ostream &os) const
+{
+ // const freshness_policy_container &freshness = this->getPolicy ().template get<freshness_policy_container> ();
+
+ for (typename super::policy_container::const_iterator item = this->getPolicy ().begin ();
+ item != this->getPolicy ().end ();
+ item++)
+ {
+ Time ttl = freshness_policy_container::policy_base::get_freshness (&(*item)) - Simulator::Now ();
+ os << item->payload ()->GetName () << "(left: " << ttl.ToDouble (Time::S) << "s)" << std::endl;
+ }
+}
+
+
} // namespace cs
} // namespace ndn