YAC 3.21.0
Yet Another Coupler
Loading...
Searching...
No Matches
param_oneof.c File Reference
#include "param_oneof.h"
#include "param_internal.h"
#include "utils_common.h"
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for param_oneof.c:

Go to the source code of this file.

Data Structures

struct  yac_param_oneof
 

Functions

static enum yac_param_type yac_param_oneof_get_type (const struct yac_param *param)
 
static int yac_param_oneof_is_default (const struct yac_param *param)
 
static const char * yac_param_oneof_get_name (const struct yac_param *param)
 
static int yac_param_oneof_get_sub_count (const struct yac_param *param, size_t *count)
 
static int yac_param_oneof_get_sub_by_index (struct yac_param *param, size_t idx, struct yac_param **sub_param)
 
static int yac_param_oneof_get_sub_by_name (const struct yac_param *param, const char *name, struct yac_param **sub_param)
 
static void yac_param_oneof_delete (struct yac_param *param)
 
struct yac_paramyac_param_oneof_new (const char *name, yac_param_oneof_factory_ptr default_factory, void **value_ptr, struct yac_param *subparam, int subparam_is_default)
 Create a new one-of struct parameter with a given name and a default_factory.
 

Variables

static const struct yac_param_vtable yac_param_oneof_vtable
 

Function Documentation

◆ yac_param_oneof_delete()

static void yac_param_oneof_delete ( struct yac_param * param)
static

Definition at line 115 of file param_oneof.c.

Here is the call graph for this function:

◆ yac_param_oneof_get_name()

static const char * yac_param_oneof_get_name ( const struct yac_param * param)
static

Definition at line 41 of file param_oneof.c.

◆ yac_param_oneof_get_sub_by_index()

static int yac_param_oneof_get_sub_by_index ( struct yac_param * param,
size_t idx,
struct yac_param ** sub_param )
static

Definition at line 56 of file param_oneof.c.

◆ yac_param_oneof_get_sub_by_name()

static int yac_param_oneof_get_sub_by_name ( const struct yac_param * param,
const char * name,
struct yac_param ** sub_param )
static

Definition at line 82 of file param_oneof.c.

Here is the call graph for this function:

◆ yac_param_oneof_get_sub_count()

static int yac_param_oneof_get_sub_count ( const struct yac_param * param,
size_t * count )
static

Definition at line 48 of file param_oneof.c.

◆ yac_param_oneof_get_type()

static enum yac_param_type yac_param_oneof_get_type ( const struct yac_param * param)
static

Definition at line 24 of file param_oneof.c.

◆ yac_param_oneof_is_default()

static int yac_param_oneof_is_default ( const struct yac_param * param)
static

Definition at line 31 of file param_oneof.c.

Here is the call graph for this function:

◆ yac_param_oneof_new()

struct yac_param * yac_param_oneof_new ( const char * name,
yac_param_oneof_factory_ptr default_factory,
void ** obj,
struct yac_param * subparam,
int subparam_is_default )

Create a new one-of struct parameter with a given name and a default_factory.

TODO: fix description The factory is used to create the initial (default) subparameter and its associated object. The pointer to the created object is returned via the obj argument. The caller may pre-set *obj to provide context to the factory.

Parameters
nameName of the struct parameter (must not be NULL or empty)
default_factoryFunction pointer to create the default subparameter and object (must not be NULL)
objPointer to the oneof object pointer. If *obj is NULL, the active subparameter is created lazily via default_factory. If *obj is non-NULL, the oneof is considered already defined.
subparamOptional already-created active subparameter. Must be NULL if *obj is NULL. Ownership is transferred to the returned oneof parameter.
subparam_is_defaultNon-zero if the predefined subparam represents the default choice of the oneof. Only evaluated when *obj is non-NULL (i.e. a predefined subparam is provided); ignored otherwise.
Returns
Pointer to new one-of struct parameter object

Definition at line 145 of file param_oneof.c.

Here is the caller graph for this function:

Variable Documentation

◆ yac_param_oneof_vtable

const struct yac_param_vtable yac_param_oneof_vtable
static
Initial value:
= {
.get_sub_by_name = yac_param_oneof_get_sub_by_name,
.get_sub_by_index = yac_param_oneof_get_sub_by_index,
.append = NULL,
.set_scalar = NULL,
.get_scalar = NULL,
.get_scalar_kind = NULL,
.set_scalar_int = NULL,
.set_scalar_dble = NULL,
.get_scalar_int = NULL,
.get_scalar_dble = NULL
}
static void yac_param_oneof_delete(struct yac_param *param)
static int yac_param_oneof_get_sub_count(const struct yac_param *param, size_t *count)
Definition param_oneof.c:48
static int yac_param_oneof_get_sub_by_name(const struct yac_param *param, const char *name, struct yac_param **sub_param)
Definition param_oneof.c:82
static int yac_param_oneof_get_sub_by_index(struct yac_param *param, size_t idx, struct yac_param **sub_param)
Definition param_oneof.c:56
static const char * yac_param_oneof_get_name(const struct yac_param *param)
Definition param_oneof.c:41
static enum yac_param_type yac_param_oneof_get_type(const struct yac_param *param)
Definition param_oneof.c:24
static int yac_param_oneof_is_default(const struct yac_param *param)
Definition param_oneof.c:31

Definition at line 127 of file param_oneof.c.