Return a structure/class descriptor.
MCO_RET mco_dict_struct( /*IN*/ mco_metadict_header_t * metadict,
/*IN*/ unsigned short dict_no,
/*IN*/ unsigned short struct_no,
/*OUT*/ mco_dict_struct_info_t * struct_info );
| metadict | The address of an initialized mco_metadict_header_t structure |
|
dict_no |
The number of the dictionary (must be between 0 and |
|
struct_no |
The structure/class number (must be between 0 and |
|
struct_info |
The address of a |
This function returns the structure/class descriptor referred to by the index
dict_noin the arraymetadict->entries[]and class/structure numberstruct_no.
| MCO_S_OK | The structure/class descriptor was successfully returned |
| MCO_E_UDA_DICT_NOTFOUND | The dictionary is not registered |
| MCO_E_UDA_STRUCT_NOTFOUND | Invalid struct_no |
Application snippet:
const char * dbname = "SimpleDb";
int main(int argc, char* argv[])
{
MCO_RET rc;
unsigned int dict_no = 0;
unsigned int count;
mco_metadict_header_t *header;
...
header = (mco_metadict_header_t *) malloc(size);
mco_metadict_init(header, size); /* initialize the metadict */
...
mco_dict_struct_count(header, dict_no, &count);
for (i = 0; i < count; ++i)
{
mco_dict_struct_info_t struct_info;
/* get structure descriptor */
rc = mco_dict_struct(header, dict_no, i, &struct_info);
if (struct_info.flags & MCO_DICT_SI_CLASS) {
printf("Class %d : %s\n", i, struct_info.name);
} else {
printf("Structure %d : %s\n", i, struct_info.name);
}
}
...
}