diff --git a/src/lib/dhcpsrv/Makefile.am b/src/lib/dhcpsrv/Makefile.am index e721267bb0a074a2ef2070b339ad87764add1ee0..db82513f5283c4731025af665000d9607c0b4d00 100644 --- a/src/lib/dhcpsrv/Makefile.am +++ b/src/lib/dhcpsrv/Makefile.am @@ -37,6 +37,7 @@ libb10_dhcpsrv_la_SOURCES += dbaccess_parser.cc dbaccess_parser.h libb10_dhcpsrv_la_SOURCES += dhcpsrv_log.cc dhcpsrv_log.h libb10_dhcpsrv_la_SOURCES += cfgmgr.cc cfgmgr.h libb10_dhcpsrv_la_SOURCES += dhcp_config_parser.h +libb10_dhcpsrv_la_SOURCES += key_from_key.h libb10_dhcpsrv_la_SOURCES += lease_mgr.cc lease_mgr.h libb10_dhcpsrv_la_SOURCES += lease_mgr_factory.cc lease_mgr_factory.h libb10_dhcpsrv_la_SOURCES += memfile_lease_mgr.cc memfile_lease_mgr.h diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.h b/src/lib/dhcpsrv/memfile_lease_mgr.h index 917e06415bedfef719230696ec1fce4f7aaeb545..0f896a71c4664e7cf3e9fe9ce4e19f3f987ca16b 100644 --- a/src/lib/dhcpsrv/memfile_lease_mgr.h +++ b/src/lib/dhcpsrv/memfile_lease_mgr.h @@ -16,6 +16,7 @@ #define MEMFILE_LEASE_MGR_H #include +#include #include #include @@ -221,29 +222,6 @@ public: protected: - template - class KeyFromKey { - public: - typedef typename KeyExtractor1::result_type result_type; - - /// @brief Constructor. - KeyFromKey() - : key1_(KeyExtractor1()), key2_(KeyExtractor2()) { }; - - /// @brief Extract key with another key. - /// - /// @param arg the key value. - /// - /// @tparam key value type. - template - result_type operator() (T& arg) const { - return (key1_(key2_(arg))); - } - private: - KeyExtractor1 key1_; ///< key 1. - KeyExtractor2 key2_; ///< key 2. - }; - // This is a multi-index container, which holds elements that can // be accessed using different search indexes. typedef boost::multi_index_container< diff --git a/src/lib/dhcpsrv/subnet.h b/src/lib/dhcpsrv/subnet.h index cf29450d8c73613eba74cd0f3594dfe86ef5c9fc..ea08fb02c0734fd9184117ae73c8aef709403f67 100644 --- a/src/lib/dhcpsrv/subnet.h +++ b/src/lib/dhcpsrv/subnet.h @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -82,55 +83,6 @@ public: /// A pointer to option descriptor. typedef boost::shared_ptr OptionDescriptorPtr; - /// @brief Extractor class to extract key with another key. - /// - /// This class solves the problem of accessing index key values - /// that are stored in objects nested in other objects. - /// Each OptionDescriptor structure contains the OptionPtr object. - /// The value retured by one of its accessors (getType) is used - /// as an indexing value in the multi_index_container defined below. - /// There is no easy way to mark that value returned by Option::getType - /// should be an index of this multi_index_container. There are standard - /// key extractors such as 'member' or 'mem_fun' but they are not - /// sufficient here. The former can be used to mark that member of - /// the structure that is held in the container should be used as an - /// indexing value. The latter can be used if the indexing value is - /// a product of the class being held in the container. In this complex - /// scenario when the indexing value is a product of the function that - /// is wrapped by the structure, this new extractor template has to be - /// defined. The template class provides a 'chain' of two extractors - /// to access the value returned by nested object and to use it as - /// indexing value. - /// For some more examples of complex keys see: - /// http://www.cs.brown.edu/~jwicks/boost/libs/multi_index/doc/index.html - /// - /// @tparam KeyExtractor1 extractor used to access data in - /// OptionDescriptor::option - /// @tparam KeyExtractor2 extractor used to access - /// OptionDescriptor::option member. - template - class KeyFromKey { - public: - typedef typename KeyExtractor1::result_type result_type; - - /// @brief Constructor. - KeyFromKey() - : key1_(KeyExtractor1()), key2_(KeyExtractor2()) { }; - - /// @brief Extract key with another key. - /// - /// @param arg the key value. - /// - /// @tparam key value type. - template - result_type operator() (T& arg) const { - return (key1_(key2_(arg))); - } - private: - KeyExtractor1 key1_; ///< key 1. - KeyExtractor2 key2_; ///< key 2. - }; - /// @brief Multi index container for DHCP option descriptors. /// /// This container comprises three indexes to access option