model: Fix original Contest Store to compile in new environment
diff --git a/model/cs/content-store-impl.hpp b/model/cs/content-store-impl.hpp
index 4692486..ddcb8ed 100644
--- a/model/cs/content-store-impl.hpp
+++ b/model/cs/content-store-impl.hpp
@@ -203,22 +203,21 @@
shared_ptr<Data>
ContentStoreImpl<Policy>::Lookup(shared_ptr<const Interest> interest)
{
- NS_LOG_FUNCTION(this << interest->GetName());
+ NS_LOG_FUNCTION(this << interest->getName());
typename super::const_iterator node;
- if (interest->GetExclude() == 0) {
- node = this->deepest_prefix_match(interest->GetName());
+ if (interest->getExclude().empty()) {
+ node = this->deepest_prefix_match(interest->getName());
}
else {
- node = this->deepest_prefix_match_if_next_level(interest->GetName(),
- isNotExcluded(*interest->GetExclude()));
+ node = this->deepest_prefix_match_if_next_level(interest->getName(),
+ isNotExcluded(interest->getExclude()));
}
if (node != this->end()) {
this->m_cacheHitsTrace(interest, node->payload()->GetData());
shared_ptr<Data> copy = make_shared<Data>(*node->payload()->GetData());
- ConstCast<Packet>(copy->GetPayload())->RemoveAllPacketTags();
return copy;
}
else {
@@ -231,10 +230,10 @@
bool
ContentStoreImpl<Policy>::Add(shared_ptr<const Data> data)
{
- NS_LOG_FUNCTION(this << data->GetName());
+ NS_LOG_FUNCTION(this << data->getName());
Ptr<entry> newEntry = Create<entry>(this, data);
- std::pair<typename super::iterator, bool> result = super::insert(data->GetName(), newEntry);
+ std::pair<typename super::iterator, bool> result = super::insert(data->getName(), newEntry);
if (result.first != super::end()) {
if (result.second) {
@@ -259,7 +258,7 @@
{
for (typename super::policy_container::const_iterator item = this->getPolicy().begin();
item != this->getPolicy().end(); item++) {
- os << item->payload()->GetName() << std::endl;
+ os << item->payload ()->GetName () << std::endl;
}
}
diff --git a/model/cs/content-store-with-freshness.hpp b/model/cs/content-store-with-freshness.hpp
index 836a94f..c69be28 100644
--- a/model/cs/content-store-with-freshness.hpp
+++ b/model/cs/content-store-with-freshness.hpp
@@ -104,7 +104,7 @@
if (!ok)
return false;
- NS_LOG_DEBUG(data->GetName() << " added to cache");
+ NS_LOG_DEBUG(data->getName() << " added to cache");
RescheduleCleaning();
return true;
}
diff --git a/model/cs/custom-policies/freshness-policy.hpp b/model/cs/custom-policies/freshness-policy.hpp
index 9d66c66..ae10862 100644
--- a/model/cs/custom-policies/freshness-policy.hpp
+++ b/model/cs/custom-policies/freshness-policy.hpp
@@ -105,7 +105,7 @@
insert(typename parent_trie::iterator item)
{
// get_time (item) = Simulator::Now ();
- Time freshness = item->payload()->GetData()->GetFreshness();
+ Time freshness = MilliSeconds(item->payload()->GetData()->getFreshnessPeriod().count());
if (!freshness.IsZero()) {
get_freshness(item) = Simulator::Now() + freshness;
@@ -128,7 +128,7 @@
inline void
erase(typename parent_trie::iterator item)
{
- if (!item->payload()->GetData()->GetFreshness().IsZero()) {
+ if (item->payload()->GetData()->getFreshnessPeriod() != time::milliseconds::zero()) {
// erase only if freshness is non zero (otherwise an item is not in the policy
policy_container::erase(policy_container::s_iterator_to(*item));
}
diff --git a/model/cs/ndn-content-store.cpp b/model/cs/ndn-content-store.cpp
index 8df04c6..9f7af30 100644
--- a/model/cs/ndn-content-store.cpp
+++ b/model/cs/ndn-content-store.cpp
@@ -66,7 +66,7 @@
const Name&
Entry::GetName() const
{
- return m_data->GetName();
+ return m_data->getName();
}
shared_ptr<const Data>
diff --git a/model/cs/ndn-content-store.hpp b/model/cs/ndn-content-store.hpp
index e28eea0..e007b32 100644
--- a/model/cs/ndn-content-store.hpp
+++ b/model/cs/ndn-content-store.hpp
@@ -36,9 +36,6 @@
namespace ndn {
-class Data;
-class Interest;
-class Name;
class ContentStore;
/**
@@ -90,7 +87,7 @@
GetContentStore();
private:
- Ptr<ContentStore> m_cs; ///< \brief content store to which entry is added
+ Ptr<ContentStore> m_cs; ///< \brief content store to which entry is added
shared_ptr<const Data> m_data; ///< \brief non-modifiable Data
};
@@ -211,4 +208,14 @@
} // namespace ndn
} // namespace ns3
+#include <boost/functional/hash.hpp>
+namespace boost {
+inline std::size_t
+hash_value(const ::ndn::name::Component component)
+{
+ return boost::hash_range(component.wireEncode().wire(),
+ component.wireEncode().wire() + component.wireEncode().size());
+}
+}
+
#endif // NDN_CONTENT_STORE_H
diff --git a/model/ndn-common.hpp b/model/ndn-common.hpp
index 6489981..97e722a 100644
--- a/model/ndn-common.hpp
+++ b/model/ndn-common.hpp
@@ -31,12 +31,18 @@
#include <ndn-cxx/data.hpp>
#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/util/time.hpp>
+
namespace ns3 {
namespace ndn {
using ::ndn::Name;
namespace name = ::ndn::name;
+namespace time = ::ndn::time;
+
+using ::ndn::Exclude;
+
using std::shared_ptr;
using std::make_shared;
diff --git a/utils/trie/trie.hpp b/utils/trie/trie.hpp
index bc7ab31..04ed980 100644
--- a/utils/trie/trie.hpp
+++ b/utils/trie/trie.hpp
@@ -128,7 +128,7 @@
template<typename FullKey, typename PayloadTraits, typename PolicyHook>
class trie {
public:
- typedef typename FullKey::partial_type Key;
+ typedef typename FullKey::value_type Key;
typedef trie* iterator;
typedef const trie* const_iterator;
diff --git a/wscript b/wscript
index bafa76a..7bd46d3 100644
--- a/wscript
+++ b/wscript
@@ -85,7 +85,6 @@
module.source = bld.path.ant_glob(['%s/**/*.cpp' % dir for dir in module_dirs],
excl=['model/ip-faces/*',
- 'model/cs/*',
'apps/*',
'helper/*',
'utils/**/*'])