/*static dataitem*/ T_KRDDI *kr_ddi_construct(T_KRParamDDIDef *ptParamDDIDef, T_KRModule *ptModule, KRGetTypeFunc pfGetType, KRGetValueFunc pfGetValue) { T_KRDDI *ptDDI = kr_calloc(sizeof(T_KRDDI)); if (ptDDI == NULL) { KR_LOG(KR_LOGERROR, "kr_calloc ptDDI failed!"); return NULL; } ptDDI->ptParamDDIDef = ptParamDDIDef; ptDDI->lDDIId = ptParamDDIDef->lDdiId; ptDDI->ptDDICalc = kr_calc_construct(ptParamDDIDef->caDdiFilterFormat[0], \ ptParamDDIDef->caDdiFilterString, pfGetType, pfGetValue); ptDDI->eValueType = ptParamDDIDef->caDdiValueType[0]; /*get the retrieve data function from module*/ if (ptParamDDIDef->caDdiAggrFunc[0] != '\0') { ptDDI->pfDDIAggr = (KRDDIAggrFunc )kr_module_symbol(ptModule, ptParamDDIDef->caDdiAggrFunc); if (ptDDI->pfDDIAggr == NULL) { KR_LOG(KR_LOGERROR, "kr_module_symbol [%s] error!", \ ptParamDDIDef->caDdiAggrFunc); return NULL; } } ptDDI->eValueInd = KR_VALUE_UNSET; ptDDI->ptRelated = kr_hashtable_new(kr_pointer_hash, kr_pointer_equal); return ptDDI; }
/*history dataitem*/ T_KRHDI *kr_hdi_construct(T_KRParamHDIDef *ptParamHDIDef, T_KRModule *ptModule) { T_KRHDI *ptHDI = kr_calloc(sizeof(T_KRHDI)); if (ptHDI == NULL) { KR_LOG(KR_LOGERROR, "kr_calloc ptHDI failed!"); return NULL; } ptHDI->ptParamHDIDef = ptParamHDIDef; ptHDI->lHDIId = ptParamHDIDef->lHdiId; ptHDI->eValueType = ptParamHDIDef->caHdiValueType[0]; /*get the retrieve data function from module*/ if (ptParamHDIDef->caHdiAggrFunc[0] != '\0') { ptHDI->pfHDIAggr = (KRHDIAggrFunc )kr_module_symbol(ptModule, ptParamHDIDef->caHdiAggrFunc); if (ptHDI->pfHDIAggr == NULL) { KR_LOG(KR_LOGERROR, "kr_module_symbol [%s] error!", \ ptParamHDIDef->caHdiAggrFunc); return NULL; } } ptHDI->ptCurrRec = NULL; return ptHDI; }
/*history dataitem*/ T_KRHDI *kr_hdi_construct(T_KRShmHDIDef *hdi_def, T_KRModule *datamodule) { T_KRHDI *krhdi = kr_calloc(sizeof(T_KRHDI)); if (krhdi == NULL) { KR_LOG(KR_LOGERROR, "kr_calloc krhdi failed!"); return NULL; } krhdi->ptShmHDIDef = hdi_def; krhdi->lHDIId = hdi_def->lHdiId; krhdi->eValueType = hdi_def->caHdiValueType[0]; /*get the retrieve data function from module*/ if (hdi_def->caHdiAggrFunc[0] != '\0') { krhdi->HDIAggrFunc = (KRHDIAggrFunc )kr_module_symbol(datamodule, hdi_def->caHdiAggrFunc); if (krhdi->HDIAggrFunc == NULL) { KR_LOG(KR_LOGERROR, "kr_module_symbol [%s] error!", \ hdi_def->caHdiAggrFunc); return NULL; } } krhdi->ptCurrRec = NULL; return krhdi; }