module Bindings.HDF5.Datatype
    ( Datatype
    , Class(..)
    , CSet(..)
    , ByteOrder(..)
    , Normalization(..)
    , Pad(..)
    , StringPad(..)

    , NativeType(..)
    , nativeTypeOf
    , nativeTypeOf1

    , module Bindings.HDF5.Datatype
    ) where

import Bindings.HDF5.Raw.H5P
import Bindings.HDF5.Raw.H5T
import Bindings.HDF5.Core
import Bindings.HDF5.Error
import Bindings.HDF5.PropertyList.LCPL
import Bindings.HDF5.PropertyList.TAPL
import Bindings.HDF5.PropertyList.TCPL
import qualified Data.ByteString as BS
import qualified Data.ByteString.Unsafe as BS
import Data.List
import Foreign
import Foreign.C.Types
import Foreign.Ptr.Conventions

import Bindings.HDF5.Datatype.Internal

-- ieeeF32be            = Datatype h5t_IEEE_F32BE
-- ieeeF32le            = Datatype h5t_IEEE_F32LE
-- ieeeF64be            = Datatype h5t_IEEE_F64BE
-- ieeeF64le            = Datatype h5t_IEEE_F64LE
-- stdI8be              = Datatype h5t_STD_I8BE
-- stdI8le              = Datatype h5t_STD_I8LE
-- stdI16be             = Datatype h5t_STD_I16BE
-- stdI16le             = Datatype h5t_STD_I16LE
-- stdI32be             = Datatype h5t_STD_I32BE
-- stdI32le             = Datatype h5t_STD_I32LE
-- stdI64be             = Datatype h5t_STD_I64BE
-- stdI64le             = Datatype h5t_STD_I64LE
-- stdU8be              = Datatype h5t_STD_U8BE
-- stdU8le              = Datatype h5t_STD_U8LE
-- stdU16be             = Datatype h5t_STD_U16BE
-- stdU16le             = Datatype h5t_STD_U16LE
-- stdU32be             = Datatype h5t_STD_U32BE
-- stdU32le             = Datatype h5t_STD_U32LE
-- stdU64be             = Datatype h5t_STD_U64BE
-- stdU64le             = Datatype h5t_STD_U64LE
-- stdB8be              = Datatype h5t_STD_B8BE
-- stdB8le              = Datatype h5t_STD_B8LE
-- stdB16be             = Datatype h5t_STD_B16BE
-- stdB16le             = Datatype h5t_STD_B16LE
-- stdB32be             = Datatype h5t_STD_B32BE
-- stdB32le             = Datatype h5t_STD_B32LE
-- stdB64be             = Datatype h5t_STD_B64BE
-- stdB64le             = Datatype h5t_STD_B64LE
-- stdRefObj            = Datatype h5t_STD_REF_OBJ
-- stdRefDsetreg        = Datatype h5t_STD_REF_DSETREG
-- unixD32be            = Datatype h5t_UNIX_D32BE
-- unixD32le            = Datatype h5t_UNIX_D32LE
-- unixD64be            = Datatype h5t_UNIX_D64BE
-- unixD64le            = Datatype h5t_UNIX_D64LE
-- cS1                  = Datatype h5t_C_S1
-- fortranS1            = Datatype h5t_FORTRAN_S1
-- intelI8              = Datatype h5t_INTEL_I8
-- intelI16             = Datatype h5t_INTEL_I16
-- intelI32             = Datatype h5t_INTEL_I32
-- intelI64             = Datatype h5t_INTEL_I64
-- intelU8              = Datatype h5t_INTEL_U8
-- intelU16             = Datatype h5t_INTEL_U16
-- intelU32             = Datatype h5t_INTEL_U32
-- intelU64             = Datatype h5t_INTEL_U64
-- intelB8              = Datatype h5t_INTEL_B8
-- intelB16             = Datatype h5t_INTEL_B16
-- intelB32             = Datatype h5t_INTEL_B32
-- intelB64             = Datatype h5t_INTEL_B64
-- intelF32             = Datatype h5t_INTEL_F32
-- intelF64             = Datatype h5t_INTEL_F64
-- alphaI8              = Datatype h5t_ALPHA_I8
-- alphaI16             = Datatype h5t_ALPHA_I16
-- alphaI32             = Datatype h5t_ALPHA_I32
-- alphaI64             = Datatype h5t_ALPHA_I64
-- alphaU8              = Datatype h5t_ALPHA_U8
-- alphaU16             = Datatype h5t_ALPHA_U16
-- alphaU32             = Datatype h5t_ALPHA_U32
-- alphaU64             = Datatype h5t_ALPHA_U64
-- alphaB8              = Datatype h5t_ALPHA_B8
-- alphaB16             = Datatype h5t_ALPHA_B16
-- alphaB32             = Datatype h5t_ALPHA_B32
-- alphaB64             = Datatype h5t_ALPHA_B64
-- alphaF32             = Datatype h5t_ALPHA_F32
-- alphaF64             = Datatype h5t_ALPHA_F64
-- mipsI8               = Datatype h5t_MIPS_I8
-- mipsI16              = Datatype h5t_MIPS_I16
-- mipsI32              = Datatype h5t_MIPS_I32
-- mipsI64              = Datatype h5t_MIPS_I64
-- mipsU8               = Datatype h5t_MIPS_U8
-- mipsU16              = Datatype h5t_MIPS_U16
-- mipsU32              = Datatype h5t_MIPS_U32
-- mipsU64              = Datatype h5t_MIPS_U64
-- mipsB8               = Datatype h5t_MIPS_B8
-- mipsB16              = Datatype h5t_MIPS_B16
-- mipsB32              = Datatype h5t_MIPS_B32
-- mipsB64              = Datatype h5t_MIPS_B64
-- mipsF32              = Datatype h5t_MIPS_F32
-- mipsF64              = Datatype h5t_MIPS_F64
-- vaxF32               = Datatype h5t_VAX_F32
-- vaxF64               = Datatype h5t_VAX_F64

-- * Operations defined on all datatypes

