{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
  TypeSynonymInstances #-}
module OGDF.OptimalHierarchyLayout.Interface where
import Data.Word
import Data.Int
import Foreign.C
import Foreign.Ptr
import FFICXX.Runtime.Cast
import OGDF.OptimalHierarchyLayout.RawType
import STD.Deletable.Interface
import OGDF.HierarchyLayoutModule.Interface

class (IDeletable a, IHierarchyLayoutModule a) =>
      IOptimalHierarchyLayout a where

upcastOptimalHierarchyLayout ::
                             forall a . (FPtr a, IOptimalHierarchyLayout a) =>
                               a -> OptimalHierarchyLayout
upcastOptimalHierarchyLayout :: forall a.
(FPtr a, IOptimalHierarchyLayout a) =>
a -> OptimalHierarchyLayout
upcastOptimalHierarchyLayout a
h
  = let fh :: Ptr (Raw a)
fh = a -> Ptr (Raw a)
forall a. FPtr a => a -> Ptr (Raw a)
get_fptr a
h
        Ptr RawOptimalHierarchyLayout
fh2 :: Ptr RawOptimalHierarchyLayout = Ptr (Raw a) -> Ptr RawOptimalHierarchyLayout
forall a b. Ptr a -> Ptr b
castPtr Ptr (Raw a)
fh
      in Ptr (Raw OptimalHierarchyLayout) -> OptimalHierarchyLayout
forall a. FPtr a => Ptr (Raw a) -> a
cast_fptr_to_obj Ptr (Raw OptimalHierarchyLayout)
Ptr RawOptimalHierarchyLayout
fh2

downcastOptimalHierarchyLayout ::
                               forall a . (FPtr a, IOptimalHierarchyLayout a) =>
                                 OptimalHierarchyLayout -> a
downcastOptimalHierarchyLayout :: forall a.
(FPtr a, IOptimalHierarchyLayout a) =>
OptimalHierarchyLayout -> a
downcastOptimalHierarchyLayout OptimalHierarchyLayout
h
  = let fh :: Ptr (Raw OptimalHierarchyLayout)
fh = OptimalHierarchyLayout -> Ptr (Raw OptimalHierarchyLayout)
forall a. FPtr a => a -> Ptr (Raw a)
get_fptr OptimalHierarchyLayout
h
        fh2 :: Ptr (Raw a)
fh2 = Ptr RawOptimalHierarchyLayout -> Ptr (Raw a)
forall a b. Ptr a -> Ptr b
castPtr Ptr (Raw OptimalHierarchyLayout)
Ptr RawOptimalHierarchyLayout
fh
      in Ptr (Raw a) -> a
forall a. FPtr a => Ptr (Raw a) -> a
cast_fptr_to_obj Ptr (Raw a)
fh2