|
4 | 4 | * Authors: Heiko Strathmann, Soeren Sonnenburg, Sergey Lisitsyn,
|
5 | 5 | * Giovanni De Toni, Jacob Walker, Thoralf Klein, Chiyuan Zhang,
|
6 | 6 | * Fernando Iglesias, Sanuj Sharma, Roman Votyakov, Yuyu Zhang,
|
7 |
| - * Viktor Gal, Bjoern Esser, Evangelos Anagnostopoulos, Pan Deng |
| 7 | + * Viktor Gal, Bjoern Esser, Evangelos Anagnostopoulos, Pan Deng, |
| 8 | + * Gil Hoben |
8 | 9 | */
|
9 | 10 |
|
10 | 11 | #ifndef __SGOBJECT_H__
|
@@ -56,55 +57,51 @@ template <class T> class SGStringList;
|
56 | 57 | #define SG_UNREF_NO_NULL(x) { if (x) { (x)->unref(); } }
|
57 | 58 |
|
58 | 59 | /*******************************************************************************
|
59 |
| - * Macros for registering parameters/model selection parameters |
| 60 | + * Macros for registering parameter properties |
60 | 61 | ******************************************************************************/
|
61 | 62 |
|
62 | 63 | #ifdef _MSC_VER
|
63 | 64 |
|
64 | 65 | #define VA_NARGS(...) INTERNAL_EXPAND_ARGS_PRIVATE(INTERNAL_ARGS_AUGMENTER(__VA_ARGS__))
|
65 | 66 | #define INTERNAL_ARGS_AUGMENTER(...) unused, __VA_ARGS__
|
66 | 67 | #define INTERNAL_EXPAND(x) x
|
67 |
| -#define INTERNAL_EXPAND_ARGS_PRIVATE(...) INTERNAL_EXPAND(INTERNAL_GET_ARG_COUNT_PRIVATE(__VA_ARGS__, 5, 4, 3, 2, 1, 0)) |
68 |
| -#define INTERNAL_GET_ARG_COUNT_PRIVATE(_0_, _1_, _2_, _3_, _4_, _5_, count, ...) count |
| 68 | +#define INTERNAL_EXPAND_ARGS_PRIVATE(...) INTERNAL_EXPAND(INTERNAL_GET_ARG_COUNT_PRIVATE(__VA_ARGS__, 4, 3, 2, 1, 0)) |
| 69 | +#define INTERNAL_GET_ARG_COUNT_PRIVATE(_0_, _1_, _2_, _3_, _4_, count, ...) count |
69 | 70 |
|
70 | 71 | #else
|
71 | 72 |
|
72 |
| -#define VA_NARGS_IMPL(_1, _2, _3, _4, _5, N, ...) N |
73 |
| -#define VA_NARGS(...) VA_NARGS_IMPL(__VA_ARGS__, 5, 4, 3, 2, 1) |
| 73 | +#define VA_NARGS_IMPL(_1, _2, _3, _4, N, ...) N |
| 74 | +#define VA_NARGS(...) VA_NARGS_IMPL(__VA_ARGS__, 4, 3, 2, 1) |
74 | 75 |
|
75 | 76 | #endif
|
76 | 77 |
|
77 | 78 | #define VARARG_IMPL2(base, count, ...) base##count(__VA_ARGS__)
|
78 | 79 | #define VARARG_IMPL(base, count, ...) VARARG_IMPL2(base, count, __VA_ARGS__)
|
79 | 80 | #define VARARG(base, ...) VARARG_IMPL(base, VA_NARGS(__VA_ARGS__), __VA_ARGS__)
|
80 | 81 |
|
81 |
| -#define SG_ADD4(param, name, description, ms_available) \ |
| 82 | +#define SG_ADD3(param, name, description) \ |
82 | 83 | { \
|
83 | 84 | this->m_parameters->add(param, name, description); \
|
84 | 85 | this->watch_param( \
|
85 |
| - name, param, \ |
86 |
| - AnyParameterProperties( \ |
87 |
| - description, ms_available, GRADIENT_NOT_AVAILABLE)); \ |
88 |
| - if (ms_available) \ |
89 |
| - this->m_model_selection_parameters->add(param, name, description); \ |
| 86 | + name, param, AnyParameterProperties()); \ |
90 | 87 | }
|
91 | 88 |
|
92 |
| -#define SG_ADD5(param, name, description, ms_available, gradient_available) \ |
| 89 | +#define SG_ADD4(param, name, description, param_properties) \ |
93 | 90 | { \
|
| 91 | + AnyParameterProperties pprop = \ |
| 92 | + AnyParameterProperties(description, param_properties); \ |
94 | 93 | this->m_parameters->add(param, name, description); \
|
95 |
| - this->watch_param( \ |
96 |
| - name, param, AnyParameterProperties( \ |
97 |
| - description, ms_available, gradient_available)); \ |
98 |
| - if (ms_available) \ |
| 94 | + this->watch_param(name, param, pprop); \ |
| 95 | + if (pprop.get_model_selection()) \ |
99 | 96 | this->m_model_selection_parameters->add(param, name, description); \
|
100 |
| - if (gradient_available) \ |
| 97 | + if (pprop.get_gradient()) \ |
101 | 98 | this->m_gradient_parameters->add(param, name, description); \
|
102 | 99 | }
|
103 | 100 |
|
104 | 101 | #define SG_ADD(...) VARARG(SG_ADD, __VA_ARGS__)
|
105 | 102 |
|
106 | 103 | /*******************************************************************************
|
107 |
| - * End of macros for registering parameters/model selection parameters |
| 104 | + * End of macros for registering parameter properties |
108 | 105 | ******************************************************************************/
|
109 | 106 |
|
110 | 107 | /** @brief Class SGObject is the base class of all shogun objects.
|
|
0 commit comments