createTypeID :: Class -> CSize -> IO Datatype
createTypeID :: Class -> CSize -> IO Datatype
createTypeID Class
cls CSize
sz =
    (HId_t -> Datatype) -> IO HId_t -> IO Datatype
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap HId_t -> Datatype
Datatype (IO HId_t -> IO Datatype) -> IO HId_t -> IO Datatype
forall a b. (a -> b) -> a -> b
$
        IO HId_t -> IO HId_t
forall t. HDFResultType t => IO t -> IO t
withErrorCheck (IO HId_t -> IO HId_t) -> IO HId_t -> IO HId_t
forall a b. (a -> b) -> a -> b
$
            H5T_class_t -> CSize -> IO HId_t
h5t_create (Class -> H5T_class_t
classCode Class
cls) CSize
sz

copyTypeID :: Datatype -> IO Datatype
copyTypeID :: Datatype -> IO Datatype
copyTypeID (Datatype HId_t
t) =
    (HId_t -> Datatype) -> IO HId_t -> IO Datatype
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap HId_t -> Datatype
Datatype (IO HId_t -> IO Datatype) -> IO HId_t -> IO Datatype
forall a b. (a -> b) -> a -> b
$
        IO HId_t -> IO HId_t
forall t. HDFResultType t => IO t -> IO t
withErrorCheck (IO HId_t -> IO HId_t) -> IO HId_t -> IO HId_t
forall a b. (a -> b) -> a -> b
$
            HId_t -> IO HId_t
h5t_copy HId_t
t

closeTypeID :: Datatype -> IO ()
closeTypeID :: Datatype -> IO ()
closeTypeID (Datatype HId_t
t) =
    IO HErr_t -> IO ()
forall t. HDFResultType t => IO t -> IO ()
withErrorCheck_ (IO HErr_t -> IO ()) -> IO HErr_t -> IO ()
forall a b. (a -> b) -> a -> b
$
        HId_t -> IO HErr_t
h5t_close HId_t
t

typeIDsEqual :: Datatype -> Datatype -> IO Bool
typeIDsEqual :: Datatype -> Datatype -> IO Bool
typeIDsEqual (Datatype HId_t
t1) (Datatype HId_t
t2) =
    IO HTri_t -> IO Bool
htriToBool (IO HTri_t -> IO Bool) -> IO HTri_t -> IO Bool
forall a b. (a -> b) -> a -> b
$
        HId_t -> HId_t -> IO HTri_t
h5t_equal HId_t
t1 HId_t
t2

lockTypeID :: Datatype -> IO ()
lockTypeID :: Datatype -> IO ()
lockTypeID (Datatype HId_t
t) =
    IO HErr_t -> IO ()
forall t. HDFResultType t => IO t -> IO ()
withErrorCheck_ (IO HErr_t -> IO ()) -> IO HErr_t -> IO ()
forall a b. (a -> b) -> a -> b
$
        HId_t -> IO HErr_t
h5t_lock HId_t
t

commitTypeID :: Location t => t -> BS.ByteString -> Datatype -> Maybe LCPL -> Maybe TCPL -> Maybe TAPL -> IO ()
commitTypeID :: forall t.
Location t =>
t
-> ByteString
-> Datatype
-> Maybe LCPL
-> Maybe TCPL
-> Maybe TAPL
-> IO ()
commitTypeID t
loc ByteString
name Datatype
typeId Maybe LCPL
lcpl Maybe TCPL
tcpl Maybe TAPL
tapl =
    IO HErr_t -> IO ()
forall t. HDFResultType t => IO t -> IO ()
withErrorCheck_ (IO HErr_t -> IO ()) -> IO HErr_t -> IO ()
forall a b. (a -> b) -> a -> b
$
        ByteString -> (Ptr CChar -> IO HErr_t) -> IO HErr_t
forall a. ByteString -> (Ptr CChar -> IO a) -> IO a
BS.useAsCString ByteString
name ((Ptr CChar -> IO HErr_t) -> IO HErr_t)
-> (Ptr CChar -> IO HErr_t) -> IO HErr_t
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
cname ->
            HId_t -> Ptr CChar -> HId_t -> HId_t -> HId_t -> HId_t -> IO HErr_t
h5t_commit2 (t -> HId_t
forall t. HId t => t -> HId_t
hid t
loc) Ptr CChar
cname (Datatype -> HId_t
forall t. HId t => t -> HId_t
hid Datatype
typeId) (HId_t -> (LCPL -> HId_t) -> Maybe LCPL -> HId_t
forall b a. b -> (a -> b) -> Maybe a -> b
maybe HId_t
h5p_DEFAULT LCPL -> HId_t
forall t. HId t => t -> HId_t
hid Maybe LCPL
lcpl) (HId_t -> (TCPL -> HId_t) -> Maybe TCPL -> HId_t
forall b a. b -> (a -> b) -> Maybe a -> b
maybe HId_t
h5p_DEFAULT TCPL -> HId_t
forall t. HId t => t -> HId_t
hid Maybe TCPL
tcpl) (HId_t -> (TAPL -> HId_t) -> Maybe TAPL -> HId_t
forall b a. b -> (a -> b) -> Maybe a -> b
maybe HId_t
h5p_DEFAULT TAPL -> HId_t
forall t. HId t => t -> HId_t
hid Maybe TAPL
tapl)

openTypeID :: Location t => t -> BS.ByteString -> Maybe TAPL -> IO Datatype
openTypeID :: forall t.
Location t =>
t -> ByteString -> Maybe TAPL -> IO Datatype
openTypeID t
loc ByteString
name Maybe TAPL
tapl =
    (HId_t -> Datatype) -> IO HId_t -> IO Datatype
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap HId_t -> Datatype
Datatype (IO HId_t -> IO Datatype) -> IO HId_t -> IO Datatype
forall a b. (a -> b) -> a -> b
$
        ByteString -> (Ptr CChar -> IO HId_t) -> IO HId_t
forall a. ByteString -> (Ptr CChar -> IO a) -> IO a
BS.useAsCString ByteString
name ((Ptr CChar -> IO HId_t) -> IO HId_t)
-> (Ptr CChar -> IO HId_t) -> IO HId_t
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
cname ->
            IO HId_t -> IO HId_t
