YAC 3.21.0
Yet Another Coupler
Loading...
Searching...
No Matches
param_oneof.h File Reference
#include "parameter/param.h"
Include dependency graph for param_oneof.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef int(* yac_param_oneof_factory_ptr) (const char *name, void **obj, struct yac_param **param, int *is_default)
 Function pointer type for creating a default subparameter and associated object for a oneof parameter.
 

Functions

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.
 

Typedef Documentation

◆ yac_param_oneof_factory_ptr

typedef int(* yac_param_oneof_factory_ptr) (const char *name, void **obj, struct yac_param **param, int *is_default)

Function pointer type for creating a default subparameter and associated object for a oneof parameter.

The function must allocate and return both a new object (void*) and its associated yac_param pointer. The object is the user data, the parameter is the config param object for that subparameter.

Parameters
nameName of the subparameter to create. If NULL, the factory must create the default selection.
[out]objPointer to the new object (void*)
[out]paramPointer to the new yac_param*
[out]is_defaultFlag (int) indicating if this is the default subparameter
Returns
0 on success, nonzero on error

Definition at line 27 of file param_oneof.h.

Function Documentation

◆ 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: