model: Major API changes
Interest and ContentObject are no longer derived from Header class.
Instead, they are encapsulating payload and, optionally, wire-formatted
Packet object.
Refs #1005 (http://redmine.named-data.net/)
diff --git a/model/cs/content-store-impl.h b/model/cs/content-store-impl.h
index ffe8038..9cd934e 100644
--- a/model/cs/content-store-impl.h
+++ b/model/cs/content-store-impl.h
@@ -44,8 +44,8 @@
typedef Entry base_type;
public:
- EntryImpl (Ptr<ContentStore> cs, Ptr<const ContentObject> header, Ptr<const Packet> packet)
- : Entry (cs, header, packet)
+ EntryImpl (Ptr<ContentStore> cs, Ptr<const ContentObject> data)
+ : Entry (cs, data)
, item_ (0)
{
}
@@ -86,11 +86,11 @@
// from ContentStore
- virtual inline boost::tuple<Ptr<Packet>, Ptr<const ContentObject>, Ptr<const Packet> >
+ virtual inline Ptr<ContentObject>
Lookup (Ptr<const Interest> interest);
virtual inline bool
- Add (Ptr<const ContentObject> header, Ptr<const Packet> packet);
+ Add (Ptr<const ContentObject> data);
// virtual bool
// Remove (Ptr<Interest> header);
@@ -156,7 +156,7 @@
}
template<class Policy>
-boost::tuple<Ptr<Packet>, Ptr<const ContentObject>, Ptr<const Packet> >
+Ptr<const ContentObject>
ContentStoreImpl<Policy>::Lookup (Ptr<const Interest> interest)
{
NS_LOG_FUNCTION (this << interest->GetName ());
@@ -166,29 +166,27 @@
if (node != this->end ())
{
- this->m_cacheHitsTrace (interest, node->payload ()->GetHeader ());
+ this->m_cacheHitsTrace (interest, node->payload ()->GetData ());
- // NS_LOG_DEBUG ("cache hit with " << node->payload ()->GetHeader ()->GetName ());
- return boost::make_tuple (node->payload ()->GetFullyFormedNdnPacket (),
- node->payload ()->GetHeader (),
- node->payload ()->GetPacket ());
+ Ptr<ContentObject> copy = Create<ContentObject> (node->payload ()->GetData ());
+ ConstCast<Packet> (copy->GetPayload ())->RemoveAllPacketTags ();
+ return copy;
}
else
{
- // NS_LOG_DEBUG ("cache miss for " << interest->GetName ());
this->m_cacheMissesTrace (interest);
- return boost::tuple<Ptr<Packet>, Ptr<ContentObject>, Ptr<Packet> > (0, 0, 0);
+ return 0;
}
}
template<class Policy>
bool
-ContentStoreImpl<Policy>::Add (Ptr<const ContentObject> header, Ptr<const Packet> packet)
+ContentStoreImpl<Policy>::Add (Ptr<const ContentObject> data)
{
- NS_LOG_FUNCTION (this << header->GetName ());
+ NS_LOG_FUNCTION (this << data->GetName ());
- Ptr< entry > newEntry = Create< entry > (this, header, packet);
- std::pair< typename super::iterator, bool > result = super::insert (header->GetName (), newEntry);
+ Ptr< entry > newEntry = Create< entry > (this, data);
+ std::pair< typename super::iterator, bool > result = super::insert (data->GetName (), newEntry);
if (result.first != super::end ())
{