lp: IncomingFaceId, NextHopFaceId, CachePolicy tags
LocalControlHeader is deprecated.
This commit also adjusts includes in some lp/ headers.
refs #3296
Change-Id: Icdc7b469d70739fe5c65da51817c92ff9136c923
diff --git a/src/data.cpp b/src/data.cpp
index f96fb8f..724335e 100644
--- a/src/data.cpp
+++ b/src/data.cpp
@@ -289,26 +289,6 @@
return *this;
}
-//
-
-Data&
-Data::setIncomingFaceId(uint64_t incomingFaceId)
-{
- getLocalControlHeader().setIncomingFaceId(incomingFaceId);
- // ! do not reset Data's wire !
-
- return *this;
-}
-
-Data&
-Data::setCachingPolicy(nfd::LocalControlHeader::CachingPolicy cachingPolicy)
-{
- getLocalControlHeader().setCachingPolicy(cachingPolicy);
- // ! do not reset Data's wire !
-
- return *this;
-}
-
void
Data::onChanged()
{
@@ -349,4 +329,53 @@
return os;
}
+#ifdef NDN_LP_KEEP_LOCAL_CONTROL_HEADER
+
+// Permit deprecated usage for gcc only.
+// clang allows deprecated usage in deprecated functions, so it doesn't need this directive.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
+lp::LocalControlHeaderFacade
+Data::getLocalControlHeader()
+{
+ return lp::LocalControlHeaderFacade(*this);
+}
+
+const lp::LocalControlHeaderFacade
+Data::getLocalControlHeader() const
+{
+ return lp::LocalControlHeaderFacade(const_cast<Data&>(*this));
+}
+
+uint64_t
+Data::getIncomingFaceId() const
+{
+ return getLocalControlHeader().getIncomingFaceId();
+}
+
+Data&
+Data::setIncomingFaceId(uint64_t incomingFaceId)
+{
+ getLocalControlHeader().setIncomingFaceId(incomingFaceId);
+ return *this;
+}
+
+lp::LocalControlHeaderFacade::CachingPolicy
+Data::getCachingPolicy() const
+{
+ return getLocalControlHeader().getCachingPolicy();
+}
+
+Data&
+Data::setCachingPolicy(lp::LocalControlHeaderFacade::CachingPolicy cachingPolicy)
+{
+ getLocalControlHeader().setCachingPolicy(cachingPolicy);
+ return *this;
+}
+
+#pragma GCC diagnostic pop
+
+#endif // NDN_LP_KEEP_LOCAL_CONTROL_HEADER
+
} // namespace ndn