61 struct yac_param *param,
const char *value_str) {
66 "No value provided for boolean parameter '%s'", self->
name);
71 "'%s' is not a valid bool value for parameter '%s'",
72 value_str, self->
name);
79 const struct yac_param *param,
char *buf,
size_t buflen) {
82 if (!self || !self->
value_ptr || !buf)
return 1;
85 "value for parameter '%s' is undefined, user must set it first",
93 int n = snprintf(buf, buflen,
"%s", str);
95 (n >= 0) && ((
size_t)n < buflen),
96 "buffer too small for value '%s' of parameter '%s'", str, self->
name);
126 "value for parameter '%s' is undefined, user must set it first",
146 .get_sub_count = NULL,
147 .get_sub_by_name = NULL,
148 .get_sub_by_index = NULL,
154 .set_scalar_dble = NULL,
156 .get_scalar_dble = NULL
160 const char *
name,
int *value_ptr,
int default_value,
int has_default,
165 !is_defined || ((*value_ptr == 0) || (*value_ptr == 1)),
166 "initial value %d is not a valid bool for parameter '%s'",
#define YAC_ASSERT(exp, msg)
int yac_name_type_pair_get_type(struct yac_name_type_pair const *pairs, size_t count, char const *name)
char const * yac_name_type_pair_get_name(struct yac_name_type_pair const *pairs, size_t count, int type)
yac_param_scalar_kind
Scalar parameter storage kind.
@ YAC_PARAM_SCALAR_KIND_INT
Scalar value backed by int storage.
yac_param_type
Parameter type for generic configuration interface.
@ YAC_PARAM_TYPE_SCALAR
Single typed value (e.g., int, double, string, enum)
static int yac_param_bool_set_scalar(struct yac_param *param, const char *value_str)
static void yac_param_bool_delete(struct yac_param *param)
static int yac_param_bool_set_scalar_int(struct yac_param *param, int value)
struct yac_param * yac_param_bool_new(const char *name, int *value_ptr, int default_value, int has_default, int is_defined)
Create a bool parameter (backed by int)
static const char * yac_param_bool_get_name(const struct yac_param *param)
static int yac_param_bool_get_scalar_kind(const struct yac_param *param, enum yac_param_scalar_kind *scalar_kind)
static int yac_param_bool_get_scalar_int(const struct yac_param *param, int *value)
static enum yac_param_type yac_param_bool_get_type(const struct yac_param *param)
static int yac_param_bool_is_default(const struct yac_param *param)
static const struct yac_name_type_pair bool_table[]
static const struct yac_param_vtable yac_param_bool_vtable
static int yac_param_bool_get_scalar(const struct yac_param *param, char *buf, size_t buflen)
#define YAC_PARAM_ASSERT(COND,...)
#define YAC_PARAM_CHECK_BASIC()
const struct yac_param_vtable * vtable
enum yac_param_type(* get_type)(const struct yac_param *param)
#define YAC_ASSERT_F(exp, format,...)