int
saf_data_has_been_written_to_comp_field(SAF_ParMode pmode, /* The parallel mode. */
SAF_Field *field, /* The field handle. */
hbool_t *Presult /* [OUT] A pointer to caller supplied memory which is to receive the
* answer to the question. A value of true is saved at this
* location if the field has had data written to it, false if
* not. */
)
{
SAF_ENTER(saf_data_has_been_written_to_comp_field, SAF_PRECONDITION_ERROR);
hbool_t l_succeeded = FALSE;
SAF_Field *l_componentFields=NULL, parentField;
int l_numComponents=0;
SAF_REQUIRE(_saf_valid_pmode(pmode), SAF_LOW_CHK_COST, SAF_PRECONDITION_ERROR,
_saf_errmsg("PMODE must be valid"));
if (!_saf_is_participating_proc(pmode)) SAF_RETURN(-1);
SAF_REQUIRE(SS_FIELD(field), SAF_LOW_CHK_COST, SAF_PRECONDITION_ERROR,
_saf_errmsg("FIELD must be a valid field handle for all participating processes"));
saf_describe_field(pmode, field, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
&l_numComponents, &l_componentFields, NULL, NULL);
_saf_find_parent_field(pmode, field, &parentField);
if (l_componentFields && l_numComponents) {
int i;
for (i=0; i<l_numComponents; i++) {
/* There wont be an endless loop as long as saf_data_has_been_written_to_field doesnt call
* saf_data_has_been_written_to_comp_field */
saf_data_has_been_written_to_field(pmode, l_componentFields+i, &l_succeeded);
if (!l_succeeded) break;
}
} else if (!SAF_EQUIV(field,&parentField)) {
saf_data_has_been_written_to_field( pmode, &parentField, &l_succeeded);
}
if (Presult) *Presult = l_succeeded;
SAF_LEAVE(SAF_SUCCESS);
}