hdf5-1.8.10: Haskell interface to the HDF5 scientific data storage library.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Foreign.Ptr.Conventions

Description

various common data-passing conventions

Synopsis

Documentation

class WrappedPtr p where Source #

Minimal complete definition

wrapPtr, unwrapPtr

Methods

wrapPtr :: Ptr a -> p a Source #

unwrapPtr :: p a -> Ptr a Source #

nullWrappedPtr :: p a Source #

castWrappedPtr :: p a -> p b Source #

Instances

Instances details
WrappedPtr Ptr Source # 
Instance details

Defined in Foreign.Ptr.Conventions

WrappedPtr In Source # 
Instance details

Defined in Foreign.Ptr.Conventions

WrappedPtr InArray Source # 
Instance details

Defined in Foreign.Ptr.Conventions

WrappedPtr InOut Source # 
Instance details

Defined in Foreign.Ptr.Conventions

WrappedPtr InOutArray Source # 
Instance details

Defined in Foreign.Ptr.Conventions

WrappedPtr Out Source # 
Instance details

Defined in Foreign.Ptr.Conventions

WrappedPtr OutArray Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Input pointers

newtype In a Source #

In by-ref parameter; memory is allocated and freed by caller

Constructors

In (Ptr a) 

Instances

Instances details
WrappedPtr In Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Storable (In a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Methods

sizeOf :: In a -> Int Source #

alignment :: In a -> Int Source #

peekElemOff :: Ptr (In a) -> Int -> IO (In a) Source #

pokeElemOff :: Ptr (In a) -> Int -> In a -> IO () Source #

peekByteOff :: Ptr b -> Int -> IO (In a) Source #

pokeByteOff :: Ptr b -> Int -> In a -> IO () Source #

peek :: Ptr (In a) -> IO (In a) Source #

poke :: Ptr (In a) -> In a -> IO () Source #

Show (In a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Methods

showsPrec :: Int -> In a -> ShowS Source #

show :: In a -> String Source #

showList :: [In a] -> ShowS Source #

Eq (In a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Methods

(==) :: In a -> In a -> Bool Source #

(/=) :: In a -> In a -> Bool Source #

Ord (In a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Methods

compare :: In a -> In a -> Ordering Source #

(<) :: In a -> In a -> Bool Source #

(<=) :: In a -> In a -> Bool Source #

(>) :: In a -> In a -> Bool Source #

(>=) :: In a -> In a -> Bool Source #

max :: In a -> In a -> In a Source #

min :: In a -> In a -> In a Source #

newtype InArray a Source #

In by-ref array; memory is allocated and freed by caller

Constructors

InArray (Ptr a) 

Instances

Instances details
WrappedPtr InArray Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Storable (InArray a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Methods

sizeOf :: InArray a -> Int Source #

alignment :: InArray a -> Int Source #

peekElemOff :: Ptr (InArray a) -> Int -> IO (InArray a) Source #

pokeElemOff :: Ptr (InArray a) -> Int -> InArray a -> IO () Source #

peekByteOff :: Ptr b -> Int -> IO (InArray a) Source #

pokeByteOff :: Ptr b -> Int -> InArray a -> IO () Source #

peek :: Ptr (InArray a) -> IO (InArray a) Source #

poke :: Ptr (InArray a) -> InArray a -> IO () Source #

Show (InArray a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Eq (InArray a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Methods

(==) :: InArray a -> InArray a -> Bool Source #

(/=) :: InArray a -> InArray a -> Bool Source #

Ord (InArray a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

withIn :: (Storable a, MonadBaseControl IO m) => a -> (In a -> m b) -> m b Source #

withInList :: (Storable a, MonadBaseControl IO m) => [a] -> (InArray a -> m b) -> m b Source #

withInVector :: (Storable a, MonadBaseControl IO m) => Vector a -> (InArray a -> m b) -> m b Source #

withInMVector :: (Storable a, MonadBaseControl IO m) => IOVector a -> (InArray a -> m b) -> m b Source #

Output pointers

newtype Out a Source #

Out by-ref parameter; memory is allocated and freed by caller

Constructors

Out (Ptr a) 

Instances

Instances details
WrappedPtr Out Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Storable (Out a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Methods

sizeOf :: Out a -> Int Source #

alignment :: Out a -> Int Source #

peekElemOff :: Ptr (Out a) -> Int -> IO (Out a) Source #

pokeElemOff :: Ptr (Out a) -> Int -> Out a -> IO () Source #

peekByteOff :: Ptr b -> Int -> IO (Out a) Source #

pokeByteOff :: Ptr b -> Int -> Out a -> IO () Source #

peek :: Ptr (Out a) -> IO (Out a) Source #

poke :: Ptr (Out a) -> Out a -> IO () Source #

Show (Out a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Methods

showsPrec :: Int -> Out a -> ShowS Source #

show :: Out a -> String Source #

showList :: [Out a] -> ShowS Source #

Eq (Out a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Methods

(==) :: Out a -> Out a -> Bool Source #

(/=) :: Out a -> Out a -> Bool Source #

Ord (Out a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Methods

compare :: Out a -> Out a -> Ordering Source #

(<) :: Out a -> Out a -> Bool Source #

(<=) :: Out a -> Out a -> Bool Source #

(>) :: Out a -> Out a -> Bool Source #

(>=) :: Out a -> Out a -> Bool Source #

max :: Out a -> Out a -> Out a Source #

min :: Out a -> Out a -> Out a Source #

newtype OutArray a Source #

Out by-ref array; length is specified by caller, memory is allocated and freed by caller

Constructors

OutArray (Ptr a) 

Instances

Instances details
WrappedPtr OutArray Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Storable (OutArray a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Show (OutArray a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Eq (OutArray a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Methods

(==) :: OutArray a -> OutArray a -> Bool Source #

(/=) :: OutArray a -> OutArray a -> Bool Source #

Ord (OutArray a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

withOut :: (Storable a, MonadBaseControl IO m, MonadIO m) => (Out a -> m b) -> m (a, b) Source #

withMaybeOut :: (Storable a, MonadBaseControl IO m, MonadIO m) => (Out a -> m Bool) -> m (Maybe a) Source #

withOut_ :: (Storable a, MonadBaseControl IO m, MonadIO m) => (Out a -> m b) -> m a Source #

withOutMVector :: (Storable a, MonadBaseControl IO m) => IOVector a -> (Int -> OutArray a -> m b) -> m b Source #

withOutVector :: (Storable a, MonadBaseControl IO m, MonadIO m) => Int -> (OutArray a -> m b) -> m (Vector a, b) Source #

withOutVector_ :: Storable a => Int -> (OutArray a -> IO b) -> IO (Vector a) Source #

withOutVector' :: (Storable a, Integral b) => Int -> (OutArray a -> IO b) -> IO (Vector a) Source #

withOutList :: (Storable a, MonadIO m) => Int -> (OutArray a -> m b) -> m ([a], b) Source #

withOutList_ :: (Storable a, MonadIO m) => Int -> (OutArray a -> m b) -> m [a] Source #

withOutList' :: (Storable a, MonadIO m) => Int -> (OutArray a -> m Int) -> m ([a], Int) Source #

withOutList0 :: (Storable a, Eq a, MonadIO m) => a -> Int -> (OutArray a -> m b) -> m ([a], b) Source #

withOutList0 zero n f: allocate an array large enough to hold n elements, plus one extra spot for a terminator. Calls f with that buffer, which is expected to fill it with up to n elements, followed by zero. The elements are then read out into a list.

withOutByteString :: (MonadBaseControl IO m, MonadIO m, Integral a, Integral b) => (OutArray CChar -> a -> m b) -> m ByteString Source #

Get a ByteString from a function using the common "buffer and size in, bytes written out" convention.

Calls the function twice; once with a null pointer to discover the length needed and once more to actually read out the string.

withOutByteString' :: (MonadBaseControl IO m, MonadIO m, Integral a, Integral b) => (OutArray CChar -> a -> m b) -> m ByteString Source #

Variant of withOutByteString which expects the discovered length to be one byte less than the required buffer size. As required for H5Fget_name

Bidirectional pointers

newtype InOut a Source #

In-out parameter. Memory is allocated and freed by caller.

Constructors

InOut (Ptr a) 

Instances

Instances details
WrappedPtr InOut Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Storable (InOut a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Methods

sizeOf :: InOut a -> Int Source #

alignment :: InOut a -> Int Source #

peekElemOff :: Ptr (InOut a) -> Int -> IO (InOut a) Source #

pokeElemOff :: Ptr (InOut a) -> Int -> InOut a -> IO () Source #

peekByteOff :: Ptr b -> Int -> IO (InOut a) Source #

pokeByteOff :: Ptr b -> Int -> InOut a -> IO () Source #

peek :: Ptr (InOut a) -> IO (InOut a) Source #

poke :: Ptr (InOut a) -> InOut a -> IO () Source #

Show (InOut a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Eq (InOut a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Methods

(==) :: InOut a -> InOut a -> Bool Source #

(/=) :: InOut a -> InOut a -> Bool Source #

Ord (InOut a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Methods

compare :: InOut a -> InOut a -> Ordering Source #

(<) :: InOut a -> InOut a -> Bool Source #

(<=) :: InOut a -> InOut a -> Bool Source #

(>) :: InOut a -> InOut a -> Bool Source #

(>=) :: InOut a -> InOut a -> Bool Source #

max :: InOut a -> InOut a -> InOut a Source #

min :: InOut a -> InOut a -> InOut a Source #

newtype InOutArray a Source #

Constructors

InOutArray (Ptr a) 

Instances

Instances details
WrappedPtr InOutArray Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Storable (InOutArray a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Show (InOutArray a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Eq (InOutArray a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

Ord (InOutArray a) Source # 
Instance details

Defined in Foreign.Ptr.Conventions

withInOut :: (Storable a, MonadBaseControl IO m, MonadIO m) => a -> (InOut a -> m b) -> m (a, b) Source #

withInOut_ :: (Storable a, MonadBaseControl IO m, MonadIO m) => a -> (InOut a -> m b) -> m a Source #

withInOutList :: (Storable a, MonadIO m) => Int -> [a] -> (InOutArray a -> m (Int, b)) -> m ([a], b) Source #

withInOutList_ :: (Storable a, MonadIO m) => Int -> [a] -> (InOutArray a -> m Int) -> m [a] Source #