You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Convert the PMIX_VALUE_GET_NUMBER macro to a function
Converting this macro to a PMIx_Value_get_number function requires
a signature change - it is no longer possible to pass the C datatype
for casting the result. Instead, we now pass the PMIx datatype that
corresponds to the desired C casting. We also extend the function
to return a new PMIX_ERR_LOST_PRECISION status when the casting
can potentially cause a loss of precision - e.g., when changing from
a "float" to an "int" - and a new PMIX_ERR_CHANGE_SIGN status
when the casting would cause a change in sign - e.g., when changing
from a negative integer to a "size_t".
Signed-off-by: Ralph Castain <[email protected]>
The operation is considered successful but not all elements of the operation were concluded (e.g., some members of a group construct operation chose not to participate).
The returned value is of a data type that may have lost precision when converted from the original value - e.g., when converting a \code{float} to an \code{int}.
The returned value is of a data type that would cause a change in sign when converted from the original value - e.g., when converting a negative integer to a \code{size_t}.
\littleheader{Retrieve a numerical value from a value struct}
1171
-
\declaremacro{PMIX_VALUE_GET_NUMBER}
1178
+
\declareapiProvisional{PMIx_Value_get_number}
1172
1179
1173
1180
Retrieve a numerical value from a \refstruct{pmix_value_t} structure.
1174
1181
1175
-
\copySignature{PMIX_VALUE_GET_NUMBER}{3.0}{
1176
-
PMIX_VALUE_GET_NUMBER(s, m, n, t)
1182
+
\copySignature{PMIx_Value_get_number}{6.0}{
1183
+
pmix_status_t \\
1184
+
PMIx_Value_get_number(pmix_value_t *m,
1185
+
\hspace*{24\sigspace}void *d,
1186
+
\hspace*{24\sigspace}pmix_data_type_t t);
1177
1187
}
1178
1188
1179
1189
\begin{arglist}
1180
-
\argout{s}{Status code for the request (\refstruct{pmix_status_t})}
1181
1190
\argin{m}{Pointer to the\refstruct{pmix_value_t} structure (handle)}
1182
-
\argout{n}{Variable to be set to the value}
1183
-
\argin{t}{Type of number to be returned in \refarg{m} (\code{C data type})}
1191
+
\argout{d}{Pointer to the variable to be set to the value (\code{void*})}
1192
+
\argin{t}{Type of number to be returned in \refarg{d} (\refstruct{pmix_data_type_t})}
1184
1193
\end{arglist}
1185
1194
1186
-
Sets the provided variable equal to the numerical value contained in the given \refstruct{pmix_value_t}, returning success if the data type of the value is a recognized numerical type - the \refconst{PMIX_ERR_BAD_PARAM} error is
1187
-
returned if the value contains a non-numerical type. The returned value is type cast to the
1188
-
provided C-language data type. It is therefore possible to lose precision - e.g., if the \refstruct{pmix_value_t}
1189
-
contains a \refconst{PMIX_FLOAT} and the macro invocation requests that the returned value be type cast to an
1190
-
\code{int}.
1195
+
Sets the destination variable equal to the numerical value contained in the given \refstruct{pmix_value_t}.
1196
+
The \refconst{PMIX_ERR_BAD_PARAM} error is returned if the \refstruct{pmix_value_t} contains a non-numerical
1197
+
type. If the destination type (as provided in the \refarg{t} parameter) matches that of the value, then
1198
+
the value is simply transferred across.
1199
+
1200
+
If transfer of the value to the destination would result in a loss of precision - e.g., if the \refstruct{pmix_value_t}
1201
+
contains a \refconst{PMIX_FLOAT} and the function invocation passes an
1202
+
\code{int} for the destination, the value will not be transferred and the returned status will be \refconst{PMIX_ERR_LOST_PRECISION}.
1203
+
1204
+
If the transfer could result in a change in sign - e.g., if the \refstruct{pmix_value_t} contains a negative
1205
+
integer while the function invocation passes a \code{size_t} for the destination, value will not be
1206
+
transferred and the returned status will be \refconst{PMIX_ERR_CHANGE_SIGN}.
1207
+
1208
+
In all other cases (e.g., the value contains a \code{uint8_t} while the destination is a \code{uint16_t}), the value will
1209
+
be transferred to the destination and a \refconst{PMIX_SUCCESS} status will be returned.
0 commit comments