18.2.97. PMIx_Value_load
PMIx_Value_load — Copy typed data into a
pmix_value_t(5) structure.
18.2.97.1. SYNOPSIS
#include <pmix.h>
pmix_status_t PMIx_Value_load(pmix_value_t *val,
const void *data,
pmix_data_type_t type);
18.2.97.1.1. Python Syntax
No Python equivalent
18.2.97.2. INPUT/OUTPUT PARAMETERS
val: Pointer to the destination pmix_value_t(5) structure. On return, itstypefield is set totypeand itsdataunion holds a copy of the supplied data.
18.2.97.3. INPUT PARAMETERS
data: Pointer to the source data to be copied intoval. May beNULL, in which case the value’s payload is zeroed (and, whentypeisPMIX_BOOL, the boolean flag is set totrueto reflect that the mere presence of the attribute implies “true”).type: The pmix_data_type_t(5) describing the data being loaded.
18.2.97.4. DESCRIPTION
Load data of an arbitrary PMIx data type into a
pmix_value_t(5). The data is copied into the
value structure; the caller retains ownership of the original data and
may free or modify it after the call returns. For types that own heap
storage (strings, byte objects, data arrays, and similar), the copy is a
deep copy, so the resulting value must eventually be released with
PMIx_Value_destruct(3) or
PMIx_Value_free(3).
Because a single pmix_value_t(5) can hold any
PMIx type — including a compound pmix_data_array_t — the
load operation dispatches on type to copy the appropriate union member.
PMIx_Value_load is the inverse of
PMIx_Value_unload(3), which extracts a copy
of the data back out of a value.
18.2.97.5. RETURN VALUE
Returns PMIX_SUCCESS on completion.
18.2.97.6. NOTES
PMIx_Value_load is an OpenPMIx convenience routine. The corresponding
macro-style interface for this operation is PMIX_VALUE_LOAD.
18.2.97.7. EXAMPLES
Load a string into a value:
pmix_value_t val;
PMIx_Value_construct(&val);
PMIx_Value_load(&val, "example", PMIX_STRING);
/* ... use val ... */
PMIx_Value_destruct(&val);