stdcxx-0.7.0.0: src/STD/Map/Template.hs
{-# LANGUAGE EmptyDataDecls, FlexibleInstances,
MultiParamTypeClasses, TypeFamilies #-}
module STD.Map.Template where
import Foreign.C.Types
import Foreign.Ptr
import FFICXX.Runtime.Cast
import STD.MapIterator.Template
import STD.Pair.Template
data RawMap tpk tpv
newtype Map tpk tpv = Map (Ptr (RawMap tpk tpv))
class () => IMap tpk tpv where
newMap :: IO (Map tpk tpv)
begin :: Map tpk tpv -> IO (MapIterator tpk tpv)
end :: Map tpk tpv -> IO (MapIterator tpk tpv)
insert :: Map tpk tpv -> Pair tpk tpv -> IO ()
size :: Map tpk tpv -> IO CInt
deleteMap :: Map tpk tpv -> IO ()
instance () => FPtr (Map tpk tpv) where
type Raw (Map tpk tpv) = RawMap tpk tpv
get_fptr (Map ptr) = ptr
cast_fptr_to_obj = Map
instance () => Castable (Map tpk tpv) (Ptr (RawMap tpk tpv)) where
cast x f = f (castPtr (get_fptr x))
uncast x f = f (cast_fptr_to_obj (castPtr x))