if (ret != 0) throw new IOException(nc4.nc_strerror(ret));
// for each defined "user type", get information, store in Map
for (int typeid : xtypes) {
byte[] nameb = new byte[NCLibrary.NC_MAX_NAME + 1];
NativeLongByReference sizep = new NativeLongByReference();
IntByReference baseType = new IntByReference();
NativeLongByReference nfieldsp = new NativeLongByReference();
IntByReference classp = new IntByReference();
ret = nc4.nc_inq_user_type(grpid, typeid, nameb, sizep, baseType, nfieldsp, classp); // size_t
if (ret != 0) throw new IOException(nc4.nc_strerror(ret));
String name = makeString(nameb);
int utype = classp.getValue();
System.out.printf(" user type=%d name=%s size=%d baseType=%d nfields=%d class=%d %n ",
typeid, name, sizep.getValue().longValue(), baseType.getValue(), nfieldsp.getValue().longValue(), utype);
UserType ut = new UserType(grpid, typeid, name, sizep.getValue().longValue(), baseType.getValue(),
nfieldsp.getValue().longValue(), classp.getValue());
userTypes.put(typeid, ut);
if (utype == NCLibrary.NC_ENUM) {
Map<Integer, String> map = makeEnum(grpid, typeid);
EnumTypedef e = new EnumTypedef(name, map);
g.addEnumeration(e);
ut.setEnum(e);
} else if (utype == NCLibrary.NC_OPAQUE) {
byte[] nameo = new byte[NCLibrary.NC_MAX_NAME + 1];
NativeLongByReference sizep2 = new NativeLongByReference();
ret = nc4.nc_inq_opaque(grpid, typeid, nameo, sizep2);
if (ret != 0) throw new IOException(nc4.nc_strerror(ret));
String nameos = makeString(nameo);
// doesnt seem to be any new info
System.out.printf(" opaque type=%d name=%s size=%d %n ",
typeid, nameos, sizep2.getValue().longValue());
}
}
}