forall t. HDFResultType t => IO t -> IO t
withErrorCheck (IO HId_t -> IO HId_t) -> IO HId_t -> IO HId_t
forall a b. (a -> b) -> a -> b
$
                HId_t -> Ptr CChar -> HId_t -> IO HId_t
h5t_open2 (t -> HId_t
forall t. HId t => t -> HId_t
hid t
loc) Ptr CChar
cname (HId_t -> (TAPL -> HId_t) -> Maybe TAPL -> HId_t
forall b a. b -> (a -> b) -> Maybe a -> b
maybe HId_t
h5p_DEFAULT TAPL -> HId_t
forall t. HId t => t -> HId_t
hid Maybe TAPL
tapl)

commitTypeIDAnonymously :: Location t => t -> Datatype -> Maybe TCPL -> Maybe TAPL -> IO ()
commitTypeIDAnonymously :: forall t.
Location t =>
t -> Datatype -> Maybe TCPL -> Maybe TAPL -> IO ()
commitTypeIDAnonymously t
loc Datatype
typeId Maybe TCPL
tcpl Maybe TAPL
tapl =
    IO HErr_t -> IO ()
forall t. HDFResultType t => IO t -> IO ()
withErrorCheck_ (IO HErr_t -> IO ()) -> IO HErr_t -> IO ()
forall a b. (a -> b) -> a -> b
$
        HId_t -> HId_t -> HId_t -> HId_t -> IO HErr_t
h5t_commit_anon (t -> HId_t
forall t. HId t => t -> HId_t
hid t
loc) (Datatype -> HId_t
forall t. HId t => t -> HId_t
hid Datatype
typeId) (HId_t -> (TCPL -> HId_t) -> Maybe TCPL -> HId_t
forall b a. b -> (a -> b) -> Maybe a -> b
maybe HId_t
h5p_DEFAULT TCPL -> HId_t
forall t. HId t => t -> HId_t
hid Maybe TCPL
tcpl) (HId_t -> (TAPL -> HId_t) -> Maybe TAPL -> HId_t
forall b a. b -> (a -> b) -> Maybe a -> b
maybe HId_t
h5p_DEFAULT TAPL -> HId_t
forall t. HId t => t -> HId_t
hid Maybe TAPL
tapl)

getTypeCreationPList :: Datatype -> IO TCPL
getTypeCreationPList :: Datatype -> IO TCPL
getTypeCreationPList (Datatype HId_t
t) =
    (HId_t -> TCPL) -> IO HId_t -> IO TCPL
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap HId_t -> TCPL
forall t. FromHId t => HId_t -> t
uncheckedFromHId (IO HId_t -> IO TCPL) -> IO HId_t -> IO TCPL
forall a b. (a -> b) -> a -> b
$
        IO HId_t -> IO HId_t
forall t. HDFResultType t => IO t -> IO t
withErrorCheck (IO HId_t -> IO HId_t) -> IO HId_t -> IO HId_t
forall a b. (a -> b) -> a -> b
$
            HId_t -> IO HId_t
h5t_get_create_plist HId_t
t

committedTypeID :: Datatype -> IO Bool
committedTypeID :: Datatype -> IO Bool
committedTypeID (Datatype HId_t
t) =
    IO HTri_t -> IO Bool
htriToBool (IO HTri_t -> IO Bool) -> IO HTri_t -> IO Bool
forall a b. (a -> b) -> a -> b
$
        HId_t -> IO HTri_t
h5t_committed HId_t
t

encodeTypeID :: Datatype -> IO BS.ByteString
encodeTypeID :: Datatype -> IO ByteString
encodeTypeID (Datatype HId_t
t) =
    (OutArray CChar -> CSize -> IO CSize) -> IO ByteString
forall (m :: * -> *) a b.
(MonadBaseControl IO m, MonadIO m, Integral a, Integral b) =>
(OutArray CChar -> a -> m b) -> m ByteString
withOutByteString ((OutArray CChar -> CSize -> IO CSize) -> IO ByteString)
-> (OutArray CChar -> CSize -> IO CSize) -> IO ByteString
forall a b. (a -> b) -> a -> b
$ \OutArray CChar
buf CSize
bufSz ->
        CSize -> (InOut CSize -> IO ()) -> IO CSize
forall a (m :: * -> *) b.
(Storable a, MonadBaseControl IO m, MonadIO m) =>
a -> (InOut a -> m b) -> m a
withInOut_ CSize
bufSz ((InOut CSize -> IO ()) -> IO CSize)
-> (InOut CSize -> IO ()) -> IO CSize
forall a b. (a -> b) -> a -> b
$ \InOut CSize
ioBufSz ->
            IO HErr_t -> IO ()
forall t. HDFResultType t => IO t -> IO ()
withErrorCheck_ (IO HErr_t -> IO ()) -> IO HErr_t -> IO ()
forall a b. (a -> b) -> a -> b
$
                HId_t -> OutArray CChar -> InOut CSize -> IO HErr_t
forall a. HId_t -> OutArray a -> InOut CSize -> IO HErr_t
h5t_encode HId_t
t OutArray CChar
buf InOut CSize
ioBufSz

decodeTypeID :: BS.ByteString -> IO Datatype
decodeTypeID :: ByteString -> IO Datatype
decodeTypeID ByteString
bs =
    (HId_t -> Datatype) -> IO HId_t -> IO Datatype
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap HId_t -> Datatype
Datatype (IO HId_t -> IO Datatype) -> IO HId_t -> IO Datatype
forall a b. (a -> b) -> a -> b
$
        ByteString -> (Ptr CChar -> IO HId_t) -> IO HId_t
forall a. ByteString -> (Ptr CChar -> IO a) -> IO a
BS.unsafeUseAsCString ByteString
bs ((Ptr CChar -> IO HId_t) -> IO HId_t)
-> (Ptr CChar -> IO HId_t) -> IO HId_t
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
buf ->
            InArray CChar -> IO HId_t
forall a. InArray a -> IO HId_t
h5t_decode (Ptr CChar -> InArray CChar
forall a. Ptr a -> InArray a
InArray Ptr CChar
buf)

-- * Operations defined on compound datatypes

