{-# LINE 1 "src/Bindings/HDF5/Raw/H5D.hsc" #-}



module Bindings.HDF5.Raw.H5D where

import Data.Int
import Data.Word
import Foreign.C.String
import Foreign.C.Types
import Foreign.Ptr
import Foreign.Storable

import Bindings.HDF5.Raw.H5
import Bindings.HDF5.Raw.H5I
import Foreign.Ptr.Conventions

h5d_CHUNK_CACHE_NSLOTS_DEFAULT :: forall a. Num a => a
h5d_CHUNK_CACHE_NSLOTS_DEFAULT = a
18446744073709551615
h5d_CHUNK_CACHE_NBYTES_DEFAULT :: forall a. Num a => a
h5d_CHUNK_CACHE_NSLOTS_DEFAULT :: (Num a) => a

{-# LINE 18 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_CHUNK_CACHE_NBYTES_DEFAULT = 18446744073709551615
h5d_CHUNK_CACHE_NBYTES_DEFAULT :: (Num a) => a

{-# LINE 19 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_CHUNK_CACHE_W0_DEFAULT = -1
h5d_CHUNK_CACHE_W0_DEFAULT :: (Num a) => a

{-# LINE 20 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Property names for H5LTDdirect_chunk_write
h5d_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME :: String
h5d_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME :: String
h5d_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME = String
"direct_chunk_flag"

{-# LINE 23 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME :: String
h5d_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME = "direct_chunk_filters"

{-# LINE 24 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME :: String
h5d_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME = "direct_chunk_offset"

{-# LINE 25 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME :: String
h5d_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME = "direct_chunk_datasize"

{-# LINE 26 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Values for the H5D_LAYOUT property
newtype H5D_layout_t = H5D_layout_t Int32 deriving (Storable, Show, Eq)

{-# LINE 29 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

h5d_LAYOUT_ERROR :: H5D_layout_t
h5d_LAYOUT_ERROR :: H5D_layout_t
h5d_LAYOUT_ERROR = Int32 -> H5D_layout_t
H5D_layout_t (-Int32
1)

{-# LINE 31 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |raw data is very small
h5d_COMPACT :: H5D_layout_t
h5d_COMPACT :: H5D_layout_t
h5d_COMPACT = Int32 -> H5D_layout_t
H5D_layout_t (Int32
0)

{-# LINE 34 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |the default
h5d_CONTIGUOUS :: H5D_layout_t
h5d_CONTIGUOUS :: H5D_layout_t
h5d_CONTIGUOUS = Int32 -> H5D_layout_t
H5D_layout_t (Int32
1)

{-# LINE 37 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |slow and fancy
h5d_CHUNKED :: H5D_layout_t
h5d_CHUNKED :: H5D_layout_t
h5d_CHUNKED = Int32 -> H5D_layout_t
H5D_layout_t (Int32
2)

{-# LINE 40 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

h5d_NLAYOUTS = 4
h5d_NLAYOUTS :: (Num a) => a

{-# LINE 42 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Types of chunk index data structures
newtype H5D_chunk_index_t = H5D_chunk_index_t Word32 deriving (Storable, Show)

{-# LINE 45 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |v1 B-tree index
h5d_CHUNK_BTREE :: H5D_chunk_index_t
h5d_CHUNK_BTREE :: H5D_chunk_index_t
h5d_CHUNK_BTREE = Word32 -> H5D_chunk_index_t
H5D_chunk_index_t (Word32
0)

{-# LINE 48 "src/Bindings/HDF5/Raw/H5D.hsc" #-}


-- |Values for the space allocation time property
newtype H5D_alloc_time_t = H5D_alloc_time_t Int32 deriving (Ptr H5D_alloc_time_t -> IO H5D_alloc_time_t
Ptr H5D_alloc_time_t -> Int -> IO H5D_alloc_time_t
Ptr H5D_alloc_time_t -> Int -> H5D_alloc_time_t -> IO ()
Ptr H5D_alloc_time_t -> H5D_alloc_time_t -> IO ()
H5D_alloc_time_t -> Int
(H5D_alloc_time_t -> Int)
-> (H5D_alloc_time_t -> Int)
-> (Ptr H5D_alloc_time_t -> Int -> IO H5D_alloc_time_t)
-> (Ptr H5D_alloc_time_t -> Int -> H5D_alloc_time_t -> IO ())
-> (forall b. Ptr b -> Int -> IO H5D_alloc_time_t)
-> (forall b. Ptr b -> Int -> H5D_alloc_time_t -> IO ())
-> (Ptr H5D_alloc_time_t -> IO H5D_alloc_time_t)
-> (Ptr H5D_alloc_time_t -> H5D_alloc_time_t -> IO ())
-> Storable H5D_alloc_time_t
forall b. Ptr b -> Int -> IO H5D_alloc_time_t
forall b. Ptr b -> Int -> H5D_alloc_time_t -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
$csizeOf :: H5D_alloc_time_t -> Int
sizeOf :: H5D_alloc_time_t -> Int
$calignment :: H5D_alloc_time_t -> Int
alignment :: H5D_alloc_time_t -> Int
$cpeekElemOff :: Ptr H5D_alloc_time_t -> Int -> IO H5D_alloc_time_t
peekElemOff :: Ptr H5D_alloc_time_t -> Int -> IO H5D_alloc_time_t
$cpokeElemOff :: Ptr H5D_alloc_time_t -> Int -> H5D_alloc_time_t -> IO ()
pokeElemOff :: Ptr H5D_alloc_time_t -> Int -> H5D_alloc_time_t -> IO ()
$cpeekByteOff :: forall b. Ptr b -> Int -> IO H5D_alloc_time_t
peekByteOff :: forall b. Ptr b -> Int -> IO H5D_alloc_time_t
$cpokeByteOff :: forall b. Ptr b -> Int -> H5D_alloc_time_t -> IO ()
pokeByteOff :: forall b. Ptr b -> Int -> H5D_alloc_time_t -> IO ()
$cpeek :: Ptr H5D_alloc_time_t -> IO H5D_alloc_time_t
peek :: Ptr H5D_alloc_time_t -> IO H5D_alloc_time_t
$cpoke :: Ptr H5D_alloc_time_t -> H5D_alloc_time_t -> IO ()
poke :: Ptr H5D_alloc_time_t -> H5D_alloc_time_t -> IO ()
Storable, Int -> H5D_alloc_time_t -> ShowS
[H5D_alloc_time_t] -> ShowS
H5D_alloc_time_t -> String
(Int -> H5D_alloc_time_t -> ShowS)
-> (H5D_alloc_time_t -> String)
-> ([H5D_alloc_time_t] -> ShowS)
-> Show H5D_alloc_time_t
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> H5D_alloc_time_t -> ShowS
showsPrec :: Int -> H5D_alloc_time_t -> ShowS
$cshow :: H5D_alloc_time_t -> String
show :: H5D_alloc_time_t -> String
$cshowList :: [H5D_alloc_time_t] -> ShowS
showList :: [H5D_alloc_time_t] -> ShowS
Show, H5D_alloc_time_t -> H5D_alloc_time_t -> Bool
(H5D_alloc_time_t -> H5D_alloc_time_t -> Bool)
-> (H5D_alloc_time_t -> H5D_alloc_time_t -> Bool)
-> Eq H5D_alloc_time_t
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: H5D_alloc_time_t -> H5D_alloc_time_t -> Bool
== :: H5D_alloc_time_t -> H5D_alloc_time_t -> Bool
$c/= :: H5D_alloc_time_t -> H5D_alloc_time_t -> Bool
/= :: H5D_alloc_time_t -> H5D_alloc_time_t -> Bool
Eq)

{-# LINE 52 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_ALLOC_TIME_ERROR :: H5D_alloc_time_t
h5d_ALLOC_TIME_ERROR = H5D_alloc_time_t (-1)

{-# LINE 53 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_ALLOC_TIME_DEFAULT :: H5D_alloc_time_t
h5d_ALLOC_TIME_DEFAULT = H5D_alloc_time_t (0)

{-# LINE 54 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_ALLOC_TIME_EARLY :: H5D_alloc_time_t
h5d_ALLOC_TIME_EARLY = H5D_alloc_time_t (1)

{-# LINE 55 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_ALLOC_TIME_LATE :: H5D_alloc_time_t
h5d_ALLOC_TIME_LATE = H5D_alloc_time_t (2)

{-# LINE 56 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_ALLOC_TIME_INCR :: H5D_alloc_time_t
h5d_ALLOC_TIME_INCR = H5D_alloc_time_t (3)

{-# LINE 57 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Values for the status of space allocation
newtype H5D_space_status_t = H5D_space_status_t Int32 deriving (Storable, Show, Eq)

{-# LINE 60 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_SPACE_STATUS_ERROR :: H5D_space_status_t
h5d_SPACE_STATUS_ERROR = H5D_space_status_t (-1)

{-# LINE 61 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_SPACE_STATUS_NOT_ALLOCATED :: H5D_space_status_t
h5d_SPACE_STATUS_NOT_ALLOCATED = H5D_space_status_t (0)

{-# LINE 62 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_SPACE_STATUS_PART_ALLOCATED :: H5D_space_status_t
h5d_SPACE_STATUS_PART_ALLOCATED = H5D_space_status_t (1)

{-# LINE 63 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_SPACE_STATUS_ALLOCATED :: H5D_space_status_t
h5d_SPACE_STATUS_ALLOCATED = H5D_space_status_t (2)

{-# LINE 64 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Values for time of writing fill value property
newtype H5D_fill_time_t = H5D_fill_time_t Int32 deriving (Storable, Show, Eq)

{-# LINE 67 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_FILL_TIME_ERROR :: H5D_fill_time_t
h5d_FILL_TIME_ERROR = H5D_fill_time_t (-1)

{-# LINE 68 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_FILL_TIME_ALLOC :: H5D_fill_time_t
h5d_FILL_TIME_ALLOC = H5D_fill_time_t (0)

{-# LINE 69 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_FILL_TIME_NEVER :: H5D_fill_time_t
h5d_FILL_TIME_NEVER = H5D_fill_time_t (1)

{-# LINE 70 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_FILL_TIME_IFSET :: H5D_fill_time_t
h5d_FILL_TIME_IFSET = H5D_fill_time_t (2)

{-# LINE 71 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Values for fill value status
newtype H5D_fill_value_t = H5D_fill_value_t Int32 deriving (Storable, Show, Eq)

{-# LINE 74 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_FILL_VALUE_ERROR :: H5D_fill_value_t
h5d_FILL_VALUE_ERROR = H5D_fill_value_t (-1)

{-# LINE 75 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_FILL_VALUE_UNDEFINED :: H5D_fill_value_t
h5d_FILL_VALUE_UNDEFINED = H5D_fill_value_t (0)

{-# LINE 76 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_FILL_VALUE_DEFAULT :: H5D_fill_value_t
h5d_FILL_VALUE_DEFAULT = H5D_fill_value_t (1)

{-# LINE 77 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_FILL_VALUE_USER_DEFINED :: H5D_fill_value_t
h5d_FILL_VALUE_USER_DEFINED = H5D_fill_value_t (2)

{-# LINE 78 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Operator function type for 'h5d_iterate'
--
-- Parameters:
--
-- [@ elem          :: 'InOut' a           @]    Pointer to the element in memory containing the current point.
--
-- [@ type_id       :: 'HId_t'             @]    Datatype ID for the elements stored in ELEM.
--
-- [@ ndim          :: 'CUInt'             @]    Number of dimensions for POINT array
--
-- [@ point         :: 'InArray' 'HSize_t' @]    Array containing the location of the element within the original dataspace.
--
-- [@ operator_data :: 'InOut' b           @]    Pointer to any user-defined data associated with the operation.
--
-- Return Values:
--
--  * Zero causes the iterator to continue, returning zero when all
--    elements have been processed.
--
--  * Positive causes the iterator to immediately return that positive
--    value, indicating short-circuit success.  The iterator can be
--    restarted at the next element.
--
--  * Negative causes the iterator to immediately return that value,
--    indicating failure. The iterator can be restarted at the next
--    element.
--
-- > typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim,
-- > 				 const hsize_t *point, void *operator_data);
type H5D_operator_t a b = FunPtr (InOut a -> HId_t -> CUInt -> InArray HSize_t -> InOut b -> IO HErr_t)

-- I don't see any documentation for these callback types in the HDF5 distribution
-- (though I didn't look very hard, it might be there somewhere)

-- Define the operator function pointer for H5Dscatter()
--
-- > typedef herr_t (*H5D_scatter_func_t)(void **src_buf/*out*/,
-- >                                      size_t *src_buf_bytes_used/*out*/,
-- >                                      void *op_data);
type H5D_scatter_func_t a b = FunPtr (Out (Ptr a) -> Out CSize -> InOut b -> IO HErr_t)

-- Define the operator function pointer for H5Dgather()
--
-- > typedef herr_t (*H5D_gather_func_t)(const void *dst_buf,
-- >                                     size_t dst_buf_bytes_used, void *op_data);
type H5D_gather_func_t a b = FunPtr (InArray a -> CSize -> InOut b -> IO HErr_t)

-- |Creates a new dataset named 'name' at 'loc_id', opens the
-- dataset for access, and associates with that dataset constant
-- and initial persistent properties including the type of each
-- datapoint as stored in the file ('type_id'), the size of the
-- dataset ('space_id'), and other initial miscellaneous
-- properties ('dcpl_id').
--
-- All arguments are copied into the dataset, so the caller is
-- allowed to derive new types, data spaces, and creation
-- parameters from the old ones and reuse them in calls to
-- create other datasets.
--
-- On success, returns the object ID of the new dataset.  At this
-- point, the dataset is ready to receive its raw data.  Attempting
-- to read raw data from the dataset will probably return the fill
-- value.  The dataset should be closed when the caller is no longer
-- interested in it.
--
-- On failure, returns a negative value.
--
-- > hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id,
-- >     hid_t space_id, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id);
foreign import ccall "H5Dcreate2" h5d_create2
  :: HId_t -> CString -> HId_t -> HId_t -> HId_t -> HId_t -> HId_t -> IO HId_t
foreign import ccall "&H5Dcreate2" p_H5Dcreate2
  :: FunPtr (HId_t -> CString -> HId_t -> HId_t -> HId_t -> HId_t -> HId_t -> IO HId_t)

{-# LINE 149 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Creates a new dataset named 'name' at 'loc_id', opens the
-- dataset for access, and associates with that dataset constant
-- and initial persistent properties including the type of each
-- datapoint as stored in the file ('type_id'), the size of the
-- dataset ('space_id'), and other initial miscellaneous
-- properties ('dcpl_id').
--
-- All arguments are copied into the dataset, so the caller is
-- allowed to derive new types, data spaces, and creation
-- parameters from the old ones and reuse them in calls to
-- create other datasets.
--
-- The resulting ID should be linked into the file with
-- 'h5o_link' or it will be deleted when closed.
--
-- On success returns the object ID of the new dataset.  At this
-- point, the dataset is ready to receive its raw data.  Attempting
-- to read raw data from the dataset will probably return the fill
-- value.  The dataset should be linked into the group hierarchy before
-- being closed or it will be deleted.  The dataset should be closed
-- when the caller is no longer interested in it.
--
-- On failure, returns a negative value.
--
-- > hid_t H5Dcreate_anon(hid_t file_id, hid_t type_id, hid_t space_id,
-- >     hid_t plist_id, hid_t dapl_id);
foreign import ccall "H5Dcreate_anon" h5d_create_anon
  :: HId_t -> HId_t -> HId_t -> HId_t -> HId_t -> IO HId_t
foreign import ccall "&H5Dcreate_anon" p_H5Dcreate_anon
  :: FunPtr (HId_t -> HId_t -> HId_t -> HId_t -> HId_t -> IO HId_t)

{-# LINE 177 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Finds a dataset named 'name' at 'loc_id', opens it, and returns
-- its ID.	 The dataset should be close when the caller is no
-- longer interested in it.
--
-- Takes a dataset access property list
--
-- On success, returns a new dataset ID.
-- On failure, returns a negative value.
--
-- > hid_t H5Dopen2(hid_t file_id, const char *name, hid_t dapl_id);
foreign import ccall "H5Dopen2" h5d_open2
  :: HId_t -> CString -> HId_t -> IO HId_t
foreign import ccall "&H5Dopen2" p_H5Dopen2
  :: FunPtr (HId_t -> CString -> HId_t -> IO HId_t)

{-# LINE 189 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Closes access to a dataset ('dset_id') and releases
-- resources used by it. It is illegal to subsequently use that
-- same dataset ID in calls to other dataset functions.
--
-- Returns non-negative on success / negative on failure
--
-- > herr_t H5Dclose(hid_t dset_id);
foreign import ccall "H5Dclose" h5d_close
  :: HId_t -> IO HErr_t
foreign import ccall "&H5Dclose" p_H5Dclose
  :: FunPtr (HId_t -> IO HErr_t)

{-# LINE 198 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Returns a copy of the file data space for a dataset.
--
-- On success, returns a new ID for a copy of the data space.  The data
-- space should be released by calling 'h5s_close'.
--
-- > hid_t H5Dget_space(hid_t dset_id);
foreign import ccall "H5Dget_space" h5d_get_space
  :: HId_t -> IO HId_t
foreign import ccall "&H5Dget_space" p_H5Dget_space
  :: FunPtr (HId_t -> IO HId_t)

{-# LINE 206 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Gets the status of data space allocation.
--
-- Returns non-negative on success / negative on failure
--
-- > herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation);
foreign import ccall "H5Dget_space_status" h5d_get_space_status
  :: HId_t -> Out H5D_space_status_t -> IO HErr_t
foreign import ccall "&H5Dget_space_status" p_H5Dget_space_status
  :: FunPtr (HId_t -> Out H5D_space_status_t -> IO HErr_t)

{-# LINE 213 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Gets a copy of the file datatype for a dataset.
--
-- On success, returns the ID for a copy of the datatype.  The data type
-- should be released by calling 'h5t_close'.
-- On failure, returns a negative value.
--
-- > hid_t H5Dget_type(hid_t dset_id);
foreign import ccall "H5Dget_type" h5d_get_type
  :: HId_t -> IO HId_t
foreign import ccall "&H5Dget_type" p_H5Dget_type
  :: FunPtr (HId_t -> IO HId_t)

{-# LINE 222 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Gets a copy of the dataset creation property list.
--
-- On success, returns the ID for a copy of the dataset creation
-- property list.  The template should be released by calling 'h5p_close'.
--
-- > hid_t H5Dget_create_plist(hid_t dset_id);
foreign import ccall "H5Dget_create_plist" h5d_get_create_plist
  :: HId_t -> IO HId_t
foreign import ccall "&H5Dget_create_plist" p_H5Dget_create_plist
  :: FunPtr (HId_t -> IO HId_t)

{-# LINE 230 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Returns a copy of the dataset creation property list of the specified
-- dataset.
--
-- The chunk cache parameters in the returned property lists will be
-- those used by the dataset.  If the properties in the file access
-- property list were used to determine the dataset's chunk cache
-- configuration, then those properties will be present in the
-- returned dataset access property list.  If the dataset does not
-- use a chunked layout, then the chunk cache properties will be set
-- to the default.  The chunk cache properties in the returned list
-- are considered to be \"set\", and any use of this list will override
-- the corresponding properties in the file's file access property
-- list.
--
-- All link access properties in the returned list will be set to the
-- default values.
--
-- On success, returns the ID for a copy of the dataset access
-- property list.  The template should be released by calling 'h5p_close'.
-- On failure, returns a negative value.
--
-- > hid_t H5Dget_access_plist(hid_t dset_id);
foreign import ccall "H5Dget_access_plist" h5d_get_access_plist
  :: HId_t -> IO HId_t
foreign import ccall "&H5Dget_access_plist" p_H5Dget_access_plist
  :: FunPtr (HId_t -> IO HId_t)

{-# LINE 254 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Returns the amount of storage that is required for the
-- dataset. For chunked datasets this is the number of allocated
-- chunks times the chunk size.
--
-- On success, returns the amount of storage space allocated for the
-- dataset, not counting meta data. The return value may be zero if
-- no data has been stored.
--
-- On failure, returns zero.
--
-- > hsize_t H5Dget_storage_size(hid_t dset_id);
foreign import ccall "H5Dget_storage_size" h5d_get_storage_size
  :: HId_t -> IO HSize_t
foreign import ccall "&H5Dget_storage_size" p_H5Dget_storage_size
  :: FunPtr (HId_t -> IO HSize_t)

{-# LINE 267 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Returns the address of dataset in file, or 'hADDR_UNDEF' on failure.
--
-- > haddr_t H5Dget_offset(hid_t dset_id);
foreign import ccall "H5Dget_offset" h5d_get_offset
  :: HId_t -> IO HAddr_t
foreign import ccall "&H5Dget_offset" p_H5Dget_offset
  :: FunPtr (HId_t -> IO HAddr_t)

{-# LINE 272 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Reads (part of) a data set from the file into application
-- memory 'buf'. The part of the dataset to read is defined with
-- 'mem_space_id' and 'file_space_id'. The data points are
-- converted from their file type to the 'mem_type_id' specified.
-- Additional miscellaneous data transfer properties can be
-- passed to this function with the 'plist_id' argument.
--
-- The 'file_space_id' can be the constant 'h5s_ALL' which indicates
-- that the entire file data space is to be referenced.
--
-- The 'mem_space_id' can be the constant 'h5s_ALL' in which case
-- the memory data space is the same as the file data space
-- defined when the dataset was created.
--
-- The number of elements in the memory data space must match
-- the number of elements in the file data space.
--
-- The 'plist_id' can be the constant 'h5p_DEFAULT' in which
-- case the default data transfer properties are used.
--
-- Returns non-negative on success / negative on failure.
--
-- > herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
-- >        hid_t file_space_id, hid_t plist_id, void *buf/*out*/);
foreign import ccall "H5Dread" h5d_read
  :: HId_t -> HId_t -> HId_t -> HId_t -> HId_t -> OutArray a -> IO HErr_t
foreign import ccall "&H5Dread" p_H5Dread
  :: FunPtr (HId_t -> HId_t -> HId_t -> HId_t -> HId_t -> OutArray a -> IO HErr_t)

{-# LINE 298 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Writes (part of) a data set from application memory 'buf' to the
-- file.  The part of the dataset to write is defined with the
-- 'mem_space_id' and 'file_space_id' arguments. The data points
-- are converted from their current type ('mem_type_id') to their
-- file datatype.  Additional miscellaneous data transfer
-- properties can be passed to this function with the
-- 'plist_id' argument.
--
-- The 'file_space_id' can be the constant 'h5s_ALL' which indicates
-- that the entire file data space is to be referenced.
--
-- The 'mem_space_id' can be the constant 'h5s_ALL' in which case
-- the memory data space is the same as the file data space
-- defined when the dataset was created.
--
-- The number of elements in the memory data space must match
-- the number of elements in the file data space.
--
-- The 'plist_id' can be the constant 'h5p_DEFAULT' in which
-- case the default data transfer properties are used.
--
-- Returns non-negative on success / negative on failure.
--
-- > herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
-- >        hid_t file_space_id, hid_t plist_id, const void *buf);
foreign import ccall "H5Dwrite" h5d_write
  :: HId_t -> HId_t -> HId_t -> HId_t -> HId_t -> InArray a -> IO HErr_t
foreign import ccall "&H5Dwrite" p_H5Dwrite
  :: FunPtr (HId_t -> HId_t -> HId_t -> HId_t -> HId_t -> InArray a -> IO HErr_t)

{-# LINE 325 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- TODO: verify that 'buf' is mutable
-- |This routine iterates over all the elements selected in a memory
-- buffer.  The callback function is called once for each element selected
-- in the dataspace.  The selection in the dataspace is modified so
-- that any elements already iterated over are removed from the selection
-- if the iteration is interrupted (by the 'H5D_operator_t' function
-- returning non-zero) in the \"middle\" of the iteration and may be
-- re-started by the user where it left off.
--
-- NOTE: Until \"subtracting\" elements from a selection is implemented,
--     the selection is not modified.
--
-- Parameters:
--
-- [@ buf           :: 'InOut' a            @]    Pointer to the buffer in memory containing the elements to iterate over.
--
-- [@ type_id       :: 'HId_t'              @]    Datatype ID for the elements stored in 'buf'.
--
-- [@ space_id      :: 'HId_t'              @]    Dataspace ID for 'buf', also contains the selection to iterate over.
--
-- [@ op            :: 'H5D_operator_t' a b @]    Function pointer to the routine to be called for each element in 'buf' iterated over.
--
-- [@ operator_data :: 'InOut' b            @]    Pointer to any user-defined data associated with the operation.
--
-- Returns the return value of the last operator if it was non-zero,
-- or zero if all elements were processed. Otherwise returns a
-- negative value.
--
-- > herr_t H5Diterate(void *buf, hid_t type_id, hid_t space_id,
-- >        H5D_operator_t op, void *operator_data);
foreign import ccall "H5Diterate" h5d_iterate
  :: InOutArray a -> HId_t -> HId_t -> H5D_operator_t a b -> InOut b -> IO HErr_t
foreign import ccall "&H5Diterate" p_H5Diterate
  :: FunPtr (InOutArray a -> HId_t -> HId_t -> H5D_operator_t a b -> InOut b -> IO HErr_t)

{-# LINE 357 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Frees the buffers allocated for storing variable-length data
-- in memory.  Only frees the VL data in the selection defined in the
-- dataspace.  The dataset transfer property list is required to find the
-- correct allocation/free methods for the VL data in the buffer.
--
-- Returns non-negative on success, negative on failure
--
-- > herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf);
foreign import ccall "H5Dvlen_reclaim" h5d_vlen_reclaim
  :: HId_t -> HId_t -> HId_t -> Ptr a -> IO HErr_t
foreign import ccall "&H5Dvlen_reclaim" p_H5Dvlen_reclaim
  :: FunPtr (HId_t -> HId_t -> HId_t -> Ptr a -> IO HErr_t)

{-# LINE 367 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |This routine checks the number of bytes required to store the VL
-- data from the dataset, using the 'space_id' for the selection in the
-- dataset on disk and the 'type_id' for the memory representation of the
-- VL data, in memory.  The 'size' value is modified according to how many
-- bytes are required to store the VL data in memory.
--
-- This routine actually performs the read with a custom
-- memory manager which basically just counts the bytes requested and
-- uses a temporary memory buffer (through the H5FL API) to make certain
-- enough space is available to perform the read.  Then the temporary
-- buffer is released and the number of bytes allocated is returned.
-- Kinda kludgy, but easier than the other method of trying to figure out
-- the sizes without actually reading the data in... - QAK
--
-- Returns non-negative on success, negative on failure
--
-- > herr_t H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size);
foreign import ccall "H5Dvlen_get_buf_size" h5d_vlen_get_buf_size
  :: HId_t -> HId_t -> HId_t -> Out HSize_t -> IO HErr_t
foreign import ccall "&H5Dvlen_get_buf_size" p_H5Dvlen_get_buf_size
  :: FunPtr (HId_t -> HId_t -> HId_t -> Out HSize_t -> IO HErr_t)

{-# LINE 386 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- TODO: this explanation is incomprehensible.  Improve it.
-- |Fill a selection in memory with a value.
-- Use the selection in the dataspace to fill elements in a memory buffer.
-- If "fill" parameter is NULL, uses all zeros as fill value
--
-- Parameters:
--
-- [@ fill         :: 'In' a    @]  Pointer to fill value to use
-- [@ fill_type_id :: 'HId_t'   @]  Datatype of the fill value
-- [@ buf          :: 'InOut' b @]  Memory buffer to fill selection within
-- [@ buf_type_id  :: 'HId_t'   @]  Datatype of the elements in buffer
-- [@ space_id     :: 'HId_t'   @]  Dataspace describing memory buffer & containing selection to use.
--
-- Returns non-negative on success / negative on failure.
--
-- > herr_t H5Dfill(const void *fill, hid_t fill_type, void *buf,
-- >         hid_t buf_type, hid_t space);
foreign import ccall "H5Dfill" h5d_fill
  :: In a -> HId_t -> InOutArray b -> HId_t -> HId_t -> IO HErr_t
foreign import ccall "&H5Dfill" p_H5Dfill
  :: FunPtr (In a -> HId_t -> InOutArray b -> HId_t -> HId_t -> IO HErr_t)

{-# LINE 405 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Modifies the dimensions of a dataset.  Can change to a smaller dimension.
--
-- Returns non-negative on success, negative on failure
--
-- > herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]);
foreign import ccall "H5Dset_extent" h5d_set_extent
  :: HId_t -> InArray HSize_t -> IO HErr_t
foreign import ccall "&H5Dset_extent" p_H5Dset_extent
  :: FunPtr (HId_t -> InArray HSize_t -> IO HErr_t)

{-# LINE 412 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Scatters data provided by the callback op to the
-- destination buffer dst_buf, where the dimensions of
-- dst_buf and the selection to be scattered to are specified
-- by the dataspace dst_space_id.  The type of the data to be
-- scattered is specified by type_id.
--
-- Returns non-negative on success, negative on failure
--
-- > herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id,
-- >     hid_t dst_space_id, void *dst_buf);
foreign import ccall "H5Dscatter" h5d_scatter
  :: H5D_scatter_func_t a b -> InOut b -> HId_t -> HId_t -> OutArray a -> IO HErr_t
foreign import ccall "&H5Dscatter" p_H5Dscatter
  :: FunPtr (H5D_scatter_func_t a b -> InOut b -> HId_t -> HId_t -> OutArray a -> IO HErr_t)

{-# LINE 424 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Gathers data provided from the source buffer src_buf to
-- contiguous buffer dst_buf, then calls the callback op.
-- The dimensions of src_buf and the selection to be gathered
-- are specified by the dataspace src_space_id.  The type of
-- the data to be gathered is specified by type_id.
--
-- Returns non-negative on success, negative on failure
--
-- > herr_t H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id,
-- >     size_t dst_buf_size, void *dst_buf, H5D_gather_func_t op, void *op_data);
foreign import ccall "H5Dgather" h5d_gather
  :: HId_t -> InArray a -> HId_t -> CSize -> OutArray a -> H5D_gather_func_t a b -> InOut b -> IO HErr_t
foreign import ccall "&H5Dgather" p_H5Dgather
  :: FunPtr (HId_t -> InArray a -> HId_t -> CSize -> OutArray a -> H5D_gather_func_t a b -> InOut b -> IO HErr_t)

{-# LINE 436 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Prints various information about a dataset.  This function is not to be
-- documented in the API at this time.
--
-- Returns non-negative on success, negative on failure
--
-- > herr_t H5Ddebug(hid_t dset_id);
foreign import ccall "H5Ddebug" h5d_debug
  :: HId_t -> IO HErr_t
foreign import ccall "&H5Ddebug" p_H5Ddebug
  :: FunPtr (HId_t -> IO HErr_t)

{-# LINE 444 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Bit flags for the H5Pset_chunk_opts() and H5Pget_chunk_opts()
h5d_CHUNK_DONT_FILTER_PARTIAL_CHUNKS = 2
h5d_CHUNK_DONT_FILTER_PARTIAL_CHUNKS :: (Num a) => a

{-# LINE 447 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |actual data is stored in other datasets
h5d_VIRTUAL :: H5D_layout_t
h5d_VIRTUAL :: H5D_layout_t
h5d_VIRTUAL = Int32 -> H5D_layout_t
H5D_layout_t (Int32
3)

{-# LINE 450 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |v1 B-tree index (default)
h5d_CHUNK_IDX_BTREE :: H5D_chunk_index_t
h5d_CHUNK_IDX_BTREE :: H5D_chunk_index_t
h5d_CHUNK_IDX_BTREE = Word32 -> H5D_chunk_index_t
H5D_chunk_index_t (Word32
0)

{-# LINE 453 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
-- |Single Chunk index (cur dims[]=max dims[]=chunk dims[]; filtered & non-filtered)
h5d_CHUNK_IDX_SINGLE :: H5D_chunk_index_t
h5d_CHUNK_IDX_SINGLE = H5D_chunk_index_t (1)

{-# LINE 455 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
-- |Implicit: No Index (H5D_ALLOC_TIME_EARLY, non-filtered, fixed dims)
h5d_CHUNK_IDX_NONE :: H5D_chunk_index_t
h5d_CHUNK_IDX_NONE = H5D_chunk_index_t (2)

{-# LINE 457 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
-- |Fixed array (for 0 unlimited dims)
h5d_CHUNK_IDX_FARRAY :: H5D_chunk_index_t
h5d_CHUNK_IDX_FARRAY = H5D_chunk_index_t (3)

{-# LINE 459 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
-- |Extensible array (for 1 unlimited dim)
h5d_CHUNK_IDX_EARRAY :: H5D_chunk_index_t
h5d_CHUNK_IDX_EARRAY = H5D_chunk_index_t (4)

{-# LINE 461 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
-- |v2 B-tree index (for >1 unlimited dims)
h5d_CHUNK_IDX_BT2 :: H5D_chunk_index_t
h5d_CHUNK_IDX_BT2 = H5D_chunk_index_t (5)

{-# LINE 463 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

h5d_CHUNK_IDX_NTYPES = 6
h5d_CHUNK_IDX_NTYPES :: (Num a) => a

{-# LINE 465 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- | Values for VDS bounds option
newtype H5D_vds_view_t = H5D_vds_view_t Int32 deriving (Storable, Show, Eq)

{-# LINE 468 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_VDS_ERROR :: H5D_vds_view_t
h5d_VDS_ERROR = H5D_vds_view_t (-1)

{-# LINE 469 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_VDS_FIRST_MISSING :: H5D_vds_view_t
h5d_VDS_FIRST_MISSING = H5D_vds_view_t (0)

{-# LINE 470 "src/Bindings/HDF5/Raw/H5D.hsc" #-}
h5d_VDS_LAST_AVAILABLE :: H5D_vds_view_t
h5d_VDS_LAST_AVAILABLE = H5D_vds_view_t (1)

{-# LINE 471 "src/Bindings/HDF5/Raw/H5D.hsc" #-}


-- |Internal API routines
-- > H5_DLL herr_t H5Dformat_convert(hid_t dset_id);
foreign import ccall "H5Dformat_convert" h5d_format_convert
  :: HId_t -> IO HErr_t
foreign import ccall "&H5Dformat_convert" p_H5Dformat_convert
  :: FunPtr (HId_t -> IO HErr_t)

{-# LINE 476 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- > H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type);
foreign import ccall "H5Dget_chunk_index_type" h5d_get_chunk_index_type
  :: HId_t -> IO H5D_chunk_index_t
foreign import ccall "&H5Dget_chunk_index_type" p_H5Dget_chunk_index_type
  :: FunPtr (HId_t -> IO H5D_chunk_index_t)

{-# LINE 479 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Callback for H5Pset_append_flush() in a dataset access property list
-- > typedef herr_t (*H5D_append_cb_t)(hid_t dataset_id, hsize_t *cur_dims, void *op_data)
type H5D_append_cb_t a = FunPtr (HId_t -> Out HSize_t -> InOut a -> IO HErr_t)

-- > H5_DLL herr_t H5Dflush(hid_t dset_id);
foreign import ccall "H5Dflush" h5d_flush
  :: HId_t -> IO HErr_t
foreign import ccall "&H5Dflush" p_H5Dflush
  :: FunPtr (HId_t -> IO HErr_t)

{-# LINE 486 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- > H5_DLL herr_t H5Drefresh(hid_t dset_id);
foreign import ccall "H5Drefresh" h5d_refresh
  :: HId_t -> IO HErr_t
foreign import ccall "&H5Drefresh" p_H5Drefresh
  :: FunPtr (HId_t -> IO HErr_t)

{-# LINE 489 "src/Bindings/HDF5/Raw/H5D.hsc" #-}


{-# LINE 491 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Creates a new dataset named 'name' at 'loc_id', opens the
-- dataset for access, and associates with that dataset constant
-- and initial persistent properties including the type of each
-- datapoint as stored in the file ('type_id'), the size of the
-- dataset ('space_id'), and other initial miscellaneous
-- properties ('dcpl_id').
--
-- All arguments are copied into the dataset, so the caller is
-- allowed to derive new types, data spaces, and creation
-- parameters from the old ones and reuse them in calls to
-- create other datasets.
--
-- On success, returns the object ID of the new dataset.  At this
-- point, the dataset is ready to receive its raw data.  Attempting
-- to read raw data from the dataset will probably return the fill
-- value.  The dataset should be closed when the caller is no longer
-- interested in it.
--
-- On failure, returns a negative value.
--
-- Note:  Deprecated in favor of 'h5d_create2'
--
-- > hid_t H5Dcreate1(hid_t file_id, const char *name, hid_t type_id,
-- >     hid_t space_id, hid_t dcpl_id);
foreign import ccall "H5Dcreate1" h5d_create1
  :: HId_t -> CString -> HId_t -> HId_t -> HId_t -> IO HId_t
foreign import ccall "&H5Dcreate1" p_H5Dcreate1
  :: FunPtr (HId_t -> CString -> HId_t -> HId_t -> HId_t -> IO HId_t)

{-# LINE 517 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |Finds a dataset named 'name' at 'loc_id', opens it, and returns
-- its ID.  The dataset should be closed when the caller is no
-- longer interested in it.
--
-- On success returns a new dataset ID.
-- On failure, returns a negative value.
--
-- Note:  Deprecated in favor of 'h5d_open2'
--
-- > hid_t H5Dopen1(hid_t file_id, const char *name);
foreign import ccall "H5Dopen1" h5d_open1
  :: HId_t -> CString -> IO HId_t
foreign import ccall "&H5Dopen1" p_H5Dopen1
  :: FunPtr (HId_t -> CString -> IO HId_t)

{-# LINE 529 "src/Bindings/HDF5/Raw/H5D.hsc" #-}

-- |This function makes sure that the dataset is at least of size
-- 'size'. The dimensionality of 'size' is the same as the data
-- space of the dataset being changed.
--
-- Note:  Deprecated in favor of 'h5d_set_extent'
--
-- Returns non-negative on success / negative on failure
--
-- > herr_t H5Dextend(hid_t dset_id, const hsize_t size[]);
foreign import ccall "H5Dextend" h5d_extend
  :: HId_t -> InArray HSize_t -> IO HErr_t
foreign import ccall "&H5Dextend" p_H5Dextend
  :: FunPtr (HId_t -> InArray HSize_t -> IO HErr_t)

{-# LINE 540 "src/Bindings/HDF5/Raw/H5D.hsc" #-}


{-# LINE 542 "src/Bindings/HDF5/Raw/H5D.hsc" #-}