18.2.135. PMIx_Pdata_load

PMIx_Pdata_load — Populate a pmix_pdata_t(5) structure with a process identifier, key, and value.

18.2.135.1. SYNOPSIS

#include <pmix.h>

void PMIx_Pdata_load(pmix_pdata_t *dest,
                     const pmix_proc_t *p,
                     const char *key,
                     const void *data,
                     pmix_data_type_t type);

18.2.135.1.1. Python Syntax

No Python equivalent

18.2.135.2. INPUT/OUTPUT PARAMETERS

  • dest: Pointer to the destination pmix_pdata_t(5) structure to be populated. Any prior contents are overwritten without being released.

18.2.135.3. INPUT PARAMETERS

  • p: Pointer to a pmix_proc_t(5) whose namespace and rank are copied into dest->proc.

  • key: String key to copy into dest->key.

  • data: Pointer to the value payload to store, or NULL.

  • type: The pmix_data_type_t(5) describing the object referenced by data.

18.2.135.4. DESCRIPTION

Populate the dest structure in a single operation. The function first zeroes dest, then copies the process identifier (namespace and rank) from p, copies the key string (truncated to the fixed pmix_key_t length), and loads the supplied data into dest->value according to type.

The value is copied into dest — the library allocates its own storage for any data that requires it, so the caller’s data buffer need not remain valid after the call. Because PMIx_Pdata_load overwrites dest without releasing any previous contents, only call it on a freshly constructed or otherwise empty structure to avoid leaking a prior payload.

18.2.135.5. RETURN VALUE

PMIx_Pdata_load returns no value (void).

18.2.135.6. NOTES

The memory populated by PMIx_Pdata_load should ultimately be released with PMIx_Pdata_destruct(3) (for a caller-provided structure) or PMIx_Pdata_free(3) (for an element of an array created with PMIx_Pdata_create(3)).

18.2.135.7. EXAMPLES

Load a string value into a pdata structure:

pmix_pdata_t pdata;
pmix_proc_t proc;
char *val = "example";

PMIx_Proc_load(&proc, "mynspace", 0);
PMIx_Pdata_construct(&pdata);
PMIx_Pdata_load(&pdata, &proc, "mykey", val, PMIX_STRING);
/* ... */
PMIx_Pdata_destruct(&pdata);