00001
00002
00003 #include "h5Attribute.h"
00004 #include "h5Object.h"
00005 #include "h5Group.h"
00006 #include "h5String.h"
00007 #include <assert.h>
00008
00009 int clH5Group_read_attribute(rcComm_t *conn, H5Group* ing)
00010 {
00011 int ret_value = 0;
00012 H5Group* outg = NULL;
00013
00014 assert(ing);
00015
00016 ing->opID = H5GROUP_OP_READ_ATTRIBUTE;
00017
00018 ret_value = _clH5Group_read_attribute (conn, ing, &outg);
00019 if( NULL == &outg ) {
00020 rodsLog( LOG_ERROR, "clH5Group_read_attribute :: failed to initialize outg" );
00021 return 0;
00022 }
00023
00024 if (ret_value < 0)
00025 return (ret_value);
00026
00027
00028 ing->error = outg->error;
00029 ing->nattributes = outg->nattributes;
00030 ing->attributes = outg->attributes;
00031
00032 outg->attributes = NULL;
00033 outg->nattributes = 0;
00034
00035 H5Group_dtor (outg);
00036 free (outg);
00037
00038 return ret_value;
00039 }
00040
00041 int _clH5Group_read_attribute(rcComm_t *conn, H5Group* ing, H5Group** outg)
00042 {
00043 execMyRuleInp_t execMyRuleInp;
00044 msParamArray_t *outParamArray = NULL;
00045 msParamArray_t msParamArray;
00046 msParam_t *outMsParam;
00047 int status = 0;
00048
00049 memset (&execMyRuleInp, 0, sizeof (execMyRuleInp));
00050 memset (&msParamArray, 0, sizeof (msParamArray));
00051 execMyRuleInp.inpParamArray = &msParamArray;
00052
00053
00054 rstrcpy (execMyRuleInp.myRule,
00055 "H5File_open||msiH5Group_read_attribute(*ING,*OUTG)|nop", META_STR_LEN);
00056
00057 rstrcpy (execMyRuleInp.outParamDesc, "*OUTG", LONG_NAME_LEN);
00058 #if 0
00059 addMsParamToArray (execMyRuleInp.inpParamArray, "*ING", h5Dataset_MS_T, ing,
00060 #endif
00061 addMsParamToArray (execMyRuleInp.inpParamArray, "*ING", h5Group_MS_T, ing,
00062 NULL, 0);
00063
00064 status = rcExecMyRule (conn, &execMyRuleInp, &outParamArray);
00065
00066 if (status < 0) {
00067 rodsLogError (LOG_ERROR, status,
00068 "_clH5Group_read_attribute: rcExecMyRule error for %s.",
00069 ing->fullpath);
00070 clearMsParamArray (execMyRuleInp.inpParamArray, 0);
00071 return (status);
00072 }
00073
00074 if ((outMsParam = getMsParamByLabel (outParamArray, "*OUTG")) == NULL) {
00075 status = USER_PARAM_LABEL_ERR;
00076 rodsLogError (LOG_ERROR, status,
00077 "_clH5Group_read_attribute: outParamArray does not contain OUTG for %s.",
00078 ing->fullpath);
00079 } else {
00080 *outg = (H5Group*)outMsParam->inOutStruct;
00081 clearMsParamArray (outParamArray, 0);
00082 free (outParamArray);
00083 }
00084
00085 clearMsParamArray (execMyRuleInp.inpParamArray, 0);
00086
00087 return (status);
00088 }
00089