insertCompoundTypeMember :: Datatype -> BS.ByteString -> CSize -> Datatype -> IO ()
insertCompoundTypeMember :: Datatype -> ByteString -> CSize -> Datatype -> IO ()
insertCompoundTypeMember (Datatype HId_t
parent) ByteString
name CSize
offset (Datatype HId_t
member) =
    IO HErr_t -> IO ()
forall t. HDFResultType t => IO t -> IO ()
withErrorCheck_ (IO HErr_t -> IO ()) -> IO HErr_t -> IO ()
forall a b. (a -> b) -> a -> b
$
        ByteString -> (Ptr CChar -> IO HErr_t) -> IO HErr_t
forall a. ByteString -> (Ptr CChar -> IO a) -> IO a
BS.useAsCString ByteString
name ((Ptr CChar -> IO HErr_t) -> IO HErr_t)
-> (Ptr CChar -> IO HErr_t) -> IO HErr_t
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
cname ->
            HId_t -> Ptr CChar -> CSize -> HId_t -> IO HErr_t
h5t_insert HId_t
parent Ptr CChar
cname CSize
offset HId_t
member

packCompoundType :: Datatype -> IO ()
packCompoundType :: Datatype -> IO ()
packCompoundType (Datatype HId_t
t) =
    IO HErr_t -> IO ()
forall t. HDFResultType t => IO t -> IO ()
withErrorCheck_ (IO HErr_t -> IO ()) -> IO HErr_t -> IO ()
forall a b. (a -> b) -> a -> b
$
        HId_t -> IO HErr_t
h5t_pack HId_t
t

-- * Operations defined on enumeration datatypes

-- TODO: figure out good types for these
-- createEnumType :: Datatype -> IO Datatype
-- createEnumType (Datatype base) =
--     fmap Datatype $
--         withErrorCheck $
--             h5t_enum_create base

-- h5t_enum_insert
-- h5t_enum_nameof
-- h5t_enum_valueof

-- * Operations defined on variable-length datatypes

createVLenType :: Datatype -> IO Datatype
createVLenType :: Datatype -> IO Datatype
createVLenType (Datatype HId_t
base) =
    (HId_t -> Datatype) -> IO HId_t -> IO Datatype
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap HId_t -> Datatype
Datatype (IO HId_t -> IO Datatype) -> IO HId_t -> IO Datatype
forall a b. (a -> b) -> a -> b
$
        IO HId_t -> IO HId_t
forall t. HDFResultType t => IO t -> IO t
withErrorCheck (IO HId_t -> IO HId_t) -> IO HId_t -> IO HId_t
forall a b. (a -> b) -> a -> b
$
            HId_t -> IO HId_t
h5t_vlen_create HId_t
base

-- * Operations defined on array datatypes

createArrayType :: Datatype -> [HSize] -> IO Datatype
createArrayType :: Datatype -> [HSize] -> IO Datatype
createArrayType (Datatype HId_t
base) [HSize]
dims =
    (HId_t -> Datatype) -> IO HId_t -> IO Datatype
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap HId_t -> Datatype
Datatype (IO HId_t -> IO Datatype) -> IO HId_t -> IO Datatype
forall a b. (a -> b) -> a -> b
$
        [HSize_t] -> (InArray HSize_t -> IO HId_t) -> IO HId_t
forall a (m :: * -> *) b.
(Storable a, MonadBaseControl IO m) =>
[a] -> (InArray a -> m b) -> m b
withInList ((HSize -> HSize_t) -> [HSize] -> [HSize_t]
forall a b. (a -> b) -> [a] -> [b]
map HSize -> HSize_t
hSize [HSize]
dims) ((InArray HSize_t -> IO HId_t) -> IO HId_t)
-> (InArray HSize_t -> IO HId_t) -> IO HId_t
forall a b. (a -> b) -> a -> b
$ \InArray HSize_t
idims ->
            IO HId_t -> IO HId_t
forall t. HDFResultType t => IO t -> IO t
withErrorCheck (IO HId_t -> IO HId_t) -> IO HId_t -> IO HId_t
forall a b. (a -> b) -> a -> b
$
                HId_t -> CUInt -> InArray HSize_t -> IO HId_t
h5t_array_create2 HId_t
base CUInt
nDims InArray HSize_t
idims
    where nDims :: CUInt
nDims = [HSize] -> CUInt
forall i a. Num i => [a] -> i
genericLength [HSize]
dims

getArrayTypeNDims :: Datatype -> IO CInt
getArrayTypeNDims :: Datatype -> IO CInt
getArrayTypeNDims (Datatype HId_t
t) =
    (CInt -> Bool) -> IO CInt -> IO CInt
forall t. (t -> Bool) -> IO t -> IO t
withErrorWhen (CInt -> CInt -> Bool
forall a. Ord a => a -> a -> Bool
< CInt
0) (IO CInt -> IO CInt) -> IO CInt -> IO CInt
forall a b. (a -> b) -> a -> b
$
        HId_t -> IO CInt
h5t_get_array_ndims HId_t
t

getArrayTypeDims :: Datatype -> IO [HSize]
getArrayTypeDims :: Datatype -> IO [HSize]
getArrayTypeDims (Datatype HId_t
t) = do
    CInt
nDims <- Datatype -> IO CInt
getArrayTypeNDims (HId_t -> Datatype
Datatype HId_t
t)

    (([HSize_t], Int) -> [HSize]) -> IO ([HSize_t], Int) -> IO [HSize]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((HSize_t -> HSize) -> [HSize_t] -> [HSize]
forall a b. (a -> b) -> [a] -> [b]
map HSize_t -> HSize
HSize ([HSize_t] -> [HSize])
-> (([HSize_t], Int) -> [HSize_t]) -> ([HSize_t], Int) -> [HSize]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([HSize_t], Int) -> [HSize_t]
forall a b. (a, b) -> a
fst) (IO ([HSize_t], Int) -> IO [HSize])
-> IO ([HSize_t], Int) -> IO [HSize]
forall a b. (a -> b) -> a -> b
$
        Int -> (OutArray HSize_t -> IO Int) -> IO ([HSize_t], Int)
