]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2448] add C++ template adapters to LeaseXPtr
authorAndrei Pavel <andrei@isc.org>
Fri, 1 Jul 2022 15:06:16 +0000 (18:06 +0300)
committerAndrei Pavel <andrei@isc.org>
Thu, 7 Jul 2022 11:48:20 +0000 (11:48 +0000)
src/lib/dhcpsrv/lease.h

index 67c23cdc5b84564689c546c01c0a5bca18a1692e..5f831ff150ca38067d5332e966f8449f7a7b757e 100644 (file)
@@ -14,6 +14,7 @@
 #include <dhcpsrv/subnet_id.h>
 #include <cc/user_context.h>
 #include <cc/cfg_to_element.h>
+#include <util/dhcp_space.h>
 
 namespace isc {
 namespace dhcp {
@@ -672,6 +673,32 @@ typedef boost::shared_ptr<Lease6Collection> Lease6CollectionPtr;
 std::ostream&
 operator<<(std::ostream& os, const Lease& lease);
 
+/// @brief adapters for linking templates to qualified names
+/// @{
+namespace {
+
+template <isc::util::DhcpSpace D>
+struct adapter_Lease {};
+
+template <>
+struct adapter_Lease<isc::util::DHCPv4> {
+    using type = Lease4;
+};
+
+template <>
+struct adapter_Lease<isc::util::DHCPv6> {
+    using type = Lease6;
+};
+
+}  // namespace
+
+template <isc::util::DhcpSpace D>
+using LeaseT = typename adapter_Lease<D>::type;
+
+template <isc::util::DhcpSpace D>
+using LeaseTPtr = boost::shared_ptr<LeaseT<D>>;
+/// @}
+
 }; // end of isc::dhcp namespace
 }; // end of isc namespace