示例#1
0
        public static Dictionary <H5I.type_t, List <string> > IterateObject2(hid_t hid)
        {
            var objects = new Dictionary <H5I.type_t, List <string> >();

            H5O.visit(hid, H5.index_t.NAME, H5.iter_order_t.INC,
                      new H5O.iterate_t(
                          delegate(hid_t objectId, IntPtr namePtr, ref H5O.info_t info, IntPtr data)
            {
                var objectName = Marshal.PtrToStringAnsi(namePtr);

                switch (H5I.get_type(objectId))
                {
                case H5I.type_t.GROUP:
                    if (!objects.ContainsKey(H5I.type_t.GROUP))
                    {
                        objects[H5I.type_t.GROUP] = new List <string>();
                    }
                    objects[H5I.type_t.GROUP].Add(objectName);
                    break;

                case H5I.type_t.DATASET:
                    if (!objects.ContainsKey(H5I.type_t.DATASET))
                    {
                        objects[H5I.type_t.DATASET] = new List <string>();
                    }
                    objects[H5I.type_t.DATASET].Add(objectName);
                    break;

                case H5I.type_t.DATATYPE:
                    if (!objects.ContainsKey(H5I.type_t.DATATYPE))
                    {
                        objects[H5I.type_t.DATATYPE] = new List <string>();
                    }
                    objects[H5I.type_t.DATATYPE].Add(objectName);
                    break;

                case H5I.type_t.ATTR:
                    if (!objects.ContainsKey(H5I.type_t.ATTR))
                    {
                        objects[H5I.type_t.ATTR] = new List <string>();
                    }
                    objects[H5I.type_t.ATTR].Add(objectName);
                    break;

                default:
                    break;
                }

                return(0);
            }), IntPtr.Zero);

            return(objects);
        }
示例#2
0
        public void H5Iget_typeTest1()
        {
            Assert.IsTrue(H5I.get_type(m_v0_class_file) == H5I.type_t.FILE);
            hid_t gid = H5G.create(m_v0_test_file, "A");

            Assert.IsTrue(gid > 0);
            Assert.IsTrue(H5I.get_type(gid) == H5I.type_t.GROUP);
            Assert.IsTrue(H5G.close(gid) >= 0);

            Assert.IsTrue(H5I.get_type(m_v2_class_file) == H5I.type_t.FILE);
            gid = H5G.create(m_v2_test_file, "A");
            Assert.IsTrue(gid > 0);
            Assert.IsTrue(H5I.get_type(gid) == H5I.type_t.GROUP);
            Assert.IsTrue(H5G.close(gid) >= 0);
        }
示例#3
0
 public void H5Iget_typeTest2()
 {
     Assert.IsTrue(H5I.get_type(Utilities.RandomInvalidHandle()) ==
                   H5I.type_t.BADID);
 }
示例#4
0
 public static bool GroupExists(hid_t group)
 {
     return(H5I.get_type(group) == H5I.type_t.GROUP);
 }
 public static bool DataSetExists(hid_t dataSet)
 {
     return(H5I.get_type(dataSet) == H5I.type_t.DATASET);
 }