sdr-0.1.0.8: A software defined radio library

Safe HaskellNone
LanguageHaskell2010

SDR.Serialize

Contents

Description

Utility functions for serializing and deserializing samples.

Synopsis

Slow Serialization/Deserialization

Slow functions for serializing/deserializing vectors to/from bytestrings using the Cereal library. There must be a better way to do this that doesn't involve copying.

Floats

floatVecToByteString :: Vector v Float => v Float -> ByteString Source #

Convert a Vector of Floats to a ByteString.

floatVecFromByteString :: Vector v Float => ByteString -> v Float Source #

Convert a ByteString to a Vector of Floats.

Doubles

doubleVecToByteString :: Vector v Double => v Double -> ByteString Source #

Convert a Vector of Doubles to a ByteString.

doubleVecFromByteString :: Vector v Double => ByteString -> v Double Source #

Convert a ByteString to a Vector of Doubles.

Fast Serialization/Deserialization

Fast functions for serializing/deserializing storable vectors to/from bytestrings.

toByteString :: forall a. Storable a => Vector a -> ByteString Source #

Convert a Vector of Storable values to a ByteString. This is fast as it is just a cast.

fromByteString :: forall a. Storable a => ByteString -> Vector a Source #

Convert a ByteString to a Vector of Storable values. This is fast as it is just a cast.

Pipes

Pipes that perform fast serialization/deserialization to a Handle.

toHandle :: Storable a => Handle -> Consumer (Vector a) IO () Source #

Given a Handle, create a Consumer that dumps the Vectors written to it to a Handle.

fromHandle :: forall a. Storable a => Int -> Handle -> Producer (Vector a) IO () Source #

Given a Handle, create a Producer that creates Vectors from data read from the Handle.