forall a (m :: * -> *).
(Storable a, MonadIO m) =>
Int -> (OutArray a -> m Int) -> m ([a], Int)
withOutList' (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
nDims) ((OutArray HSize_t -> IO Int) -> IO ([HSize_t], Int))
-> (OutArray HSize_t -> IO Int) -> IO ([HSize_t], Int)
forall a b. (a -> b) -> a -> b
$ \OutArray HSize_t
dims ->
            (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (IO CInt -> IO Int) -> IO CInt -> IO Int
forall a b. (a -> b) -> a -> b
$
                 (CInt -> Bool) -> IO CInt -> IO CInt
forall t. (t -> Bool) -> IO t -> IO t
withErrorWhen (CInt -> CInt -> Bool
forall a. Ord a => a -> a -> Bool
< CInt
0) (IO CInt -> IO CInt) -> IO CInt -> IO CInt
forall a b. (a -> b) -> a -> b
$
                    HId_t -> OutArray HSize_t -> IO CInt
h5t_get_array_dims2 HId_t
t OutArray HSize_t
dims


-- * Operations defined on opaque datatypes

setOpaqueTypeTag :: Datatype -> BS.ByteString -> IO ()
setOpaqueTypeTag :: Datatype -> ByteString -> IO ()
setOpaqueTypeTag (Datatype HId_t
t) ByteString
tag =
    IO HErr_t -> IO ()
forall t. HDFResultType t => IO t -> IO ()
withErrorCheck_ (IO HErr_t -> IO ()) -> IO HErr_t -> IO ()
forall a b. (a -> b) -> a -> b
$
        ByteString -> (Ptr CChar -> IO HErr_t) -> IO HErr_t
forall a. ByteString -> (Ptr CChar -> IO a) -> IO a
BS.useAsCString ByteString
tag ((Ptr CChar -> IO HErr_t) -> IO HErr_t)
-> (Ptr CChar -> IO HErr_t) -> IO HErr_t
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
ctag ->
            HId_t -> Ptr CChar -> IO HErr_t
h5t_set_tag HId_t
t Ptr CChar
ctag

getOpaqueTypeTag :: Datatype -> IO BS.ByteString
getOpaqueTypeTag :: Datatype -> IO ByteString
getOpaqueTypeTag (Datatype HId_t
t) = do
    Ptr CChar
cstr <- (Ptr CChar -> Bool) -> IO (Ptr CChar) -> IO (Ptr CChar)
forall t. (t -> Bool) -> IO t -> IO t
withErrorWhen (Ptr CChar
forall a. Ptr a
nullPtr Ptr CChar -> Ptr CChar -> Bool
forall a. Eq a => a -> a -> Bool
==) (IO (Ptr CChar) -> IO (Ptr CChar))
-> IO (Ptr CChar) -> IO (Ptr CChar)
forall a b. (a -> b) -> a -> b
$
        HId_t -> IO (Ptr CChar)
h5t_get_tag HId_t
t
    Ptr CChar -> IO ByteString
BS.unsafePackMallocCString Ptr CChar
cstr

-- * Querying property values

getSuperType :: Datatype -> IO Datatype
getSuperType :: Datatype -> IO Datatype
getSuperType (Datatype HId_t
t) =
    (HId_t -> Datatype) -> IO HId_t -> IO Datatype
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap HId_t -> Datatype
Datatype (IO HId_t -> IO Datatype) -> IO HId_t -> IO Datatype
forall a b. (a -> b) -> a -> b
$
        IO HId_t -> IO HId_t
forall t. HDFResultType t => IO t -> IO t
withErrorCheck
            (IO HId_t -> IO HId_t) -> IO HId_t -> IO HId_t
forall a b. (a -> b) -> a -> b
$ HId_t -> IO HId_t
h5t_get_super HId_t
t

getTypeClass :: Datatype -> IO Class
getTypeClass :: Datatype -> IO Class
getTypeClass (Datatype HId_t
t) =
    (H5T_class_t -> Class) -> IO H5T_class_t -> IO Class
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap H5T_class_t -> Class
classFromCode (IO H5T_class_t -> IO Class) -> IO H5T_class_t -> IO Class
forall a b. (a -> b) -> a -> b
$
        (H5T_class_t -> Bool) -> IO H5T_class_t -> IO H5T_class_t
forall t. (t -> Bool) -> IO t -> IO t
withErrorWhen (\(H5T_class_t Int32
c) -> Int32
c Int32 -> Int32 -> Bool
forall a. Ord a => a -> a -> Bool
< Int32
0) (IO H5T_class_t -> IO H5T_class_t)
-> IO H5T_class_t -> IO H5T_class_t
forall a b. (a -> b) -> a -> b
$
            HId_t -> IO H5T_class_t
h5t_get_class HId_t
t

detectTypeClass :: Datatype -> Class -> IO Bool
detectTypeClass :: Datatype -> Class -> IO Bool
detectTypeClass (Datatype HId_t
t) Class
cls =
    IO HTri_t -> IO Bool
htriToBool (IO HTri_t -> IO Bool) -> IO HTri_t -> IO Bool
forall a b. (a -> b) -> a -> b
$
        HId_t -> H5T_class_t -> IO HTri_t
h5t_detect_class HId_t
t (Class -> H5T_class_t
classCode Class
cls)

getTypeSize :: Datatype -> IO CSize
getTypeSize :: Datatype -> IO CSize
getTypeSize (Datatype HId_t
t) =
    (CSize -> Bool) -> IO CSize -> IO CSize
forall t. (t -> Bool) -> IO t -> IO t
withErrorWhen (CSize -> CSize -> Bool
forall a. Ord a => a -> a -> Bool
<= CSize
0) (IO CSize -> IO CSize) -> IO CSize -> IO CSize
forall a b. (a -> b) -> a -> b
$
        HId_t -> IO CSize
h5t_get_size HId_t
t

getByteOrder :: Datatype -> IO (Maybe ByteOrder)
getByteOrder :: Datatype -> IO (Maybe ByteOrder)
getByteOrder (Datatype HId_t
t) =
    (H5T_order_t -> Maybe ByteOrder)
-> IO H5T_order_t -> IO (Maybe ByteOrder)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap H5T_order_t -> Maybe ByteOrder
byteOrder (IO H5T_order_t -> IO (Maybe ByteOrder))
-> IO H5T_order_t -> IO (Maybe ByteOrder)
forall a b. (a -> b) -> a -> b
$
        IO H5T_order_t -> IO H5T_order_t
forall t. HDFResultType t => IO t -> IO t
withErrorCheck (IO H5T_order_t -> IO H5T_order_t)
-> IO H5T_order_t -> IO H5T_order_t
forall a b. (a -> b) -> a -> b
$
            HId_t -> IO H5T_order_t
h5t_get_order HId_t
t

getTypePrecision :: Datatype -> IO CSize
getTypePrecision :: Datatype -> IO CSize
getTypePrecision (Datatype HId_t
t) =
    (CSize -> Bool) -> IO CSize -> IO CSize
forall t. (t -> Bool) -> IO t -> IO t
withErrorWhen (CSize -> CSize -> Bool
forall a. Ord a => a -> a -> Bool
<= CSize
0) (IO CSize -> IO CSize) -> IO CSize -> IO CSize
forall a b. (a -> b) -> a -> b
$
        HId_t -> IO CSize
h5t_get_precision HId_t
t

getTypeOffset :: Datatype -> IO CInt
getTypeOffset :: Datatype -> IO CInt
getTypeOffset (Datatype HId_t
t) =
    (CInt -> Bool) -> IO CInt -> IO CInt
forall t. (t -> Bool) -> IO t -> IO t
withErrorWhen (CInt -> CInt -> Bool
forall a. Ord a => a -> a -> Bool
< CInt
0) (IO CInt -> IO CInt) -> IO CInt -> IO CInt
forall a b. (a -> b) -> a -> b
$
        HId_t -> IO CInt
h5t_get_offset HId_t
t

getTypePad :: Datatype -> IO (Pad, Pad)
getTypePad :: Datatype -> IO (Pad, Pad)
getTypePad (Datatype HId_t
t) = do
    (H5T_pad_t
msb, H5T_pad_t
lsb) <-
        (Out H5T_pad_t -> IO H5T_pad_t) -> IO (H5T_pad_t, H5T_pad_t)
forall a (m :: * -> *) b.
(Storable a, MonadBaseControl IO m, MonadIO m) =>
(Out a -> m b) -> m (a, b)
withOut ((Out H5T_pad_t -> IO H5T_pad_t) -> IO (H5T_pad_t, H5T_pad_t))
-> (Out H5T_pad_t -> IO H5T_pad_t) -> IO (H5T_pad_t, H5T_pad_t)
forall a b. (a -> b) -> a -> b
$ \Out H5T_pad_t
msb ->
            (Out H5T_pad_t -> IO HErr_t) -> IO H5T_pad_t
forall a (m :: * -> *) b.
(Storable a, MonadBaseControl IO m, MonadIO m) =>
(Out a -> m b) -> m a
withOut_ ((Out H5T_pad_t -> IO HErr_t) -> IO H5T_pad_t)
-> (Out H5T_pad_t -> IO HErr_t) -> IO H5T_pad_t
forall a b. (a -> b) -> a -> b
$ \Out H5T_pad_t
lsb ->
                IO HErr_t -> IO HErr_t
forall t. HDFResultType t => IO t -> IO t
withErrorCheck (IO HErr_t -> IO HErr_t) -> IO HErr_t -> IO HErr_t
forall a b. (a -> b) -> a -> b
$
                    HId_t -> Out H5T_pad_t -> Out H5T_pad_t -> IO HErr_t
h5t_get_pad HId_t
t Out H5T_pad_t
msb Out H5T_pad_t
lsb
    (Pad, Pad) -> IO (Pad, Pad)
forall (m :: * -> *) a. Monad m => a -> m a
return (H5T_pad_t -> Pad
padFromCode H5T_pad_t
msb, H5T_pad_t -> Pad
padFromCode H5T_pad_t
lsb)

getFloatTypeFields :: Datatype -> IO (CSize, CSize, CSize, CSize, CSize)
getFloatTypeFields :: Datatype -> IO (CSize, CSize, CSize, CSize, CSize)
getFloatTypeFields (Datatype HId_t
t) = do
    (CSize
spos, (CSize
epos, (CSize
esize, (CSize
mpos, CSize
msize)))) <-
        (Out CSize -> IO (CSize, (CSize, (CSize, CSize))))
-> IO (CSize, (CSize, (CSize, (CSize, CSize))))
forall a (m :: * -> *) b.
(Storable a, MonadBaseControl IO m, MonadIO m) =>
(Out a -> m b) -> m (a, b)
withOut ((Out CSize -> IO (CSize, (CSize, (CSize, CSize))))
 -> IO (CSize, (CSize, (CSize, (CSize, CSize)))))
-> (Out CSize -> IO (CSize, (CSize, (CSize, CSize))))
-> IO (CSize, (CSize, (CSize, (CSize, CSize))))
forall a b. (a -> b) -> a -> b
$ \Out CSize
spos ->
            (Out CSize -> IO (CSize, (CSize, CSize)))
-> IO (CSize, (CSize, (CSize, CSize)))
forall a (m :: * -> *) b.
(Storable a, MonadBaseControl IO m, MonadIO m) =>
(Out a -> m b) -> m (a, b)
withOut ((Out CSize -> IO (CSize, (CSize, CSize)))
 -> IO (CSize, (CSize, (CSize, CSize))))
-> (Out CSize -> IO (CSize, (CSize, CSize)))
-> IO (CSize, (CSize, (CSize, CSize)))
forall a b. (a -> b) -> a -> b
$ \Out CSize
epos ->
                (Out CSize -> IO (CSize, CSize)) -> IO (CSize, (CSize, CSize))
forall a (m :: * -> *) b.
(Storable a, MonadBaseControl IO m, MonadIO m) =>
(Out a -> m b) -> m (a, b)
withOut ((Out CSize -> IO (CSize, CSize)) -> IO (CSize, (CSize, CSize)))
-> (Out CSize -> IO (CSize, CSize)) -> IO (CSize, (CSize, CSize))
forall a b. (a -> b) -> a -> b
$ \Out CSize
esize ->
                    (Out CSize -> IO CSize) -> IO (CSize, CSize)
forall a (m :: * -> *) b.
(Storable a, MonadBaseControl IO m, MonadIO m) =>
(Out a -> m b) -> m (a, b)
withOut ((Out CSize -> IO CSize) -> IO (CSize, CSize))
-> (Out CSize -> IO CSize) -> IO (CSize, CSize)
forall a b. (a -> b) -> a -> b
$ \Out CSize
mpos ->
                        (Out CSize -> IO ()) -> IO CSize
forall a (m :: * -> *) b.
(Storable a, MonadBaseControl IO m, MonadIO m) =>
(Out a -> m b) -> m a
withOut_ ((Out CSize -> IO ()) -> IO CSize)
-> (Out CSize -> IO ()) -> IO CSize
forall a b. (a -> b) -> a -> b
$ \Out CSize
msize ->
                            IO HErr_t -> IO ()
forall t. HDFResultType t => IO t -> IO ()
withErrorCheck_ (IO HErr_t -> IO ()) -> IO HErr_t -> IO ()
forall a b. (a -> b) -> a -> b
$
                                HId_t
-> Out CSize
-> Out CSize
-> Out CSize
-> Out CSize
-> Out CSize
-> IO HErr_t
h5t_get_fields HId_t
t Out CSize
spos Out CSize
epos Out CSize
esize Out CSize
mpos Out CSize
msize
    (CSize, CSize, CSize, CSize, CSize)
-> IO (CSize, CSize, CSize, CSize, CSize)
forall (m :: * -> *) a. Monad m => a -> m a
return (CSize
spos, CSize
epos, CSize
esize, CSize
mpos, CSize
msize)

getFloatTypeEBias :: Datatype -> IO CSize
getFloatTypeEBias :: Datatype -> IO CSize
getFloatTypeEBias (Datatype HId_t
t) =
    (CSize -> Bool) -> IO CSize -> IO CSize
forall t. (t -> Bool) -> IO t -> IO t
withErrorWhen (CSize -> CSize -> Bool
forall a. Eq a => a -> a -> Bool
== CSize
0) (HId_t -> IO CSize
h5t_get_ebias HId_t
t)

getFloatTypeNormalization :: Datatype -> IO (Maybe Normalization)
getFloatTypeNormalization :: Datatype -> IO (Maybe Normalization)
getFloatTypeNormalization (Datatype HId_t
t) =
    (H5T_norm_t -> Maybe Normalization)
-> IO H5T_norm_t -> IO (Maybe Normalization)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap H5T_norm_t -> Maybe Normalization
normalization (IO H5T_norm_t -> IO (Maybe Normalization))
-> IO H5T_norm_t -> IO (Maybe Normalization)
forall a b. (a -> b) -> a -> b
$
        IO H5T_norm_t -> IO H5T_norm_t
forall t. HDFResultType t => IO t -> IO t
withErrorCheck (IO H5T_norm_t -> IO H5T_norm_t) -> IO H5T_norm_t -> IO H5T_norm_t
forall a b. (a -> b) -> a -> b
$
            HId_t -> IO H5T_norm_t
h5t_get_norm HId_t
t

getFloatTypeInternalPad :: Datatype -> IO Pad
getFloatTypeInternalPad :: Datatype -> IO Pad
getFloatTypeInternalPad (Datatype HId_t
t) =
    (H5T_pad_t -> Pad) -> IO H5T_pad_t -> IO Pad
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap H5T_pad_t -> Pad
padFromCode (IO H5T_pad_t -> IO Pad) -> IO H5T_pad_t -> IO Pad
forall a b. (a -> b) -> a -> b
$
        IO H5T_pad_t -> IO H5T_pad_t
forall t. HDFResultType t => IO t -> IO t
withErrorCheck (IO H5T_pad_t -> IO H5T_pad_t) -> IO H5T_pad_t -> IO H5T_pad_t
forall a b. (a -> b) -> a -> b
$
            HId_t -> IO H5T_pad_t
h5t_get_inpad HId_t
t

getStringPad :: Datatype -> IO StringPad
getStringPad :: Datatype -> IO StringPad
getStringPad (Datatype HId_t
t) =
    (H5T_str_t -> StringPad) -> IO H5T_str_t -> IO StringPad
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap H5T_str_t -> StringPad
stringPadFromCode (IO H5T_str_t -> IO StringPad) -> IO H5T_str_t -> IO StringPad
forall a b. (a -> b) -> a -> b
$
        IO H5T_str_t -> IO H5T_str_t
forall t. HDFResultType t => IO t -> IO t
withErrorCheck (IO H5T_str_t -> IO H5T_str_t) -> IO H5T_str_t -> IO H5T_str_t
forall a b. (a -> b) -> a -> b
$
            HId_t -> IO H5T_str_t
h5t_get_strpad HId_t
t

-- type must be enum or compound
getTypeNMembers :: Datatype -> IO CInt
getTypeNMembers :: Datatype -> IO CInt
getTypeNMembers (Datatype HId_t
t) =
    (CInt -> Bool) -> IO CInt -> IO CInt
forall t. (t -> Bool) -> IO t -> IO t
withErrorWhen (CInt -> CInt -> Bool
forall a. Ord a => a -> a -> Bool
< CInt
0) (IO CInt -> IO CInt) -> IO CInt -> IO CInt
forall a b. (a -> b) -> a -> b
$
        HId_t -> IO CInt
h5t_get_nmembers HId_t
t

-- type must be enum or compound
getMemberName :: Datatype -> CUInt -> IO BS.ByteString
getMemberName :: Datatype -> CUInt -> IO ByteString
getMemberName (Datatype HId_t
t) CUInt
i = do
    Ptr CChar
cstr <- (Ptr CChar -> Bool) -> IO (Ptr CChar) -> IO (Ptr CChar)
forall t. (t -> Bool) -> IO t -> IO t
withErrorWhen (Ptr CChar -> Ptr CChar -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr CChar
forall a. Ptr a
nullPtr) (IO (Ptr CChar) -> IO (Ptr CChar))
-> IO (Ptr CChar) -> IO (Ptr CChar)
forall a b. (a -> b) -> a -> b
$
        HId_t -> CUInt -> IO (Ptr CChar)
h5t_get_member_name HId_t
t CUInt
i
    ByteString
bs <- Ptr CChar -> IO ByteString
BS.packCString Ptr CChar
cstr
    Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
free Ptr CChar
cstr
    ByteString -> IO ByteString
forall (m :: * -> *) a. Monad m => a -> m a
return ByteString
bs

getMemberIndex :: Datatype -> BS.ByteString -> IO CInt
getMemberIndex :: Datatype -> ByteString -> IO CInt
getMemberIndex (Datatype HId_t
t) ByteString
bs =
    (CInt -> Bool) -> IO CInt -> IO CInt
forall t. (t -> Bool) -> IO t -> IO t
withErrorWhen (CInt -> CInt -> Bool
forall a. Ord a => a -> a -> Bool
< CInt
0) (IO CInt -> IO CInt) -> IO CInt -> IO CInt
forall a b. (a -> b) -> a -> b
$
        ByteString -> (Ptr CChar -> IO CInt) -> IO CInt
forall a. ByteString -> (Ptr CChar -> IO a) -> IO a
BS.useAsCString ByteString
bs ((Ptr CChar -> IO CInt) -> IO CInt)
-> (Ptr CChar -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
name ->
            HId_t -> Ptr CChar -> IO CInt
h5t_get_member_index HId_t
t Ptr CChar
name

-- TODO: implement these
--  (figure out proper error check for this one, the docs are weird)
-- getMemberOffset :: Datatype -> CUInt -> IO CSize
-- getMemberOffset (Datatype t) i =
--     withErrorWhen (< 0)

-- getMemberClass
-- getMemberType
-- getMemberValue
-- getCharSet
-- isVariableString
-- getNativeType

-- * Setting property values

setTypeSize :: Datatype -> CSize -> IO ()
setTypeSize :: Datatype -> CSize -> IO ()
setTypeSize (Datatype HId_t
t) CSize
sz =
    IO HErr_t -> IO ()
forall t. HDFResultType t => IO t -> IO ()
withErrorCheck_ (IO HErr_t -> IO ()) -> IO HErr_t -> IO ()
forall a b. (a -> b) -> a -> b
$
        HId_t -> CSize -> IO HErr_t
h5t_set_size HId_t
t CSize
sz

setByteOrder :: Datatype -> Maybe ByteOrder -> IO ()
setByteOrder :: Datatype -> Maybe ByteOrder -> IO ()
setByteOrder (Datatype HId_t
t) Maybe ByteOrder
order =
    IO HErr_t -> IO ()
forall t. HDFResultType t => IO t -> IO ()
withErrorCheck_ (IO HErr_t -> IO ()) -> IO HErr_t -> IO ()
forall a b. (a -> b) -> a -> b
$
        HId_t -> H5T_order_t -> IO HErr_t
h5t_set_order HId_t
t (Maybe ByteOrder -> H5T_order_t
byteOrderCode Maybe ByteOrder
order)

setTypePrecision :: Datatype -> CSize -> IO ()
setTypePrecision :: Datatype -> CSize -> IO ()
setTypePrecision (Datatype HId_t
t) CSize
prec =
    IO HErr_t -> IO ()
forall t. HDFResultType t => IO t -> IO ()
withErrorCheck_ (IO HErr_t -> IO ()) -> IO HErr_t -> IO ()
forall a b. (a -> b) -> a -> b
$
        HId_t -> CSize -> IO HErr_t
h5t_set_precision HId_t
t CSize
prec

setTypeOffset :: Datatype -> CSize -> IO ()
setTypeOffset :: Datatype -> CSize -> IO ()
setTypeOffset (Datatype HId_t
t) CSize
offset =
    IO HErr_t -> IO ()
forall t. HDFResultType t => IO t -> IO ()
withErrorCheck_ (IO HErr_t -> IO ()) -> IO HErr_t -> IO ()
forall a b. (a -> b) -> a -> b
$
        HId_t -> CSize -> IO HErr_t
h5t_set_offset HId_t
t CSize
offset

setTypePad :: Datatype -> Pad -> Pad -> IO ()
setTypePad :: Datatype -> Pad -> Pad -> IO ()
setTypePad (Datatype HId_t
t) Pad
msb Pad
lsb =
    IO HErr_t -> IO ()
forall t. HDFResultType t => IO t -> IO ()
withErrorCheck_ (IO HErr_t -> IO ()) -> IO HErr_t -> IO ()
forall a b. (a -> b) -> a -> b
$
        HId_t -> H5T_pad_t -> H5T_pad_t -> IO HErr_t
h5t_set_pad HId_t
t (Pad -> H5T_pad_t
padCode Pad
msb) (Pad -> H5T_pad_t
padCode Pad
lsb)

setFloatTypeFields :: Datatype -> CSize -> CSize -> CSize -> CSize -> CSize -> IO ()
setFloatTypeFields :: Datatype -> CSize -> CSize -> CSize -> CSize -> CSize -> IO ()
setFloatTypeFields (Datatype HId_t
t) CSize
spos CSize
epos CSize
esize CSize
mpos CSize
msize =
    IO HErr_t -> IO ()
forall t. HDFResultType t => IO t -> IO ()
withErrorCheck_ (IO HErr_t -> IO ()) -> IO HErr_t -> IO ()
forall a b. (a -> b) -> a -> b
$
        HId_t -> CSize -> CSize -> CSize -> CSize -> CSize -> IO HErr_t
h5t_set_fields HId_t
t CSize
spos CSize
epos CSize
esize CSize
mpos CSize
msize

setFloatTypeEBias :: Datatype -> CSize -> IO ()
setFloatTypeEBias :: Datatype -> CSize -> IO ()
setFloatTypeEBias (Datatype HId_t
t) CSize
ebias =
    IO HErr_t -> IO ()
forall t. HDFResultType t => IO t -> IO ()
withErrorCheck_ (IO HErr_t -> IO ()) -> IO HErr_t -> IO ()
forall a b. (a -> b) -> a -> b
$
        HId_t -> CSize -> IO HErr_t
h5t_set_ebias HId_t
t CSize
ebias

-- TODO: implement these
-- setFloatTypeNormalization ::
-- setFloatTypeInternalPad ::
-- setStringPad

-- * Type conversion database

-- registerTypeConversion
-- unregisterTypeConversion
-- findTypeConversion
-- isCompilerConversion
-- convertData