PMIx_Value_get_number - Man Page

PMIx_Value_get_number — Extract a numerical value from a pmix_value_t

Synopsis

#include <pmix.h>

pmix_status_t PMIx_Value_get_number(const pmix_value_t *val,
                                    void *dest,
                                    pmix_data_type_t type;

Python Syntax

No Python equivalent - the pmix_value_t equivalent in Python is a dictionary containing a value and type field. It is therefore unnecessary to provide an equivalent function.

Input Parameters

Description

The PMIx_Value_get_number function compares the datatype provided with the datatype found in the given val, taking one of the following actions:

Note:

The caller must provide backing memory for the value being returned. This function will not allocate memory. In addition, this function is only usable when retrieving numerical values - the PMIx_Value_unload(3) <#man3-pmix-value-unload> function should be used for all non-numerical values

Return Value

Returns PMIX_SUCCESS on success. On error, a negative value corresponding to a PMIx errno is returned.

Examples

Unloading an int32_t:

pmix_value_t val;
int32_t i32;
pmix_status_t rc;

val.type = PMIX_INT32;
val.data.int32 = 1234;

rc = PMIx_Value_get_number(&val, (void*)&i32, PMIX_INT32);

On return of PMIX_SUCCESS, the variable i32 will contain a value of 1234​. Similarly, the following use-case:

pmix_value_t val;
int16_t i16;
pmix_status_t rc;

val.type = PMIX_INT32;
val.data.int32 = 1234;

rc = PMIx_Value_get_number(&val, (void*)&i16, PMIX_INT16);

would also return PMIX_SUCCESS, with the variable i16 containing a value of 1234 because that value lies within the range of an int16_t​.

Similarly:

pmix_value_t val;
int32_t i32;
pmix_status_t rc;

val.type = PMIX_FLOAT;
val.data.fval = -1234.567;

rc = PMIx_Value_get_number(&val, (void*)&i32, PMIX_INT32);

would return PMIX_SUCCESS, with the variable i32 containing a value of -1234 which truncates the floating number, but:

pmix_value_t val;
uint32_t u32;
pmix_status_t rc;

val.type = PMIX_FLOAT;
val.data.fval = -1234.567;

rc = PMIx_Value_get_number(&val, (void*)&u32, PMIX_UINT32);

would return PMIX_ERR_CHANGE_SIGN as the sign requirements conflict.

See also:

pmix_value_t(5) <#man5-pmix-value-t>

Info

Feb 27, 2026 OpenPMIx