From f495c3a5febe9b569f42f5a9b74cd073e0c38c7a Mon Sep 17 00:00:00 2001 From: Paul Colby Date: Sat, 14 Oct 2017 16:01:28 +1100 Subject: [PATCH] Use explicit types for pcp::units function arguments Templating the type was overkill, given that the `PMDA_PMUNITS` macro only exists to automatically order the arguments correctly for the `pmUnits` member of the `pmDesc` structure (the order reverses on some platforms). But also, the templating was forcing all parameters to be the same type, whereas the `pmUnits` structure members are not all the same type. Given that `pmUnits` has not changed in 8 years, it makes most sense to replace the templating with the explicit `pmUnits` types directly. --- include/pcp-cpp/units.hpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/include/pcp-cpp/units.hpp b/include/pcp-cpp/units.hpp index c6042d3..47f7580 100644 --- a/include/pcp-cpp/units.hpp +++ b/include/pcp-cpp/units.hpp @@ -25,17 +25,16 @@ class instance_domain; * This allows C++11-style initialisation lists, while avoiding C++ "extended * initializer lists" warnings. * - * @param a The first argument to pass to the PMDA_PMUNITS macro. - * @param b The second argument to pass to the PMDA_PMUNITS macro. - * @param c The third argument to pass to the PMDA_PMUNITS macro. - * @param d The fourth argument to pass to the PMDA_PMUNITS macro. - * @param e The fifth argument to pass to the PMDA_PMUNITS macro. - * @param f The sixth argument to pass to the PMDA_PMUNITS macro. + * @param a The first argument to pass to the PMDA_PMUNITS macro (dimTime). + * @param b The second argument to pass to the PMDA_PMUNITS macro (dimSpace). + * @param c The third argument to pass to the PMDA_PMUNITS macro (dimCount). + * @param d The fourth argument to pass to the PMDA_PMUNITS macro (scaleSpace). + * @param e The fifth argument to pass to the PMDA_PMUNITS macro (scaleTime). + * @param f The sixth argument to pass to the PMDA_PMUNITS macro (scaleCount). * * @return A pmUnits value constructed from the supplied arguments. */ -template -inline pmUnits units(Type a, Type b, Type c, Type d, Type e, Type f) +inline pmUnits units(int a, int b, int c, unsigned d, unsigned e, int f) { const pmUnits units = PMDA_PMUNITS(a,b,c,d,e,f); return units;