YAC 3.21.0
Yet Another Coupler
Loading...
Searching...
No Matches
param_list.h File Reference
#include "param_internal.h"
#include <stddef.h>
Include dependency graph for param_list.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_factory_ptr) (void **element_ptr, struct yac_param **param_ptr)
 Function pointer type for creating a default element and associated parameter for a list parameter.
 
typedef int(* yac_param_element_get_param_ptr) (void *element, struct yac_param **param_ptr)
 Function pointer type for creating a param for an existing element.
 

Functions

struct yac_param * yac_param_list_new (const char *name, void ***list, yac_param_factory_ptr default_factory, yac_param_element_get_param_ptr element_get_param)
 Create a new list parameter.
 

Typedef Documentation

◆ yac_param_element_get_param_ptr

typedef int(* yac_param_element_get_param_ptr) (void *element, struct yac_param **param_ptr)

Function pointer type for creating a param for an existing element.

Called during list param initialisation for each element that already exists in the backing array. If NULL, existing elements have no param.

Parameters
[in]elementExisting element (void *)
[out]param_ptrOutput: param object for this element
Returns
0 on success, nonzero on error

Definition at line 37 of file param_list.h.

◆ yac_param_factory_ptr

typedef int(* yac_param_factory_ptr) (void **element_ptr, struct yac_param **param_ptr)

Function pointer type for creating a default element and associated parameter for a list parameter.

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

Parameters
[out]element_ptrPointer to the new element (void*)
[out]param_ptrPointer to the new yac_param*
Returns
0 on success, nonzero on error

Definition at line 23 of file param_list.h.

Function Documentation

◆ yac_param_list_new()

struct yac_param * yac_param_list_new ( const char * name,
void *** list,
yac_param_factory_ptr default_factory,
yac_param_element_get_param_ptr element_get_param )

Create a new list parameter.

Ownership of the backing list and list elements always stays with the caller. The constructor only wraps configuration params around the elements.

If element_get_param is NULL, *list must be NULL (no pre-existing elements).

Parameters
nameName of the list parameter
listPointer to the backing NULL-terminated array
default_factoryFactory for new (appended) elements and params
element_get_paramFactory to get the param for an already-existing element; may be NULL only when *list is NULL
Returns
Pointer to new list parameter object

Definition at line 134 of file param_list.c.

Here is the caller graph for this function: