00001
00002
00003 #include "h5File.h"
00004 #include <assert.h>
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 int clH5File_open(rcComm_t *conn, H5File* f)
00016 {
00017 int ret_value = 0;
00018 H5File *outf = NULL;
00019
00020
00021 assert(f);
00022
00023 ret_value = _clH5File_open(conn, f, &outf, 0);
00024
00025 if( outf == NULL )
00026 return 0;
00027
00028
00029 if (ret_value < 0)
00030 return (ret_value);
00031
00032 f->fid = outf->fid;
00033 f->root = outf->root;
00034 outf->root = NULL;
00035 f->error = outf->error;
00036
00037 H5File_dtor(outf);
00038 if (outf)
00039 free(outf);
00040
00041 return ret_value;
00042 }
00043
00044 int _clH5File_open(rcComm_t *conn, H5File* inf, H5File** outf, int flag)
00045 {
00046 execMyRuleInp_t execMyRuleInp;
00047 msParamArray_t *outParamArray = NULL;
00048 msParamArray_t msParamArray;
00049 msParam_t *outMsParam;
00050 int status = 0;
00051
00052
00053 memset (&execMyRuleInp, 0, sizeof (execMyRuleInp));
00054 memset (&msParamArray, 0, sizeof (msParamArray));
00055 execMyRuleInp.inpParamArray = &msParamArray;
00056
00057
00058 rstrcpy (execMyRuleInp.myRule,
00059 "H5File_open||msiH5File_open(*INF,*FLAG,*OUTF)|nop", META_STR_LEN);
00060
00061 rstrcpy (execMyRuleInp.outParamDesc, "*OUTF", LONG_NAME_LEN);
00062
00063 addMsParamToArray (execMyRuleInp.inpParamArray, "*INF", h5File_MS_T, inf,
00064 NULL, 0);
00065 addMsParamToArray (execMyRuleInp.inpParamArray, "*FLAG", INT_MS_T, &flag,
00066 NULL, 0);
00067
00068 status = rcExecMyRule (conn, &execMyRuleInp, &outParamArray);
00069
00070 if (status < 0) {
00071 rodsLogError (LOG_ERROR, status,
00072 "_clH5File_open: rcExecMyRule error for %s.",
00073 inf->filename);
00074 clearMsParamArray (execMyRuleInp.inpParamArray, 0);
00075 return (status);
00076 }
00077
00078 if ((outMsParam = getMsParamByLabel (outParamArray, "*OUTF")) == NULL) {
00079 status = USER_PARAM_LABEL_ERR;
00080 rodsLogError (LOG_ERROR, status,
00081 "_clH5File_open: outParamArray does not contain OUTF for %s.",
00082 inf->filename);
00083 } else {
00084 *outf = (H5File*) outMsParam->inOutStruct;
00085 clearMsParamArray (outParamArray, 0);
00086
00087
00088 }
00089
00090 clearMsParamArray (execMyRuleInp.inpParamArray, 0);
00091
00092 return (status);
00093 }
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 int clH5File_close (rcComm_t *conn, H5File* f)
00105 {
00106 int ret_value = 0;
00107 H5File inf, *outf = NULL;
00108
00109
00110 assert(f);
00111
00112 memset (&inf, 0, sizeof (inf));
00113
00114 inf.fid = f->fid;
00115 inf.opID = f->opID;
00116
00117 ret_value = _clH5File_close (conn, &inf, &outf);
00118 if( NULL == outf ) {
00119 rodsLog( LOG_ERROR, "clH5File_close :: outf is null" );
00120 return 0;
00121 }
00122
00123 if (ret_value < 0)
00124 return (ret_value);
00125
00126 f->error = outf->error;
00127
00128 H5File_dtor(outf);
00129 if (outf)
00130 free(outf);
00131
00132 return ret_value;
00133 }
00134
00135 int _clH5File_close (rcComm_t *conn, H5File* inf, H5File** outf)
00136 {
00137 execMyRuleInp_t execMyRuleInp;
00138 msParamArray_t *outParamArray = NULL;
00139 msParamArray_t msParamArray;
00140 msParam_t *outMsParam;
00141 int status = 0;
00142
00143
00144 memset (&execMyRuleInp, 0, sizeof (execMyRuleInp));
00145 memset (&msParamArray, 0, sizeof (msParamArray));
00146 execMyRuleInp.inpParamArray = &msParamArray;
00147
00148
00149 rstrcpy (execMyRuleInp.myRule,
00150 "H5File_close||msiH5File_close(*INF,*OUTF)|nop", META_STR_LEN);
00151
00152 rstrcpy (execMyRuleInp.outParamDesc, "*OUTF", LONG_NAME_LEN);
00153
00154 addMsParamToArray (execMyRuleInp.inpParamArray, "*INF", h5File_MS_T, inf,
00155 NULL, 0);
00156
00157 status = rcExecMyRule (conn, &execMyRuleInp, &outParamArray);
00158
00159 if (status < 0) {
00160 rodsLogError (LOG_ERROR, status,
00161 "_clH5File_close: rcExecMyRule error for %s.",
00162 inf->filename);
00163 clearMsParamArray (execMyRuleInp.inpParamArray, 0);
00164 return (status);
00165 }
00166
00167 if ((outMsParam = getMsParamByLabel (outParamArray, "*OUTF")) == NULL) {
00168 status = USER_PARAM_LABEL_ERR;
00169 rodsLogError (LOG_ERROR, status,
00170 "_clH5File_close: outParamArray does not contain OUTF");
00171 } else {
00172 *outf = (H5File*)outMsParam->inOutStruct;
00173 clearMsParamArray (outParamArray, 0);
00174 free (outParamArray);
00175 }
00176
00177 clearMsParamArray (execMyRuleInp.inpParamArray, 0);
00178
00179 return (status);
00180 }
00181