cs: avoid Entry construction during query
Using C++14's transparent comparators, CS lookup logic can
compare stored Entry objects with the queried Name without
constructing an Entry object. This in turn eliminates the need
for a special "query entry", so EntryImpl class is deleted.
refs #4914
Change-Id: I5b05a1ab9ad696e79f7ebd6045be8de11cd58ee6
diff --git a/daemon/table/cs-policy.hpp b/daemon/table/cs-policy.hpp
index 93e028e..f50f854 100644
--- a/daemon/table/cs-policy.hpp
+++ b/daemon/table/cs-policy.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,8 +26,7 @@
#ifndef NFD_DAEMON_TABLE_CS_POLICY_HPP
#define NFD_DAEMON_TABLE_CS_POLICY_HPP
-#include "cs-internal.hpp"
-#include "cs-entry-impl.hpp"
+#include "cs-entry.hpp"
namespace nfd {
namespace cs {
@@ -67,23 +66,36 @@
~Policy() = default;
const std::string&
- getName() const;
+ getName() const
+ {
+ return m_policyName;
+ }
+
public:
/** \brief gets cs
*/
Cs*
- getCs() const;
+ getCs() const
+ {
+ return m_cs;
+ }
/** \brief sets cs
*/
void
- setCs(Cs *cs);
+ setCs(Cs* cs)
+ {
+ m_cs = cs;
+ }
/** \brief gets hard limit (in number of entries)
*/
size_t
- getLimit() const;
+ getLimit() const
+ {
+ return m_limit;
+ }
/** \brief sets hard limit (in number of entries)
* \post getLimit() == nMaxEntries
@@ -189,30 +201,6 @@
Cs* m_cs;
};
-inline const std::string&
-Policy::getName() const
-{
- return m_policyName;
-}
-
-inline Cs*
-Policy::getCs() const
-{
- return m_cs;
-}
-
-inline void
-Policy::setCs(Cs *cs)
-{
- m_cs = cs;
-}
-
-inline size_t
-Policy::getLimit() const
-{
- return m_limit;
-}
-
} // namespace cs
} // namespace nfd