Skip to content

Commit fb5c031

Browse files
committed
[#28,!20] Addressed inconsistent parameter pack problem in CB pool.
1 parent 5c6e36a commit fb5c031

File tree

1 file changed

+28
-17
lines changed

1 file changed

+28
-17
lines changed

src/lib/config_backend/base_config_backend_pool.h

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ class BaseConfigBackendPool {
9797
/// rest of the backends are skipped.
9898
///
9999
/// @tparam PropertyType Type of the object returned by the backend call.
100-
/// @tparam InputType Type of the objects used as input to the backend call.
100+
/// @tparam FnPtrArgs Parameter pack holding argument types of the backend
101+
/// method to be invoked.
102+
/// @tparam Args Parameter pack holding types of the arguments provided
103+
/// in the call to this method.
101104
///
102105
/// @param MethodPointer Pointer to the backend method to be called.
103106
/// @param backend_selector Backend selector.
@@ -108,13 +111,13 @@ class BaseConfigBackendPool {
108111
///
109112
/// @throw db::NoSuchDatabase if no database matching the given selector
110113
/// was found.
111-
template<typename PropertyType, typename... InputType>
114+
template<typename PropertyType, typename... FnPtrArgs, typename... Args>
112115
void getPropertyPtrConst(PropertyType (ConfigBackendType::*MethodPointer)
113-
(const db::ServerSelector&, InputType...) const,
116+
(const db::ServerSelector&, FnPtrArgs...) const,
114117
const db::BackendSelector& backend_selector,
115118
const db::ServerSelector& server_selector,
116119
PropertyType& property,
117-
InputType... input) const {
120+
Args... input) const {
118121

119122
// If no particular backend is selected, call each backend and return
120123
// the first non-null (non zero) value.
@@ -174,7 +177,10 @@ class BaseConfigBackendPool {
174177
///
175178
///
176179
/// @tparam PropertyType Type of the object returned by the backend call.
177-
/// @tparam InputType Type of the objects used as input to the backend call.
180+
/// @tparam FnPtrArgs Parameter pack holding argument types of the backend
181+
/// method to be invoked.
182+
/// @tparam Args Parameter pack holding types of the arguments provided
183+
/// in the call to this method.
178184
///
179185
/// @param MethodPointer Pointer to the backend method to be called.
180186
/// @param backend_selector Backend selector.
@@ -185,14 +191,14 @@ class BaseConfigBackendPool {
185191
///
186192
/// @throw db::NoSuchDatabase if no database matching the given selector
187193
/// was found.
188-
template<typename PropertyType, typename... InputType>
194+
template<typename PropertyType, typename... FnPtrArgs, typename... Args>
189195
void getOptionalPropertyConst(util::OptionalValue<PropertyType>
190196
(ConfigBackendType::*MethodPointer)
191-
(const db::ServerSelector&, InputType...) const,
197+
(const db::ServerSelector&, FnPtrArgs...) const,
192198
const db::BackendSelector& backend_selector,
193199
const db::ServerSelector& server_selector,
194200
util::OptionalValue<PropertyType>& property,
195-
InputType... input) const {
201+
Args... input) const {
196202

197203
// If no particular backend is selected, call each backend and return
198204
// the first non-null (non zero) value.
@@ -255,7 +261,10 @@ class BaseConfigBackendPool {
255261
///
256262
/// @tparam PropertyCollectionType Type of the container into which the
257263
/// properties are stored.
258-
/// @tparam InputType Type of the objects used as input to the backend call.
264+
/// @tparam FnPtrArgs Parameter pack holding argument types of the backend
265+
/// method to be invoked.
266+
/// @tparam Args Parameter pack holding types of the arguments provided
267+
/// in the call to this method.
259268
///
260269
/// @param MethodPointer Pointer to the backend method to be called.
261270
/// @param backend_selector Backend selector.
@@ -265,13 +274,13 @@ class BaseConfigBackendPool {
265274
///
266275
/// @throw db::NoSuchDatabase if no database matching the given selector
267276
/// was found.
268-
template<typename PropertyCollectionType, typename... InputType>
277+
template<typename PropertyCollectionType, typename... FnPtrArgs, typename... Args>
269278
void getMultiplePropertiesConst(PropertyCollectionType (ConfigBackendType::*MethodPointer)
270-
(const db::ServerSelector&, InputType...) const,
279+
(const db::ServerSelector&, FnPtrArgs...) const,
271280
const db::BackendSelector& backend_selector,
272281
const db::ServerSelector& server_selector,
273282
PropertyCollectionType& properties,
274-
InputType... input) const {
283+
Args... input) const {
275284
if (backend_selector.amUnspecified()) {
276285
for (auto backend : backends_) {
277286
properties = ((*backend).*MethodPointer)(server_selector, input...);
@@ -397,8 +406,10 @@ class BaseConfigBackendPool {
397406
/// backend is selected, an exception is thrown. If no backend is selected
398407
/// an exception is thrown either.
399408
///
400-
/// @tparam InputType Type of the objects being used as arguments of the
401-
/// backend method, e.g. new property to be added, updated or deleted.
409+
/// @tparam FnPtrArgs Parameter pack holding argument types of the backend
410+
/// method to be invoked.
411+
/// @tparam Args Parameter pack holding types of the arguments provided
412+
/// in the call to this method.
402413
///
403414
/// @param MethodPointer Pointer to the backend method to be called.
404415
/// @param backend_selector Backend selector.
@@ -410,12 +421,12 @@ class BaseConfigBackendPool {
410421
/// was found.
411422
/// @throw db::AmbiguousDatabase if multiple databases matching the selector
412423
/// were found.
413-
template<typename... InputType>
424+
template<typename... FnPtrArgs, typename... Args>
414425
void createUpdateDeleteProperty(void (ConfigBackendType::*MethodPointer)
415-
(const db::ServerSelector&, InputType...),
426+
(const db::ServerSelector&, FnPtrArgs...),
416427
const db::BackendSelector& backend_selector,
417428
const db::ServerSelector& server_selector,
418-
InputType... input) {
429+
Args... input) {
419430
auto backends = selectBackends(backend_selector);
420431
if (backends.empty()) {
421432
isc_throw(db::NoSuchDatabase, "no database found for selector: "

0 commit comments

Comments
 (0)