Hello
My question is : *How can I get the child object name in the order of
created under some farther group node? *
for example:
//
//---------------code------------------
//
//1. I create 3 group node under "/123"
hid_t file = H5Fopen(HDF_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
hid_t parentNode = H5Gopen(file, "/123");
hid_t childNode1 = H5Gcreate(parentNode, "789", 0);
hid_t childNode2 = H5Gcreate(parentNode, "456", 0);
hid_t childNode3 = H5Gcreate(parentNode, "678", 0);
//2.Get the child group node under "/123"
hsize_t num_objs = 0;
herr_t ret = H5Gget_num_objs(parentNode, &num_objs);
char childNode[4][10] = {0};
int objType = 0;
for (int i=0; i<num_objs; i++)
{
objType = H5Gget_objtype_by_idx(parentNode, i);
if (objType == H5G_GROUP)
{
H5Gget_objname_by_idx(parentNode, i, childNode[i], 10);
}
}
//3.Result
The return order is in inscendent order:456,678,789.
//childNode[0]="456",childNode[1]="678",childNode[0]="789",
Not the order of created:<b>789,456,678.*
//----------------end------------------
*How can I get the node array in the order of created? *
It sets the ordering of links in a group to follow creation order. I did not check wether the
order of any object (i.e. an actual dataset) is also tracked.
···
Le 19 août 11 à 12:16, hansin a écrit :
Hello
My question is : *How can I get the child object name in the order of
created under some farther group node? *
for example:
//
//---------------code------------------
//
//1. I create 3 group node under "/123"
hid_t file = H5Fopen(HDF_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT);
hid_t parentNode = H5Gopen(file, "/123");
hid_t childNode1 = H5Gcreate(parentNode, "789", 0);
hid_t childNode2 = H5Gcreate(parentNode, "456", 0);
hid_t childNode3 = H5Gcreate(parentNode, "678", 0);
//2.Get the child group node under "/123"
hsize_t num_objs = 0;
herr_t ret = H5Gget_num_objs(parentNode, &num_objs);
char childNode[4][10] = {0};
int objType = 0;
for (int i=0; i<num_objs; i++)
{
objType = H5Gget_objtype_by_idx(parentNode, i);
if (objType == H5G_GROUP)
{
H5Gget_objname_by_idx(parentNode, i, childNode[i], 10);
}
}
//3.Result
The return order is in inscendent order:456,678,789.
//childNode[0]="456",childNode[1]="678",childNode[0]="789",
Not the order of created:<b>789,456,678.*
//----------------end------------------
*How can I get the node array in the order of created? *