static void _add_ddi(void *key, T_KRDDI *krddi, cJSON *ddis) { cJSON *ddi = cJSON_CreateObject(); cJSON_AddNumberToObject(ddi, "id", krddi->lDDIId); cJSON_AddNumberToObject(ddi, "valueind", krddi->eValueInd); _set_cjson_field(krddi->eValueType, "value", &krddi->uValue, ddi); /*add related*/ cJSON *related = cJSON_CreateArray(); kr_hashtable_foreach(krddi->ptRelated, (KRHFunc )_set_cjson_related, related); cJSON_AddItemToObject(ddi, "related", related); cJSON_AddItemToArray(ddis, ddi); }
static void _add_hdis_to_data(T_KRHashTable *ptHdiTable, cJSON *datas) { cJSON *hdis = cJSON_CreateArray(); kr_hashtable_foreach(ptHdiTable, (KRHFunc )_add_hdi, hdis); cJSON_AddItemToObject(datas, "hdis", hdis); }
void kr_hashset_dump(T_KRHashSet *krset, FILE *fp) { fprintf(fp, "dump set:[%s][%c]\n", krset->name, krset->type); kr_hashtable_foreach(krset->set, (KRHFunc )_dump_set, fp); }
void _add_ddis_to_data(T_KRHashTable *dditable, cJSON *datas) { cJSON *ddis = cJSON_CreateArray(); kr_hashtable_foreach(dditable, (KRHFunc )_add_ddi, ddis); cJSON_AddItemToObject(datas, "ddis", ddis); }
void kr_hdi_table_init(T_KRHDITable *ptHdiTable) { kr_hashtable_foreach(ptHdiTable->ptHDITable, _kr_hdi_init_hfunc, NULL); }
void kr_ddi_table_init(T_KRDDITable *ptDdiTable) { kr_hashtable_foreach(ptDdiTable->ptDDITable, _kr_ddi_init_hfunc, NULL); }
static void kr_hdi_cache_node_dump(T_KRHashTable *cache_table, FILE *fp) { kr_hashtable_foreach(cache_table, (KRHFunc )kr_hdi_cache_value_dump, fp); }