diff --git a/ChangeLog.md b/ChangeLog.md
new file mode 100644
--- /dev/null
+++ b/ChangeLog.md
@@ -0,0 +1,5 @@
+# Changelog for OGDF
+
+## 1.0.0.0
+
+- Initial release 1.0.0.0 generated by fficxx-0.7.0.0. This version is compatible with OGDF 2022.02 (Dogwood)
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,25 @@
+The following license covers this documentation, and the source code, except
+where otherwise indicated.
+
+Copyright 2018-2022, Ian-Woo Kim. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/OGDF.cabal b/OGDF.cabal
new file mode 100644
--- /dev/null
+++ b/OGDF.cabal
@@ -0,0 +1,236 @@
+Cabal-version:  3.0
+Name:           OGDF
+Version:        1.0.0.0
+Synopsis:       Haskell binding to OGDF
+Description:
+  Haskell binding to Open Graph Drawing Framework (OGDF) autogenerated by fficxx.
+  OGDF is a C++ framework for graph layout algorithms and data structures.
+  The Haskell OGDF binding is tested with OGDF 2022.02 (Dogwood).
+Homepage:       https://github.com/wavewave/hs-ogdf
+license:        BSD-2-Clause
+license-file:   LICENSE
+Author:         Ian-Woo Kim
+Maintainer:     Ian-Woo Kim <ianwookim@gmail.com>
+Category:       Graphs
+Tested-with:    GHC == 9.0.2 || == 9.2.4 || == 9.4.2
+Build-Type:     Simple
+Extra-source-files:
+                ChangeLog.md
+                csrc/OGDFColor.h
+                csrc/OGDFDPoint.h
+                csrc/OGDFDRect.h
+                csrc/OGDFEdgeElement.h
+                csrc/OGDFGraph.h
+                csrc/OGDFGraphAttributes.h
+                csrc/OGDFGraphIO.h
+                csrc/OGDFFastSimpleHierarchyLayout.h
+                csrc/OGDFFMMMLayout.h
+                csrc/OGDFHierarchyLayoutModule.h
+                csrc/OGDFLayerByLayerSweep.h
+                csrc/OGDFLayeredCrossMinModule.h
+                csrc/OGDFLayoutModule.h
+                csrc/OGDFMedianHeuristic.h
+                csrc/OGDFNodeElement.h
+                csrc/OGDFOptimalHierarchyLayout.h
+                csrc/OGDFOptimalRanking.h
+                csrc/OGDFRankingModule.h
+                csrc/OGDFSugiyamaLayout.h
+                csrc/OGDFColor.cpp
+                csrc/OGDFDPoint.cpp
+                csrc/OGDFDRect.cpp
+                csrc/OGDFEdgeElement.cpp
+                csrc/OGDFGraph.cpp
+                csrc/OGDFGraphAttributes.cpp
+                csrc/OGDFGraphIO.cpp
+                csrc/OGDFFastSimpleHierarchyLayout.cpp
+                csrc/OGDFFMMMLayout.cpp
+                csrc/OGDFHierarchyLayoutModule.cpp
+                csrc/OGDFLayerByLayerSweep.cpp
+                csrc/OGDFLayeredCrossMinModule.cpp
+                csrc/OGDFLayoutModule.cpp
+                csrc/OGDFMedianHeuristic.cpp
+                csrc/OGDFNodeElement.cpp
+                csrc/OGDFOptimalHierarchyLayout.cpp
+                csrc/OGDFOptimalRanking.cpp
+                csrc/OGDFRankingModule.cpp
+                csrc/OGDFSugiyamaLayout.cpp
+
+Source-repository head
+  type:     git
+  location: https://github.com/wavewave/hs-ogdf
+
+Library
+  default-language: Haskell2010
+  hs-source-dirs: src
+  ghc-options:  -Wall -funbox-strict-fields -fno-warn-unused-do-bind -fno-warn-orphans -fno-warn-unused-imports
+  cxx-options: -std=c++17
+  Build-Depends: base > 4 && < 5, fficxx >= 0.7, fficxx-runtime >= 0.7, template-haskell, stdcxx
+  Exposed-Modules:
+                       OGDF
+                       OGDF.Ordinary
+                       OGDF.Template
+                       OGDF.TH
+                       OGDF.Color
+                       OGDF.DPoint
+                       OGDF.DRect
+                       OGDF.EdgeElement
+                       OGDF.Graph
+                       OGDF.GraphAttributes
+                       OGDF.GraphIO
+                       OGDF.FastSimpleHierarchyLayout
+                       OGDF.FMMMLayout
+                       OGDF.HierarchyLayoutModule
+                       OGDF.LayerByLayerSweep
+                       OGDF.LayeredCrossMinModule
+                       OGDF.LayoutModule
+                       OGDF.MedianHeuristic
+                       OGDF.NodeElement
+                       OGDF.OptimalHierarchyLayout
+                       OGDF.OptimalRanking
+                       OGDF.RankingModule
+                       OGDF.SugiyamaLayout
+                       OGDF.Color.RawType
+                       OGDF.DPoint.RawType
+                       OGDF.DRect.RawType
+                       OGDF.EdgeElement.RawType
+                       OGDF.Graph.RawType
+                       OGDF.GraphAttributes.RawType
+                       OGDF.GraphIO.RawType
+                       OGDF.FastSimpleHierarchyLayout.RawType
+                       OGDF.FMMMLayout.RawType
+                       OGDF.HierarchyLayoutModule.RawType
+                       OGDF.LayerByLayerSweep.RawType
+                       OGDF.LayeredCrossMinModule.RawType
+                       OGDF.LayoutModule.RawType
+                       OGDF.MedianHeuristic.RawType
+                       OGDF.NodeElement.RawType
+                       OGDF.OptimalHierarchyLayout.RawType
+                       OGDF.OptimalRanking.RawType
+                       OGDF.RankingModule.RawType
+                       OGDF.SugiyamaLayout.RawType
+                       OGDF.Color.FFI
+                       OGDF.DPoint.FFI
+                       OGDF.DRect.FFI
+                       OGDF.EdgeElement.FFI
+                       OGDF.Graph.FFI
+                       OGDF.GraphAttributes.FFI
+                       OGDF.GraphIO.FFI
+                       OGDF.FastSimpleHierarchyLayout.FFI
+                       OGDF.FMMMLayout.FFI
+                       OGDF.HierarchyLayoutModule.FFI
+                       OGDF.LayerByLayerSweep.FFI
+                       OGDF.LayeredCrossMinModule.FFI
+                       OGDF.LayoutModule.FFI
+                       OGDF.MedianHeuristic.FFI
+                       OGDF.NodeElement.FFI
+                       OGDF.OptimalHierarchyLayout.FFI
+                       OGDF.OptimalRanking.FFI
+                       OGDF.RankingModule.FFI
+                       OGDF.SugiyamaLayout.FFI
+                       OGDF.Color.Interface
+                       OGDF.DPoint.Interface
+                       OGDF.DRect.Interface
+                       OGDF.EdgeElement.Interface
+                       OGDF.Graph.Interface
+                       OGDF.GraphAttributes.Interface
+                       OGDF.GraphIO.Interface
+                       OGDF.FastSimpleHierarchyLayout.Interface
+                       OGDF.FMMMLayout.Interface
+                       OGDF.HierarchyLayoutModule.Interface
+                       OGDF.LayerByLayerSweep.Interface
+                       OGDF.LayeredCrossMinModule.Interface
+                       OGDF.LayoutModule.Interface
+                       OGDF.MedianHeuristic.Interface
+                       OGDF.NodeElement.Interface
+                       OGDF.OptimalHierarchyLayout.Interface
+                       OGDF.OptimalRanking.Interface
+                       OGDF.RankingModule.Interface
+                       OGDF.SugiyamaLayout.Interface
+                       OGDF.Color.Cast
+                       OGDF.DPoint.Cast
+                       OGDF.DRect.Cast
+                       OGDF.EdgeElement.Cast
+                       OGDF.Graph.Cast
+                       OGDF.GraphAttributes.Cast
+                       OGDF.GraphIO.Cast
+                       OGDF.FastSimpleHierarchyLayout.Cast
+                       OGDF.FMMMLayout.Cast
+                       OGDF.HierarchyLayoutModule.Cast
+                       OGDF.LayerByLayerSweep.Cast
+                       OGDF.LayeredCrossMinModule.Cast
+                       OGDF.LayoutModule.Cast
+                       OGDF.MedianHeuristic.Cast
+                       OGDF.NodeElement.Cast
+                       OGDF.OptimalHierarchyLayout.Cast
+                       OGDF.OptimalRanking.Cast
+                       OGDF.RankingModule.Cast
+                       OGDF.SugiyamaLayout.Cast
+                       OGDF.Color.Implementation
+                       OGDF.DPoint.Implementation
+                       OGDF.DRect.Implementation
+                       OGDF.EdgeElement.Implementation
+                       OGDF.Graph.Implementation
+                       OGDF.GraphAttributes.Implementation
+                       OGDF.GraphIO.Implementation
+                       OGDF.FastSimpleHierarchyLayout.Implementation
+                       OGDF.FMMMLayout.Implementation
+                       OGDF.HierarchyLayoutModule.Implementation
+                       OGDF.LayerByLayerSweep.Implementation
+                       OGDF.LayeredCrossMinModule.Implementation
+                       OGDF.LayoutModule.Implementation
+                       OGDF.MedianHeuristic.Implementation
+                       OGDF.NodeElement.Implementation
+                       OGDF.OptimalHierarchyLayout.Implementation
+                       OGDF.OptimalRanking.Implementation
+                       OGDF.RankingModule.Implementation
+                       OGDF.SugiyamaLayout.Implementation
+                       OGDF.List.Template
+                       OGDF.ListIterator.Template
+                       OGDF.List.TH
+                       OGDF.ListIterator.TH
+  Other-Modules:
+  extra-lib-dirs:
+  extra-libraries:    OGDF, COIN
+  Include-dirs:       csrc
+  pkgconfig-depends:
+  Install-includes:
+                       OGDFType.h
+                       OGDFColor.h
+                       OGDFDPoint.h
+                       OGDFDRect.h
+                       OGDFEdgeElement.h
+                       OGDFGraph.h
+                       OGDFGraphAttributes.h
+                       OGDFGraphIO.h
+                       OGDFFastSimpleHierarchyLayout.h
+                       OGDFFMMMLayout.h
+                       OGDFHierarchyLayoutModule.h
+                       OGDFLayerByLayerSweep.h
+                       OGDFLayeredCrossMinModule.h
+                       OGDFLayoutModule.h
+                       OGDFMedianHeuristic.h
+                       OGDFNodeElement.h
+                       OGDFOptimalHierarchyLayout.h
+                       OGDFOptimalRanking.h
+                       OGDFRankingModule.h
+                       OGDFSugiyamaLayout.h
+  Cxx-sources:
+                       csrc/OGDFColor.cpp
+                       csrc/OGDFDPoint.cpp
+                       csrc/OGDFDRect.cpp
+                       csrc/OGDFEdgeElement.cpp
+                       csrc/OGDFGraph.cpp
+                       csrc/OGDFGraphAttributes.cpp
+                       csrc/OGDFGraphIO.cpp
+                       csrc/OGDFFastSimpleHierarchyLayout.cpp
+                       csrc/OGDFFMMMLayout.cpp
+                       csrc/OGDFHierarchyLayoutModule.cpp
+                       csrc/OGDFLayerByLayerSweep.cpp
+                       csrc/OGDFLayeredCrossMinModule.cpp
+                       csrc/OGDFLayoutModule.cpp
+                       csrc/OGDFMedianHeuristic.cpp
+                       csrc/OGDFNodeElement.cpp
+                       csrc/OGDFOptimalHierarchyLayout.cpp
+                       csrc/OGDFOptimalRanking.cpp
+                       csrc/OGDFRankingModule.cpp
+                       csrc/OGDFSugiyamaLayout.cpp
diff --git a/csrc/OGDFColor.cpp b/csrc/OGDFColor.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFColor.cpp
@@ -0,0 +1,25 @@
+
+#include "MacroPatternMatch.h"
+
+#include "STDCppString.h"
+
+#include "STDDeletable.h"
+
+#include "ogdf/basic/graphics.h"
+
+#include "OGDFColor.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(Color)
+COLOR_DEF_VIRT(Color)
+COLOR_DEF_NONVIRT(Color)
+COLOR_DEF_ACCESSOR(Color)
+
diff --git a/csrc/OGDFColor.h b/csrc/OGDFColor.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFColor.h
@@ -0,0 +1,55 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "stdcxxType.h"
+
+
+#define COLOR_DECL_VIRT(Type) \
+
+
+
+#define COLOR_DECL_NONVIRT(Type) \
+Type##_p Type##_newColor ( string_p str );\
+bool Type##_color_fromString ( Type##_p p, string_p str );
+
+
+#define COLOR_DECL_ACCESSOR(Type) \
+
+
+
+#define COLOR_DEF_VIRT(Type) \
+
+
+
+#define COLOR_DEF_NONVIRT(Type) \
+Type##_p Type##_newColor ( string_p str ) {\
+Type* newp=new Type(from_nonconstref_to_nonconstref<string, string_t>(*(str)));return from_nonconst_to_nonconst<Type##_t, Type>(newp);\
+}\
+\
+bool Type##_color_fromString ( Type##_p p, string_p str ) {\
+return ((TYPECASTMETHOD(Type, color_fromString, Color))(p))->fromString(from_nonconstref_to_nonconstref<string, string_t>(*(str)));\
+}
+
+
+#define COLOR_DEF_ACCESSOR(Type) \
+
+
+
+DELETABLE_DECL_VIRT(Color)
+COLOR_DECL_VIRT(Color)
+COLOR_DECL_NONVIRT(Color)
+COLOR_DECL_ACCESSOR(Color)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFDPoint.cpp b/csrc/OGDFDPoint.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFDPoint.cpp
@@ -0,0 +1,23 @@
+
+#include "MacroPatternMatch.h"
+
+#include "STDDeletable.h"
+
+#include "ogdf/basic/geometry.h"
+
+#include "OGDFDPoint.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(DPoint)
+DPOINT_DEF_VIRT(DPoint)
+DPOINT_DEF_NONVIRT(DPoint)
+DPOINT_DEF_ACCESSOR(DPoint)
+
diff --git a/csrc/OGDFDPoint.h b/csrc/OGDFDPoint.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFDPoint.h
@@ -0,0 +1,64 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "stdcxxType.h"
+
+
+#define DPOINT_DECL_VIRT(Type) \
+
+
+
+#define DPOINT_DECL_NONVIRT(Type) \
+Type##_p Type##_newDPoint ( double x, double y );
+
+
+#define DPOINT_DECL_ACCESSOR(Type) \
+double Type##_m_x_get ( Type##_p p );\
+void Type##_m_x_set ( Type##_p p, double x );\
+double Type##_m_y_get ( Type##_p p );\
+void Type##_m_y_set ( Type##_p p, double x );
+
+
+#define DPOINT_DEF_VIRT(Type) \
+
+
+
+#define DPOINT_DEF_NONVIRT(Type) \
+Type##_p Type##_newDPoint ( double x, double y ) {\
+Type* newp=new Type(x, y);return from_nonconst_to_nonconst<Type##_t, Type>(newp);\
+}
+
+
+#define DPOINT_DEF_ACCESSOR(Type) \
+double Type##_m_x_get ( Type##_p p ) {\
+return (from_nonconst_to_nonconst<Type, Type##_t>(p))->m_x;\
+}\
+void Type##_m_x_set ( Type##_p p, double x ) {\
+((from_nonconst_to_nonconst<Type, Type##_t>(p))->m_x)=x;\
+}\
+double Type##_m_y_get ( Type##_p p ) {\
+return (from_nonconst_to_nonconst<Type, Type##_t>(p))->m_y;\
+}\
+void Type##_m_y_set ( Type##_p p, double x ) {\
+((from_nonconst_to_nonconst<Type, Type##_t>(p))->m_y)=x;\
+}
+
+
+DELETABLE_DECL_VIRT(DPoint)
+DPOINT_DECL_VIRT(DPoint)
+DPOINT_DECL_NONVIRT(DPoint)
+DPOINT_DECL_ACCESSOR(DPoint)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFDRect.cpp b/csrc/OGDFDRect.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFDRect.cpp
@@ -0,0 +1,23 @@
+
+#include "MacroPatternMatch.h"
+
+#include "STDDeletable.h"
+
+#include "ogdf/basic/geometry.h"
+
+#include "OGDFDRect.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(DRect)
+DRECT_DEF_VIRT(DRect)
+DRECT_DEF_NONVIRT(DRect)
+DRECT_DEF_ACCESSOR(DRect)
+
diff --git a/csrc/OGDFDRect.h b/csrc/OGDFDRect.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFDRect.h
@@ -0,0 +1,55 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "stdcxxType.h"
+
+
+#define DRECT_DECL_VIRT(Type) \
+
+
+
+#define DRECT_DECL_NONVIRT(Type) \
+double Type##_dRect_height ( Type##_p p );\
+double Type##_dRect_width ( Type##_p p );
+
+
+#define DRECT_DECL_ACCESSOR(Type) \
+
+
+
+#define DRECT_DEF_VIRT(Type) \
+
+
+
+#define DRECT_DEF_NONVIRT(Type) \
+double Type##_dRect_height ( Type##_p p ) {\
+return ((TYPECASTMETHOD(Type, dRect_height, DRect))(p))->height();\
+}\
+\
+double Type##_dRect_width ( Type##_p p ) {\
+return ((TYPECASTMETHOD(Type, dRect_width, DRect))(p))->width();\
+}
+
+
+#define DRECT_DEF_ACCESSOR(Type) \
+
+
+
+DELETABLE_DECL_VIRT(DRect)
+DRECT_DECL_VIRT(DRect)
+DRECT_DECL_NONVIRT(DRect)
+DRECT_DECL_ACCESSOR(DRect)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFEdgeElement.cpp b/csrc/OGDFEdgeElement.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFEdgeElement.cpp
@@ -0,0 +1,25 @@
+
+#include "MacroPatternMatch.h"
+
+#include "OGDFNodeElement.h"
+
+#include "STDDeletable.h"
+
+#include "ogdf/basic/Graph_d.h"
+
+#include "OGDFEdgeElement.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(EdgeElement)
+EDGEELEMENT_DEF_VIRT(EdgeElement)
+EDGEELEMENT_DEF_NONVIRT(EdgeElement)
+EDGEELEMENT_DEF_ACCESSOR(EdgeElement)
+
diff --git a/csrc/OGDFEdgeElement.h b/csrc/OGDFEdgeElement.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFEdgeElement.h
@@ -0,0 +1,70 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "stdcxxType.h"
+
+
+#define EDGEELEMENT_DECL_VIRT(Type) \
+
+
+
+#define EDGEELEMENT_DECL_NONVIRT(Type) \
+int Type##_edgeElement_index ( Type##_p p );\
+NodeElement_p Type##_edgeElement_source ( Type##_p p );\
+NodeElement_p Type##_edgeElement_target ( Type##_p p );\
+Type##_p Type##_edgeElement_succ ( Type##_p p );\
+Type##_p Type##_edgeElement_pred ( Type##_p p );
+
+
+#define EDGEELEMENT_DECL_ACCESSOR(Type) \
+
+
+
+#define EDGEELEMENT_DEF_VIRT(Type) \
+
+
+
+#define EDGEELEMENT_DEF_NONVIRT(Type) \
+int Type##_edgeElement_index ( Type##_p p ) {\
+return ((TYPECASTMETHOD(Type, edgeElement_index, EdgeElement))(p))->index();\
+}\
+\
+NodeElement_p Type##_edgeElement_source ( Type##_p p ) {\
+return from_nonconst_to_nonconst<NodeElement_t, NodeElement>((NodeElement*)((TYPECASTMETHOD(Type, edgeElement_source, EdgeElement))(p))->source());\
+}\
+\
+NodeElement_p Type##_edgeElement_target ( Type##_p p ) {\
+return from_nonconst_to_nonconst<NodeElement_t, NodeElement>((NodeElement*)((TYPECASTMETHOD(Type, edgeElement_target, EdgeElement))(p))->target());\
+}\
+\
+Type##_p Type##_edgeElement_succ ( Type##_p p ) {\
+return from_nonconst_to_nonconst<Type##_t, Type>((Type*)((TYPECASTMETHOD(Type, edgeElement_succ, EdgeElement))(p))->succ());\
+}\
+\
+Type##_p Type##_edgeElement_pred ( Type##_p p ) {\
+return from_nonconst_to_nonconst<Type##_t, Type>((Type*)((TYPECASTMETHOD(Type, edgeElement_pred, EdgeElement))(p))->pred());\
+}
+
+
+#define EDGEELEMENT_DEF_ACCESSOR(Type) \
+
+
+
+DELETABLE_DECL_VIRT(EdgeElement)
+EDGEELEMENT_DECL_VIRT(EdgeElement)
+EDGEELEMENT_DECL_NONVIRT(EdgeElement)
+EDGEELEMENT_DECL_ACCESSOR(EdgeElement)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFFMMMLayout.cpp b/csrc/OGDFFMMMLayout.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFFMMMLayout.cpp
@@ -0,0 +1,26 @@
+
+#include "MacroPatternMatch.h"
+
+#include "STDDeletable.h"
+
+#include "OGDFLayoutModule.h"
+
+#include "ogdf/energybased/FMMMLayout.h"
+
+#include "OGDFFMMMLayout.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(FMMMLayout)
+LAYOUTMODULE_DEF_VIRT(FMMMLayout)
+FMMMLAYOUT_DEF_VIRT(FMMMLayout)
+FMMMLAYOUT_DEF_NONVIRT(FMMMLayout)
+FMMMLAYOUT_DEF_ACCESSOR(FMMMLayout)
+
diff --git a/csrc/OGDFFMMMLayout.h b/csrc/OGDFFMMMLayout.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFFMMMLayout.h
@@ -0,0 +1,68 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "OGDFLayoutModule.h"
+
+#include "stdcxxType.h"
+
+
+#define FMMMLAYOUT_DECL_VIRT(Type) \
+
+
+
+#define FMMMLAYOUT_DECL_NONVIRT(Type) \
+Type##_p Type##_newFMMMLayout (  );\
+void Type##_fMMMLayout_useHighLevelOptions ( Type##_p p, bool uho );\
+void Type##_fMMMLayout_unitEdgeLength ( Type##_p p, double x );\
+void Type##_fMMMLayout_newInitialPlacement ( Type##_p p, bool nip );
+
+
+#define FMMMLAYOUT_DECL_ACCESSOR(Type) \
+
+
+
+#define FMMMLAYOUT_DEF_VIRT(Type) \
+
+
+
+#define FMMMLAYOUT_DEF_NONVIRT(Type) \
+Type##_p Type##_newFMMMLayout (  ) {\
+Type* newp=new Type();return from_nonconst_to_nonconst<Type##_t, Type>(newp);\
+}\
+\
+void Type##_fMMMLayout_useHighLevelOptions ( Type##_p p, bool uho ) {\
+((TYPECASTMETHOD(Type, fMMMLayout_useHighLevelOptions, FMMMLayout))(p))->useHighLevelOptions(uho);\
+}\
+\
+void Type##_fMMMLayout_unitEdgeLength ( Type##_p p, double x ) {\
+((TYPECASTMETHOD(Type, fMMMLayout_unitEdgeLength, FMMMLayout))(p))->unitEdgeLength(x);\
+}\
+\
+void Type##_fMMMLayout_newInitialPlacement ( Type##_p p, bool nip ) {\
+((TYPECASTMETHOD(Type, fMMMLayout_newInitialPlacement, FMMMLayout))(p))->newInitialPlacement(nip);\
+}
+
+
+#define FMMMLAYOUT_DEF_ACCESSOR(Type) \
+
+
+
+DELETABLE_DECL_VIRT(FMMMLayout)
+LAYOUTMODULE_DECL_VIRT(FMMMLayout)
+FMMMLAYOUT_DECL_VIRT(FMMMLayout)
+FMMMLAYOUT_DECL_NONVIRT(FMMMLayout)
+FMMMLAYOUT_DECL_ACCESSOR(FMMMLayout)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFFastSimpleHierarchyLayout.cpp b/csrc/OGDFFastSimpleHierarchyLayout.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFFastSimpleHierarchyLayout.cpp
@@ -0,0 +1,26 @@
+
+#include "MacroPatternMatch.h"
+
+#include "STDDeletable.h"
+
+#include "OGDFHierarchyLayoutModule.h"
+
+#include "ogdf/layered/FastSimpleHierarchyLayout.h"
+
+#include "OGDFFastSimpleHierarchyLayout.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(FastSimpleHierarchyLayout)
+HIERARCHYLAYOUTMODULE_DEF_VIRT(FastSimpleHierarchyLayout)
+FASTSIMPLEHIERARCHYLAYOUT_DEF_VIRT(FastSimpleHierarchyLayout)
+FASTSIMPLEHIERARCHYLAYOUT_DEF_NONVIRT(FastSimpleHierarchyLayout)
+FASTSIMPLEHIERARCHYLAYOUT_DEF_ACCESSOR(FastSimpleHierarchyLayout)
+
diff --git a/csrc/OGDFFastSimpleHierarchyLayout.h b/csrc/OGDFFastSimpleHierarchyLayout.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFFastSimpleHierarchyLayout.h
@@ -0,0 +1,78 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "OGDFHierarchyLayoutModule.h"
+
+#include "stdcxxType.h"
+
+
+#define FASTSIMPLEHIERARCHYLAYOUT_DECL_VIRT(Type) \
+
+
+
+#define FASTSIMPLEHIERARCHYLAYOUT_DECL_NONVIRT(Type) \
+Type##_p Type##_newFastSimpleHierarchyLayout (  );\
+void Type##_fastSimpleHierarchyLayout_layerDistance ( Type##_p p, double x );\
+void Type##_fastSimpleHierarchyLayout_nodeDistance ( Type##_p p, double x );\
+void Type##_fastSimpleHierarchyLayout_downward ( Type##_p p, bool d );\
+void Type##_fastSimpleHierarchyLayout_leftToRight ( Type##_p p, bool b );\
+void Type##_fastSimpleHierarchyLayout_balanced ( Type##_p p, bool b );
+
+
+#define FASTSIMPLEHIERARCHYLAYOUT_DECL_ACCESSOR(Type) \
+
+
+
+#define FASTSIMPLEHIERARCHYLAYOUT_DEF_VIRT(Type) \
+
+
+
+#define FASTSIMPLEHIERARCHYLAYOUT_DEF_NONVIRT(Type) \
+Type##_p Type##_newFastSimpleHierarchyLayout (  ) {\
+Type* newp=new Type();return from_nonconst_to_nonconst<Type##_t, Type>(newp);\
+}\
+\
+void Type##_fastSimpleHierarchyLayout_layerDistance ( Type##_p p, double x ) {\
+((TYPECASTMETHOD(Type, fastSimpleHierarchyLayout_layerDistance, FastSimpleHierarchyLayout))(p))->layerDistance(x);\
+}\
+\
+void Type##_fastSimpleHierarchyLayout_nodeDistance ( Type##_p p, double x ) {\
+((TYPECASTMETHOD(Type, fastSimpleHierarchyLayout_nodeDistance, FastSimpleHierarchyLayout))(p))->nodeDistance(x);\
+}\
+\
+void Type##_fastSimpleHierarchyLayout_downward ( Type##_p p, bool d ) {\
+((TYPECASTMETHOD(Type, fastSimpleHierarchyLayout_downward, FastSimpleHierarchyLayout))(p))->downward(d);\
+}\
+\
+void Type##_fastSimpleHierarchyLayout_leftToRight ( Type##_p p, bool b ) {\
+((TYPECASTMETHOD(Type, fastSimpleHierarchyLayout_leftToRight, FastSimpleHierarchyLayout))(p))->leftToRight(b);\
+}\
+\
+void Type##_fastSimpleHierarchyLayout_balanced ( Type##_p p, bool b ) {\
+((TYPECASTMETHOD(Type, fastSimpleHierarchyLayout_balanced, FastSimpleHierarchyLayout))(p))->balanced(b);\
+}
+
+
+#define FASTSIMPLEHIERARCHYLAYOUT_DEF_ACCESSOR(Type) \
+
+
+
+DELETABLE_DECL_VIRT(FastSimpleHierarchyLayout)
+HIERARCHYLAYOUTMODULE_DECL_VIRT(FastSimpleHierarchyLayout)
+FASTSIMPLEHIERARCHYLAYOUT_DECL_VIRT(FastSimpleHierarchyLayout)
+FASTSIMPLEHIERARCHYLAYOUT_DECL_NONVIRT(FastSimpleHierarchyLayout)
+FASTSIMPLEHIERARCHYLAYOUT_DECL_ACCESSOR(FastSimpleHierarchyLayout)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFGraph.cpp b/csrc/OGDFGraph.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFGraph.cpp
@@ -0,0 +1,27 @@
+
+#include "MacroPatternMatch.h"
+
+#include "OGDFNodeElement.h"
+
+#include "OGDFEdgeElement.h"
+
+#include "STDDeletable.h"
+
+#include "ogdf/basic/Graph_d.h"
+
+#include "OGDFGraph.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(Graph)
+GRAPH_DEF_VIRT(Graph)
+GRAPH_DEF_NONVIRT(Graph)
+GRAPH_DEF_ACCESSOR(Graph)
+
diff --git a/csrc/OGDFGraph.h b/csrc/OGDFGraph.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFGraph.h
@@ -0,0 +1,85 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "stdcxxType.h"
+
+
+#define GRAPH_DECL_VIRT(Type) \
+
+
+
+#define GRAPH_DECL_NONVIRT(Type) \
+Type##_p Type##_newGraph (  );\
+NodeElement_p Type##_graph_newNode ( Type##_p p );\
+NodeElement_p Type##_newNode1 ( Type##_p p, int index );\
+EdgeElement_p Type##_graph_newEdge ( Type##_p p, NodeElement_p v, NodeElement_p w );\
+NodeElement_p Type##_graph_firstNode ( Type##_p p );\
+NodeElement_p Type##_graph_lastNode ( Type##_p p );\
+EdgeElement_p Type##_graph_firstEdge ( Type##_p p );\
+EdgeElement_p Type##_graph_lastEdge ( Type##_p p );
+
+
+#define GRAPH_DECL_ACCESSOR(Type) \
+
+
+
+#define GRAPH_DEF_VIRT(Type) \
+
+
+
+#define GRAPH_DEF_NONVIRT(Type) \
+Type##_p Type##_newGraph (  ) {\
+Type* newp=new Type();return from_nonconst_to_nonconst<Type##_t, Type>(newp);\
+}\
+\
+NodeElement_p Type##_graph_newNode ( Type##_p p ) {\
+return from_nonconst_to_nonconst<NodeElement_t, NodeElement>((NodeElement*)((TYPECASTMETHOD(Type, graph_newNode, Graph))(p))->newNode());\
+}\
+\
+NodeElement_p Type##_newNode1 ( Type##_p p, int index ) {\
+return from_nonconst_to_nonconst<NodeElement_t, NodeElement>((NodeElement*)((TYPECASTMETHOD(Type, newNode1, Graph))(p))->newNode(index));\
+}\
+\
+EdgeElement_p Type##_graph_newEdge ( Type##_p p, NodeElement_p v, NodeElement_p w ) {\
+return from_nonconst_to_nonconst<EdgeElement_t, EdgeElement>((EdgeElement*)((TYPECASTMETHOD(Type, graph_newEdge, Graph))(p))->newEdge(from_nonconst_to_nonconst<NodeElement, NodeElement_t>(v), from_nonconst_to_nonconst<NodeElement, NodeElement_t>(w)));\
+}\
+\
+NodeElement_p Type##_graph_firstNode ( Type##_p p ) {\
+return from_nonconst_to_nonconst<NodeElement_t, NodeElement>((NodeElement*)((TYPECASTMETHOD(Type, graph_firstNode, Graph))(p))->firstNode());\
+}\
+\
+NodeElement_p Type##_graph_lastNode ( Type##_p p ) {\
+return from_nonconst_to_nonconst<NodeElement_t, NodeElement>((NodeElement*)((TYPECASTMETHOD(Type, graph_lastNode, Graph))(p))->lastNode());\
+}\
+\
+EdgeElement_p Type##_graph_firstEdge ( Type##_p p ) {\
+return from_nonconst_to_nonconst<EdgeElement_t, EdgeElement>((EdgeElement*)((TYPECASTMETHOD(Type, graph_firstEdge, Graph))(p))->firstEdge());\
+}\
+\
+EdgeElement_p Type##_graph_lastEdge ( Type##_p p ) {\
+return from_nonconst_to_nonconst<EdgeElement_t, EdgeElement>((EdgeElement*)((TYPECASTMETHOD(Type, graph_lastEdge, Graph))(p))->lastEdge());\
+}
+
+
+#define GRAPH_DEF_ACCESSOR(Type) \
+
+
+
+DELETABLE_DECL_VIRT(Graph)
+GRAPH_DECL_VIRT(Graph)
+GRAPH_DECL_NONVIRT(Graph)
+GRAPH_DECL_ACCESSOR(Graph)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFGraphAttributes.cpp b/csrc/OGDFGraphAttributes.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFGraphAttributes.cpp
@@ -0,0 +1,37 @@
+
+#include "MacroPatternMatch.h"
+
+#include "OGDFColor.h"
+
+#include "OGDFDPoint.h"
+
+#include "STDCppString.h"
+
+#include "OGDFDRect.h"
+
+#include "OGDFGraph.h"
+
+#include "OGDFNodeElement.h"
+
+#include "OGDFEdgeElement.h"
+
+#include "STDDeletable.h"
+
+#include "ogdf/basic/GraphAttributes.h"
+
+#include "OGDFGraphAttributes.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(GraphAttributes)
+GRAPHATTRIBUTES_DEF_VIRT(GraphAttributes)
+GRAPHATTRIBUTES_DEF_NONVIRT(GraphAttributes)
+GRAPHATTRIBUTES_DEF_ACCESSOR(GraphAttributes)
+
diff --git a/csrc/OGDFGraphAttributes.h b/csrc/OGDFGraphAttributes.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFGraphAttributes.h
@@ -0,0 +1,107 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "stdcxxType.h"
+
+
+#define GRAPHATTRIBUTES_DECL_VIRT(Type) \
+DRect_p Type##_boundingBox ( Type##_p p );
+
+
+#define GRAPHATTRIBUTES_DECL_NONVIRT(Type) \
+Type##_p Type##_newGraphAttributes ( Graph_p g, long initAttributes );\
+Color_p Type##_graphAttributes_fillColor ( Type##_p p, NodeElement_p v );\
+Color_p Type##_graphAttributes_fillBgColor ( Type##_p p, NodeElement_p v );\
+double* Type##_graphAttributes_x ( Type##_p p, NodeElement_p v );\
+double* Type##_graphAttributes_y ( Type##_p p, NodeElement_p v );\
+double* Type##_graphAttributes_width ( Type##_p p, NodeElement_p v );\
+double* Type##_graphAttributes_height ( Type##_p p, NodeElement_p v );\
+void* Type##_graphAttributes_bends ( Type##_p p, EdgeElement_p e );\
+string_p Type##_graphAttributes_label ( Type##_p p, NodeElement_p v );\
+string_p Type##_graphAttributeslabelE ( Type##_p p, EdgeElement_p e );\
+double* Type##_graphAttributes_xLabel ( Type##_p p, NodeElement_p v );\
+double* Type##_graphAttributes_yLabel ( Type##_p p, NodeElement_p v );
+
+
+#define GRAPHATTRIBUTES_DECL_ACCESSOR(Type) \
+
+
+
+#define GRAPHATTRIBUTES_DEF_VIRT(Type) \
+DRect_p Type##_boundingBox ( Type##_p p ) {\
+return from_nonconst_to_nonconst<DRect_t, DRect>(new DRect(((TYPECASTMETHOD(Type, boundingBox, GraphAttributes))(p))->boundingBox()));\
+}
+
+
+#define GRAPHATTRIBUTES_DEF_NONVIRT(Type) \
+Type##_p Type##_newGraphAttributes ( Graph_p g, long initAttributes ) {\
+Type* newp=new Type(from_nonconstref_to_nonconstref<Graph, Graph_t>(*(g)), initAttributes);return from_nonconst_to_nonconst<Type##_t, Type>(newp);\
+}\
+\
+Color_p Type##_graphAttributes_fillColor ( Type##_p p, NodeElement_p v ) {\
+return from_nonconst_to_nonconst<Color_t, Color>(&(((TYPECASTMETHOD(Type, graphAttributes_fillColor, GraphAttributes))(p))->fillColor(from_nonconst_to_nonconst<NodeElement, NodeElement_t>(v))));\
+}\
+\
+Color_p Type##_graphAttributes_fillBgColor ( Type##_p p, NodeElement_p v ) {\
+return from_nonconst_to_nonconst<Color_t, Color>(&(((TYPECASTMETHOD(Type, graphAttributes_fillBgColor, GraphAttributes))(p))->fillBgColor(from_nonconst_to_nonconst<NodeElement, NodeElement_t>(v))));\
+}\
+\
+double* Type##_graphAttributes_x ( Type##_p p, NodeElement_p v ) {\
+return &(((TYPECASTMETHOD(Type, graphAttributes_x, GraphAttributes))(p))->x(from_nonconst_to_nonconst<NodeElement, NodeElement_t>(v)));\
+}\
+\
+double* Type##_graphAttributes_y ( Type##_p p, NodeElement_p v ) {\
+return &(((TYPECASTMETHOD(Type, graphAttributes_y, GraphAttributes))(p))->y(from_nonconst_to_nonconst<NodeElement, NodeElement_t>(v)));\
+}\
+\
+double* Type##_graphAttributes_width ( Type##_p p, NodeElement_p v ) {\
+return &(((TYPECASTMETHOD(Type, graphAttributes_width, GraphAttributes))(p))->width(from_nonconst_to_nonconst<NodeElement, NodeElement_t>(v)));\
+}\
+\
+double* Type##_graphAttributes_height ( Type##_p p, NodeElement_p v ) {\
+return &(((TYPECASTMETHOD(Type, graphAttributes_height, GraphAttributes))(p))->height(from_nonconst_to_nonconst<NodeElement, NodeElement_t>(v)));\
+}\
+\
+void* Type##_graphAttributes_bends ( Type##_p p, EdgeElement_p e ) {\
+List<DPoint>* r=new List<DPoint>(((TYPECASTMETHOD(Type, graphAttributes_bends, GraphAttributes))(p))->bends(from_nonconst_to_nonconst<EdgeElement, EdgeElement_t>(e)));return static_cast<void*>(r);\
+}\
+\
+string_p Type##_graphAttributes_label ( Type##_p p, NodeElement_p v ) {\
+return from_nonconst_to_nonconst<string_t, string>(&(((TYPECASTMETHOD(Type, graphAttributes_label, GraphAttributes))(p))->label(from_nonconst_to_nonconst<NodeElement, NodeElement_t>(v))));\
+}\
+\
+string_p Type##_graphAttributeslabelE ( Type##_p p, EdgeElement_p e ) {\
+return from_nonconst_to_nonconst<string_t, string>(&(((TYPECASTMETHOD(Type, graphAttributeslabelE, GraphAttributes))(p))->label(from_nonconst_to_nonconst<EdgeElement, EdgeElement_t>(e))));\
+}\
+\
+double* Type##_graphAttributes_xLabel ( Type##_p p, NodeElement_p v ) {\
+return &(((TYPECASTMETHOD(Type, graphAttributes_xLabel, GraphAttributes))(p))->xLabel(from_nonconst_to_nonconst<NodeElement, NodeElement_t>(v)));\
+}\
+\
+double* Type##_graphAttributes_yLabel ( Type##_p p, NodeElement_p v ) {\
+return &(((TYPECASTMETHOD(Type, graphAttributes_yLabel, GraphAttributes))(p))->yLabel(from_nonconst_to_nonconst<NodeElement, NodeElement_t>(v)));\
+}
+
+
+#define GRAPHATTRIBUTES_DEF_ACCESSOR(Type) \
+
+
+
+DELETABLE_DECL_VIRT(GraphAttributes)
+GRAPHATTRIBUTES_DECL_VIRT(GraphAttributes)
+GRAPHATTRIBUTES_DECL_NONVIRT(GraphAttributes)
+GRAPHATTRIBUTES_DECL_ACCESSOR(GraphAttributes)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFGraphIO.cpp b/csrc/OGDFGraphIO.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFGraphIO.cpp
@@ -0,0 +1,29 @@
+
+#include "MacroPatternMatch.h"
+
+#include "OGDFGraphAttributes.h"
+
+#include "OGDFGraph.h"
+
+#include "STDCppString.h"
+
+#include "STDDeletable.h"
+
+#include "ogdf/fileformats/GraphIO.h"
+
+#include "OGDFGraphIO.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(GraphIO)
+GRAPHIO_DEF_VIRT(GraphIO)
+GRAPHIO_DEF_NONVIRT(GraphIO)
+GRAPHIO_DEF_ACCESSOR(GraphIO)
+
diff --git a/csrc/OGDFGraphIO.h b/csrc/OGDFGraphIO.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFGraphIO.h
@@ -0,0 +1,60 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "stdcxxType.h"
+
+
+#define GRAPHIO_DECL_VIRT(Type) \
+
+
+
+#define GRAPHIO_DECL_NONVIRT(Type) \
+bool Type##_graphIO_read ( GraphAttributes_p ga, Graph_p g, string_p filename );\
+bool Type##_graphIO_write ( GraphAttributes_p ga, string_p filename );\
+bool Type##_graphIO_drawSVG ( GraphAttributes_p ga, string_p filename );
+
+
+#define GRAPHIO_DECL_ACCESSOR(Type) \
+
+
+
+#define GRAPHIO_DEF_VIRT(Type) \
+
+
+
+#define GRAPHIO_DEF_NONVIRT(Type) \
+bool Type##_graphIO_read ( GraphAttributes_p ga, Graph_p g, string_p filename ) {\
+return GraphIO::read(from_nonconstref_to_nonconstref<GraphAttributes, GraphAttributes_t>(*(ga)), from_nonconstref_to_nonconstref<Graph, Graph_t>(*(g)), from_nonconstref_to_nonconstref<string, string_t>(*(filename)));\
+}\
+\
+bool Type##_graphIO_write ( GraphAttributes_p ga, string_p filename ) {\
+return GraphIO::write(from_nonconstref_to_nonconstref<GraphAttributes, GraphAttributes_t>(*(ga)), from_nonconstref_to_nonconstref<string, string_t>(*(filename)));\
+}\
+\
+bool Type##_graphIO_drawSVG ( GraphAttributes_p ga, string_p filename ) {\
+return GraphIO::drawSVG(from_nonconstref_to_nonconstref<GraphAttributes, GraphAttributes_t>(*(ga)), from_nonconstref_to_nonconstref<string, string_t>(*(filename)));\
+}
+
+
+#define GRAPHIO_DEF_ACCESSOR(Type) \
+
+
+
+DELETABLE_DECL_VIRT(GraphIO)
+GRAPHIO_DECL_VIRT(GraphIO)
+GRAPHIO_DECL_NONVIRT(GraphIO)
+GRAPHIO_DECL_ACCESSOR(GraphIO)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFHierarchyLayoutModule.cpp b/csrc/OGDFHierarchyLayoutModule.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFHierarchyLayoutModule.cpp
@@ -0,0 +1,23 @@
+
+#include "MacroPatternMatch.h"
+
+#include "STDDeletable.h"
+
+#include "ogdf/layered/HierarchyLayoutModule.h"
+
+#include "OGDFHierarchyLayoutModule.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(HierarchyLayoutModule)
+HIERARCHYLAYOUTMODULE_DEF_VIRT(HierarchyLayoutModule)
+HIERARCHYLAYOUTMODULE_DEF_NONVIRT(HierarchyLayoutModule)
+HIERARCHYLAYOUTMODULE_DEF_ACCESSOR(HierarchyLayoutModule)
+
diff --git a/csrc/OGDFHierarchyLayoutModule.h b/csrc/OGDFHierarchyLayoutModule.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFHierarchyLayoutModule.h
@@ -0,0 +1,48 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "stdcxxType.h"
+
+
+#define HIERARCHYLAYOUTMODULE_DECL_VIRT(Type) \
+
+
+
+#define HIERARCHYLAYOUTMODULE_DECL_NONVIRT(Type) \
+
+
+
+#define HIERARCHYLAYOUTMODULE_DECL_ACCESSOR(Type) \
+
+
+
+#define HIERARCHYLAYOUTMODULE_DEF_VIRT(Type) \
+
+
+
+#define HIERARCHYLAYOUTMODULE_DEF_NONVIRT(Type) \
+
+
+
+#define HIERARCHYLAYOUTMODULE_DEF_ACCESSOR(Type) \
+
+
+
+DELETABLE_DECL_VIRT(HierarchyLayoutModule)
+HIERARCHYLAYOUTMODULE_DECL_VIRT(HierarchyLayoutModule)
+HIERARCHYLAYOUTMODULE_DECL_NONVIRT(HierarchyLayoutModule)
+HIERARCHYLAYOUTMODULE_DECL_ACCESSOR(HierarchyLayoutModule)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFLayerByLayerSweep.cpp b/csrc/OGDFLayerByLayerSweep.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFLayerByLayerSweep.cpp
@@ -0,0 +1,26 @@
+
+#include "MacroPatternMatch.h"
+
+#include "STDDeletable.h"
+
+#include "OGDFLayeredCrossMinModule.h"
+
+#include "ogdf/layered/LayerByLayerSweep.h"
+
+#include "OGDFLayerByLayerSweep.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(LayerByLayerSweep)
+LAYEREDCROSSMINMODULE_DEF_VIRT(LayerByLayerSweep)
+LAYERBYLAYERSWEEP_DEF_VIRT(LayerByLayerSweep)
+LAYERBYLAYERSWEEP_DEF_NONVIRT(LayerByLayerSweep)
+LAYERBYLAYERSWEEP_DEF_ACCESSOR(LayerByLayerSweep)
+
diff --git a/csrc/OGDFLayerByLayerSweep.h b/csrc/OGDFLayerByLayerSweep.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFLayerByLayerSweep.h
@@ -0,0 +1,51 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "OGDFLayeredCrossMinModule.h"
+
+#include "stdcxxType.h"
+
+
+#define LAYERBYLAYERSWEEP_DECL_VIRT(Type) \
+
+
+
+#define LAYERBYLAYERSWEEP_DECL_NONVIRT(Type) \
+
+
+
+#define LAYERBYLAYERSWEEP_DECL_ACCESSOR(Type) \
+
+
+
+#define LAYERBYLAYERSWEEP_DEF_VIRT(Type) \
+
+
+
+#define LAYERBYLAYERSWEEP_DEF_NONVIRT(Type) \
+
+
+
+#define LAYERBYLAYERSWEEP_DEF_ACCESSOR(Type) \
+
+
+
+DELETABLE_DECL_VIRT(LayerByLayerSweep)
+LAYEREDCROSSMINMODULE_DECL_VIRT(LayerByLayerSweep)
+LAYERBYLAYERSWEEP_DECL_VIRT(LayerByLayerSweep)
+LAYERBYLAYERSWEEP_DECL_NONVIRT(LayerByLayerSweep)
+LAYERBYLAYERSWEEP_DECL_ACCESSOR(LayerByLayerSweep)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFLayeredCrossMinModule.cpp b/csrc/OGDFLayeredCrossMinModule.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFLayeredCrossMinModule.cpp
@@ -0,0 +1,23 @@
+
+#include "MacroPatternMatch.h"
+
+#include "STDDeletable.h"
+
+#include "ogdf/layered/LayeredCrossMinModule.h"
+
+#include "OGDFLayeredCrossMinModule.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(LayeredCrossMinModule)
+LAYEREDCROSSMINMODULE_DEF_VIRT(LayeredCrossMinModule)
+LAYEREDCROSSMINMODULE_DEF_NONVIRT(LayeredCrossMinModule)
+LAYEREDCROSSMINMODULE_DEF_ACCESSOR(LayeredCrossMinModule)
+
diff --git a/csrc/OGDFLayeredCrossMinModule.h b/csrc/OGDFLayeredCrossMinModule.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFLayeredCrossMinModule.h
@@ -0,0 +1,48 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "stdcxxType.h"
+
+
+#define LAYEREDCROSSMINMODULE_DECL_VIRT(Type) \
+
+
+
+#define LAYEREDCROSSMINMODULE_DECL_NONVIRT(Type) \
+
+
+
+#define LAYEREDCROSSMINMODULE_DECL_ACCESSOR(Type) \
+
+
+
+#define LAYEREDCROSSMINMODULE_DEF_VIRT(Type) \
+
+
+
+#define LAYEREDCROSSMINMODULE_DEF_NONVIRT(Type) \
+
+
+
+#define LAYEREDCROSSMINMODULE_DEF_ACCESSOR(Type) \
+
+
+
+DELETABLE_DECL_VIRT(LayeredCrossMinModule)
+LAYEREDCROSSMINMODULE_DECL_VIRT(LayeredCrossMinModule)
+LAYEREDCROSSMINMODULE_DECL_NONVIRT(LayeredCrossMinModule)
+LAYEREDCROSSMINMODULE_DECL_ACCESSOR(LayeredCrossMinModule)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFLayoutModule.cpp b/csrc/OGDFLayoutModule.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFLayoutModule.cpp
@@ -0,0 +1,24 @@
+
+#include "MacroPatternMatch.h"
+
+#include "OGDFGraphAttributes.h"
+
+#include "STDDeletable.h"
+
+#include "ogdf/basic/LayoutModule.h"
+
+#include "OGDFLayoutModule.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(LayoutModule)
+LAYOUTMODULE_DEF_NONVIRT(LayoutModule)
+LAYOUTMODULE_DEF_ACCESSOR(LayoutModule)
+
diff --git a/csrc/OGDFLayoutModule.h b/csrc/OGDFLayoutModule.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFLayoutModule.h
@@ -0,0 +1,50 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "stdcxxType.h"
+
+
+#define LAYOUTMODULE_DECL_VIRT(Type) \
+void Type##_call ( Type##_p p, GraphAttributes_p ga );
+
+
+#define LAYOUTMODULE_DECL_NONVIRT(Type) \
+
+
+
+#define LAYOUTMODULE_DECL_ACCESSOR(Type) \
+
+
+
+#define LAYOUTMODULE_DEF_VIRT(Type) \
+void Type##_call ( Type##_p p, GraphAttributes_p ga ) {\
+((TYPECASTMETHOD(Type, call, LayoutModule))(p))->call(from_nonconstref_to_nonconstref<GraphAttributes, GraphAttributes_t>(*(ga)));\
+}
+
+
+#define LAYOUTMODULE_DEF_NONVIRT(Type) \
+
+
+
+#define LAYOUTMODULE_DEF_ACCESSOR(Type) \
+
+
+
+DELETABLE_DECL_VIRT(LayoutModule)
+LAYOUTMODULE_DECL_VIRT(LayoutModule)
+LAYOUTMODULE_DECL_NONVIRT(LayoutModule)
+LAYOUTMODULE_DECL_ACCESSOR(LayoutModule)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFMedianHeuristic.cpp b/csrc/OGDFMedianHeuristic.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFMedianHeuristic.cpp
@@ -0,0 +1,27 @@
+
+#include "MacroPatternMatch.h"
+
+#include "STDDeletable.h"
+
+#include "OGDFLayerByLayerSweep.h"
+
+#include "ogdf/layered/MedianHeuristic.h"
+
+#include "OGDFMedianHeuristic.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(MedianHeuristic)
+LAYERBYLAYERSWEEP_DEF_VIRT(MedianHeuristic)
+LAYEREDCROSSMINMODULE_DEF_VIRT(MedianHeuristic)
+MEDIANHEURISTIC_DEF_VIRT(MedianHeuristic)
+MEDIANHEURISTIC_DEF_NONVIRT(MedianHeuristic)
+MEDIANHEURISTIC_DEF_ACCESSOR(MedianHeuristic)
+
diff --git a/csrc/OGDFMedianHeuristic.h b/csrc/OGDFMedianHeuristic.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFMedianHeuristic.h
@@ -0,0 +1,56 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "OGDFLayerByLayerSweep.h"
+
+#include "OGDFLayeredCrossMinModule.h"
+
+#include "stdcxxType.h"
+
+
+#define MEDIANHEURISTIC_DECL_VIRT(Type) \
+
+
+
+#define MEDIANHEURISTIC_DECL_NONVIRT(Type) \
+Type##_p Type##_newMedianHeuristic (  );
+
+
+#define MEDIANHEURISTIC_DECL_ACCESSOR(Type) \
+
+
+
+#define MEDIANHEURISTIC_DEF_VIRT(Type) \
+
+
+
+#define MEDIANHEURISTIC_DEF_NONVIRT(Type) \
+Type##_p Type##_newMedianHeuristic (  ) {\
+Type* newp=new Type();return from_nonconst_to_nonconst<Type##_t, Type>(newp);\
+}
+
+
+#define MEDIANHEURISTIC_DEF_ACCESSOR(Type) \
+
+
+
+DELETABLE_DECL_VIRT(MedianHeuristic)
+LAYERBYLAYERSWEEP_DECL_VIRT(MedianHeuristic)
+LAYEREDCROSSMINMODULE_DECL_VIRT(MedianHeuristic)
+MEDIANHEURISTIC_DECL_VIRT(MedianHeuristic)
+MEDIANHEURISTIC_DECL_NONVIRT(MedianHeuristic)
+MEDIANHEURISTIC_DECL_ACCESSOR(MedianHeuristic)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFNodeElement.cpp b/csrc/OGDFNodeElement.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFNodeElement.cpp
@@ -0,0 +1,23 @@
+
+#include "MacroPatternMatch.h"
+
+#include "STDDeletable.h"
+
+#include "ogdf/basic/Graph_d.h"
+
+#include "OGDFNodeElement.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(NodeElement)
+NODEELEMENT_DEF_VIRT(NodeElement)
+NODEELEMENT_DEF_NONVIRT(NodeElement)
+NODEELEMENT_DEF_ACCESSOR(NodeElement)
+
diff --git a/csrc/OGDFNodeElement.h b/csrc/OGDFNodeElement.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFNodeElement.h
@@ -0,0 +1,75 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "stdcxxType.h"
+
+
+#define NODEELEMENT_DECL_VIRT(Type) \
+
+
+
+#define NODEELEMENT_DECL_NONVIRT(Type) \
+int Type##_nodeElement_index ( Type##_p p );\
+int Type##_nodeElement_indeg ( Type##_p p );\
+int Type##_nodeElement_outdeg ( Type##_p p );\
+int Type##_nodeElement_degree ( Type##_p p );\
+Type##_p Type##_nodeElement_succ ( Type##_p p );\
+Type##_p Type##_nodeElement_pred ( Type##_p p );
+
+
+#define NODEELEMENT_DECL_ACCESSOR(Type) \
+
+
+
+#define NODEELEMENT_DEF_VIRT(Type) \
+
+
+
+#define NODEELEMENT_DEF_NONVIRT(Type) \
+int Type##_nodeElement_index ( Type##_p p ) {\
+return ((TYPECASTMETHOD(Type, nodeElement_index, NodeElement))(p))->index();\
+}\
+\
+int Type##_nodeElement_indeg ( Type##_p p ) {\
+return ((TYPECASTMETHOD(Type, nodeElement_indeg, NodeElement))(p))->indeg();\
+}\
+\
+int Type##_nodeElement_outdeg ( Type##_p p ) {\
+return ((TYPECASTMETHOD(Type, nodeElement_outdeg, NodeElement))(p))->outdeg();\
+}\
+\
+int Type##_nodeElement_degree ( Type##_p p ) {\
+return ((TYPECASTMETHOD(Type, nodeElement_degree, NodeElement))(p))->degree();\
+}\
+\
+Type##_p Type##_nodeElement_succ ( Type##_p p ) {\
+return from_nonconst_to_nonconst<Type##_t, Type>((Type*)((TYPECASTMETHOD(Type, nodeElement_succ, NodeElement))(p))->succ());\
+}\
+\
+Type##_p Type##_nodeElement_pred ( Type##_p p ) {\
+return from_nonconst_to_nonconst<Type##_t, Type>((Type*)((TYPECASTMETHOD(Type, nodeElement_pred, NodeElement))(p))->pred());\
+}
+
+
+#define NODEELEMENT_DEF_ACCESSOR(Type) \
+
+
+
+DELETABLE_DECL_VIRT(NodeElement)
+NODEELEMENT_DECL_VIRT(NodeElement)
+NODEELEMENT_DECL_NONVIRT(NodeElement)
+NODEELEMENT_DECL_ACCESSOR(NodeElement)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFOptimalHierarchyLayout.cpp b/csrc/OGDFOptimalHierarchyLayout.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFOptimalHierarchyLayout.cpp
@@ -0,0 +1,26 @@
+
+#include "MacroPatternMatch.h"
+
+#include "STDDeletable.h"
+
+#include "OGDFHierarchyLayoutModule.h"
+
+#include "ogdf/layered/OptimalHierarchyLayout.h"
+
+#include "OGDFOptimalHierarchyLayout.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(OptimalHierarchyLayout)
+HIERARCHYLAYOUTMODULE_DEF_VIRT(OptimalHierarchyLayout)
+OPTIMALHIERARCHYLAYOUT_DEF_VIRT(OptimalHierarchyLayout)
+OPTIMALHIERARCHYLAYOUT_DEF_NONVIRT(OptimalHierarchyLayout)
+OPTIMALHIERARCHYLAYOUT_DEF_ACCESSOR(OptimalHierarchyLayout)
+
diff --git a/csrc/OGDFOptimalHierarchyLayout.h b/csrc/OGDFOptimalHierarchyLayout.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFOptimalHierarchyLayout.h
@@ -0,0 +1,68 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "OGDFHierarchyLayoutModule.h"
+
+#include "stdcxxType.h"
+
+
+#define OPTIMALHIERARCHYLAYOUT_DECL_VIRT(Type) \
+
+
+
+#define OPTIMALHIERARCHYLAYOUT_DECL_NONVIRT(Type) \
+Type##_p Type##_newOptimalHierarchyLayout (  );\
+void Type##_optimalHierarchyLayout_layerDistance ( Type##_p p, double x );\
+void Type##_optimalHierarchyLayout_nodeDistance ( Type##_p p, double x );\
+void Type##_optimalHierarchyLayout_weightBalancing ( Type##_p p, double w );
+
+
+#define OPTIMALHIERARCHYLAYOUT_DECL_ACCESSOR(Type) \
+
+
+
+#define OPTIMALHIERARCHYLAYOUT_DEF_VIRT(Type) \
+
+
+
+#define OPTIMALHIERARCHYLAYOUT_DEF_NONVIRT(Type) \
+Type##_p Type##_newOptimalHierarchyLayout (  ) {\
+Type* newp=new Type();return from_nonconst_to_nonconst<Type##_t, Type>(newp);\
+}\
+\
+void Type##_optimalHierarchyLayout_layerDistance ( Type##_p p, double x ) {\
+((TYPECASTMETHOD(Type, optimalHierarchyLayout_layerDistance, OptimalHierarchyLayout))(p))->layerDistance(x);\
+}\
+\
+void Type##_optimalHierarchyLayout_nodeDistance ( Type##_p p, double x ) {\
+((TYPECASTMETHOD(Type, optimalHierarchyLayout_nodeDistance, OptimalHierarchyLayout))(p))->nodeDistance(x);\
+}\
+\
+void Type##_optimalHierarchyLayout_weightBalancing ( Type##_p p, double w ) {\
+((TYPECASTMETHOD(Type, optimalHierarchyLayout_weightBalancing, OptimalHierarchyLayout))(p))->weightBalancing(w);\
+}
+
+
+#define OPTIMALHIERARCHYLAYOUT_DEF_ACCESSOR(Type) \
+
+
+
+DELETABLE_DECL_VIRT(OptimalHierarchyLayout)
+HIERARCHYLAYOUTMODULE_DECL_VIRT(OptimalHierarchyLayout)
+OPTIMALHIERARCHYLAYOUT_DECL_VIRT(OptimalHierarchyLayout)
+OPTIMALHIERARCHYLAYOUT_DECL_NONVIRT(OptimalHierarchyLayout)
+OPTIMALHIERARCHYLAYOUT_DECL_ACCESSOR(OptimalHierarchyLayout)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFOptimalRanking.cpp b/csrc/OGDFOptimalRanking.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFOptimalRanking.cpp
@@ -0,0 +1,26 @@
+
+#include "MacroPatternMatch.h"
+
+#include "STDDeletable.h"
+
+#include "OGDFRankingModule.h"
+
+#include "ogdf/layered/OptimalRanking.h"
+
+#include "OGDFOptimalRanking.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(OptimalRanking)
+RANKINGMODULE_DEF_VIRT(OptimalRanking)
+OPTIMALRANKING_DEF_VIRT(OptimalRanking)
+OPTIMALRANKING_DEF_NONVIRT(OptimalRanking)
+OPTIMALRANKING_DEF_ACCESSOR(OptimalRanking)
+
diff --git a/csrc/OGDFOptimalRanking.h b/csrc/OGDFOptimalRanking.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFOptimalRanking.h
@@ -0,0 +1,53 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "OGDFRankingModule.h"
+
+#include "stdcxxType.h"
+
+
+#define OPTIMALRANKING_DECL_VIRT(Type) \
+
+
+
+#define OPTIMALRANKING_DECL_NONVIRT(Type) \
+Type##_p Type##_newOptimalRanking (  );
+
+
+#define OPTIMALRANKING_DECL_ACCESSOR(Type) \
+
+
+
+#define OPTIMALRANKING_DEF_VIRT(Type) \
+
+
+
+#define OPTIMALRANKING_DEF_NONVIRT(Type) \
+Type##_p Type##_newOptimalRanking (  ) {\
+Type* newp=new Type();return from_nonconst_to_nonconst<Type##_t, Type>(newp);\
+}
+
+
+#define OPTIMALRANKING_DEF_ACCESSOR(Type) \
+
+
+
+DELETABLE_DECL_VIRT(OptimalRanking)
+RANKINGMODULE_DECL_VIRT(OptimalRanking)
+OPTIMALRANKING_DECL_VIRT(OptimalRanking)
+OPTIMALRANKING_DECL_NONVIRT(OptimalRanking)
+OPTIMALRANKING_DECL_ACCESSOR(OptimalRanking)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFRankingModule.cpp b/csrc/OGDFRankingModule.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFRankingModule.cpp
@@ -0,0 +1,23 @@
+
+#include "MacroPatternMatch.h"
+
+#include "STDDeletable.h"
+
+#include "ogdf/layered/RankingModule.h"
+
+#include "OGDFRankingModule.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(RankingModule)
+RANKINGMODULE_DEF_VIRT(RankingModule)
+RANKINGMODULE_DEF_NONVIRT(RankingModule)
+RANKINGMODULE_DEF_ACCESSOR(RankingModule)
+
diff --git a/csrc/OGDFRankingModule.h b/csrc/OGDFRankingModule.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFRankingModule.h
@@ -0,0 +1,48 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "stdcxxType.h"
+
+
+#define RANKINGMODULE_DECL_VIRT(Type) \
+
+
+
+#define RANKINGMODULE_DECL_NONVIRT(Type) \
+
+
+
+#define RANKINGMODULE_DECL_ACCESSOR(Type) \
+
+
+
+#define RANKINGMODULE_DEF_VIRT(Type) \
+
+
+
+#define RANKINGMODULE_DEF_NONVIRT(Type) \
+
+
+
+#define RANKINGMODULE_DEF_ACCESSOR(Type) \
+
+
+
+DELETABLE_DECL_VIRT(RankingModule)
+RANKINGMODULE_DECL_VIRT(RankingModule)
+RANKINGMODULE_DECL_NONVIRT(RankingModule)
+RANKINGMODULE_DECL_ACCESSOR(RankingModule)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFSugiyamaLayout.cpp b/csrc/OGDFSugiyamaLayout.cpp
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFSugiyamaLayout.cpp
@@ -0,0 +1,32 @@
+
+#include "MacroPatternMatch.h"
+
+#include "OGDFLayeredCrossMinModule.h"
+
+#include "OGDFHierarchyLayoutModule.h"
+
+#include "OGDFRankingModule.h"
+
+#include "STDDeletable.h"
+
+#include "OGDFLayoutModule.h"
+
+#include "ogdf/layered/SugiyamaLayout.h"
+
+#include "OGDFSugiyamaLayout.h"
+
+using namespace ogdf;
+
+#define CHECKPROTECT(x,y) FXIS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)
+
+#define TYPECASTMETHOD(cname,mname,oname) \
+  FXIIF( CHECKPROTECT(cname,mname) ) ( \
+  (from_nonconst_to_nonconst<oname,cname ## _t>), \
+  (from_nonconst_to_nonconst<cname,cname ## _t>) )
+
+DELETABLE_DEF_VIRT(SugiyamaLayout)
+LAYOUTMODULE_DEF_VIRT(SugiyamaLayout)
+SUGIYAMALAYOUT_DEF_VIRT(SugiyamaLayout)
+SUGIYAMALAYOUT_DEF_NONVIRT(SugiyamaLayout)
+SUGIYAMALAYOUT_DEF_ACCESSOR(SugiyamaLayout)
+
diff --git a/csrc/OGDFSugiyamaLayout.h b/csrc/OGDFSugiyamaLayout.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFSugiyamaLayout.h
@@ -0,0 +1,73 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+
+#include "OGDFType.h"
+
+#include "STDDeletable.h"
+
+#include "OGDFLayoutModule.h"
+
+#include "stdcxxType.h"
+
+
+#define SUGIYAMALAYOUT_DECL_VIRT(Type) \
+
+
+
+#define SUGIYAMALAYOUT_DECL_NONVIRT(Type) \
+Type##_p Type##_newSugiyamaLayout (  );\
+void Type##_sugiyamaLayout_pageRatio ( Type##_p p, double x );\
+void Type##_sugiyamaLayout_setCrossMin ( Type##_p p, LayeredCrossMinModule_p pCrossMin );\
+void Type##_sugiyamaLayout_setLayout ( Type##_p p, HierarchyLayoutModule_p pLayout );\
+void Type##_sugiyamaLayout_setRanking ( Type##_p p, RankingModule_p pRanking );
+
+
+#define SUGIYAMALAYOUT_DECL_ACCESSOR(Type) \
+
+
+
+#define SUGIYAMALAYOUT_DEF_VIRT(Type) \
+
+
+
+#define SUGIYAMALAYOUT_DEF_NONVIRT(Type) \
+Type##_p Type##_newSugiyamaLayout (  ) {\
+Type* newp=new Type();return from_nonconst_to_nonconst<Type##_t, Type>(newp);\
+}\
+\
+void Type##_sugiyamaLayout_pageRatio ( Type##_p p, double x ) {\
+((TYPECASTMETHOD(Type, sugiyamaLayout_pageRatio, SugiyamaLayout))(p))->pageRatio(x);\
+}\
+\
+void Type##_sugiyamaLayout_setCrossMin ( Type##_p p, LayeredCrossMinModule_p pCrossMin ) {\
+((TYPECASTMETHOD(Type, sugiyamaLayout_setCrossMin, SugiyamaLayout))(p))->setCrossMin(from_nonconst_to_nonconst<LayeredCrossMinModule, LayeredCrossMinModule_t>(pCrossMin));\
+}\
+\
+void Type##_sugiyamaLayout_setLayout ( Type##_p p, HierarchyLayoutModule_p pLayout ) {\
+((TYPECASTMETHOD(Type, sugiyamaLayout_setLayout, SugiyamaLayout))(p))->setLayout(from_nonconst_to_nonconst<HierarchyLayoutModule, HierarchyLayoutModule_t>(pLayout));\
+}\
+\
+void Type##_sugiyamaLayout_setRanking ( Type##_p p, RankingModule_p pRanking ) {\
+((TYPECASTMETHOD(Type, sugiyamaLayout_setRanking, SugiyamaLayout))(p))->setRanking(from_nonconst_to_nonconst<RankingModule, RankingModule_t>(pRanking));\
+}
+
+
+#define SUGIYAMALAYOUT_DEF_ACCESSOR(Type) \
+
+
+
+DELETABLE_DECL_VIRT(SugiyamaLayout)
+LAYOUTMODULE_DECL_VIRT(SugiyamaLayout)
+SUGIYAMALAYOUT_DECL_VIRT(SugiyamaLayout)
+SUGIYAMALAYOUT_DECL_NONVIRT(SugiyamaLayout)
+SUGIYAMALAYOUT_DECL_ACCESSOR(SugiyamaLayout)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/csrc/OGDFType.h b/csrc/OGDFType.h
new file mode 100644
--- /dev/null
+++ b/csrc/OGDFType.h
@@ -0,0 +1,49 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma once
+
+// Opaque type definition for $classname
+typedef struct Color_tag Color_t;typedef Color_t * Color_p;typedef Color_t const* const_Color_p;
+// Opaque type definition for $classname
+typedef struct DPoint_tag DPoint_t;typedef DPoint_t * DPoint_p;typedef DPoint_t const* const_DPoint_p;
+// Opaque type definition for $classname
+typedef struct DRect_tag DRect_t;typedef DRect_t * DRect_p;typedef DRect_t const* const_DRect_p;
+// Opaque type definition for $classname
+typedef struct EdgeElement_tag EdgeElement_t;typedef EdgeElement_t * EdgeElement_p;typedef EdgeElement_t const* const_EdgeElement_p;
+// Opaque type definition for $classname
+typedef struct Graph_tag Graph_t;typedef Graph_t * Graph_p;typedef Graph_t const* const_Graph_p;
+// Opaque type definition for $classname
+typedef struct GraphAttributes_tag GraphAttributes_t;typedef GraphAttributes_t * GraphAttributes_p;typedef GraphAttributes_t const* const_GraphAttributes_p;
+// Opaque type definition for $classname
+typedef struct GraphIO_tag GraphIO_t;typedef GraphIO_t * GraphIO_p;typedef GraphIO_t const* const_GraphIO_p;
+// Opaque type definition for $classname
+typedef struct FastSimpleHierarchyLayout_tag FastSimpleHierarchyLayout_t;typedef FastSimpleHierarchyLayout_t * FastSimpleHierarchyLayout_p;typedef FastSimpleHierarchyLayout_t const* const_FastSimpleHierarchyLayout_p;
+// Opaque type definition for $classname
+typedef struct FMMMLayout_tag FMMMLayout_t;typedef FMMMLayout_t * FMMMLayout_p;typedef FMMMLayout_t const* const_FMMMLayout_p;
+// Opaque type definition for $classname
+typedef struct HierarchyLayoutModule_tag HierarchyLayoutModule_t;typedef HierarchyLayoutModule_t * HierarchyLayoutModule_p;typedef HierarchyLayoutModule_t const* const_HierarchyLayoutModule_p;
+// Opaque type definition for $classname
+typedef struct LayerByLayerSweep_tag LayerByLayerSweep_t;typedef LayerByLayerSweep_t * LayerByLayerSweep_p;typedef LayerByLayerSweep_t const* const_LayerByLayerSweep_p;
+// Opaque type definition for $classname
+typedef struct LayeredCrossMinModule_tag LayeredCrossMinModule_t;typedef LayeredCrossMinModule_t * LayeredCrossMinModule_p;typedef LayeredCrossMinModule_t const* const_LayeredCrossMinModule_p;
+// Opaque type definition for $classname
+typedef struct LayoutModule_tag LayoutModule_t;typedef LayoutModule_t * LayoutModule_p;typedef LayoutModule_t const* const_LayoutModule_p;
+// Opaque type definition for $classname
+typedef struct MedianHeuristic_tag MedianHeuristic_t;typedef MedianHeuristic_t * MedianHeuristic_p;typedef MedianHeuristic_t const* const_MedianHeuristic_p;
+// Opaque type definition for $classname
+typedef struct NodeElement_tag NodeElement_t;typedef NodeElement_t * NodeElement_p;typedef NodeElement_t const* const_NodeElement_p;
+// Opaque type definition for $classname
+typedef struct OptimalHierarchyLayout_tag OptimalHierarchyLayout_t;typedef OptimalHierarchyLayout_t * OptimalHierarchyLayout_p;typedef OptimalHierarchyLayout_t const* const_OptimalHierarchyLayout_p;
+// Opaque type definition for $classname
+typedef struct OptimalRanking_tag OptimalRanking_t;typedef OptimalRanking_t * OptimalRanking_p;typedef OptimalRanking_t const* const_OptimalRanking_p;
+// Opaque type definition for $classname
+typedef struct RankingModule_tag RankingModule_t;typedef RankingModule_t * RankingModule_p;typedef RankingModule_t const* const_RankingModule_p;
+// Opaque type definition for $classname
+typedef struct SugiyamaLayout_tag SugiyamaLayout_t;typedef SugiyamaLayout_t * SugiyamaLayout_p;typedef SugiyamaLayout_t const* const_SugiyamaLayout_p;
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/src/OGDF.hs b/src/OGDF.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF.hs
@@ -0,0 +1,36 @@
+{-# LANGUAGE FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF
+       (module OGDF.Color, module OGDF.DPoint, module OGDF.DRect,
+        module OGDF.EdgeElement, module OGDF.Graph,
+        module OGDF.GraphAttributes, module OGDF.GraphIO,
+        module OGDF.FastSimpleHierarchyLayout, module OGDF.FMMMLayout,
+        module OGDF.HierarchyLayoutModule, module OGDF.LayerByLayerSweep,
+        module OGDF.LayeredCrossMinModule, module OGDF.LayoutModule,
+        module OGDF.MedianHeuristic, module OGDF.NodeElement,
+        module OGDF.OptimalHierarchyLayout, module OGDF.OptimalRanking,
+        module OGDF.RankingModule, module OGDF.SugiyamaLayout,
+        module OGDF.Ordinary, module OGDF.Template, module OGDF.TH)
+       where
+import OGDF.Color
+import OGDF.DPoint
+import OGDF.DRect
+import OGDF.EdgeElement
+import OGDF.Graph
+import OGDF.GraphAttributes
+import OGDF.GraphIO
+import OGDF.FastSimpleHierarchyLayout
+import OGDF.FMMMLayout
+import OGDF.HierarchyLayoutModule
+import OGDF.LayerByLayerSweep
+import OGDF.LayeredCrossMinModule
+import OGDF.LayoutModule
+import OGDF.MedianHeuristic
+import OGDF.NodeElement
+import OGDF.OptimalHierarchyLayout
+import OGDF.OptimalRanking
+import OGDF.RankingModule
+import OGDF.SugiyamaLayout
+import OGDF.Template
+import OGDF.TH
+import OGDF.Ordinary
diff --git a/src/OGDF/Color.hs b/src/OGDF/Color.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/Color.hs
@@ -0,0 +1,7 @@
+module OGDF.Color
+       (Color(..), IColor, upcastColor, downcastColor, newColor,
+        color_fromString)
+       where
+import OGDF.Color.RawType
+import OGDF.Color.Interface
+import OGDF.Color.Implementation
diff --git a/src/OGDF/Color/Cast.hs b/src/OGDF/Color/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/Color/Cast.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.Color.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.Color.RawType
+import OGDF.Color.Interface
+
+instance (IColor a, FPtr a) => Castable (a) (Ptr RawColor) where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
+
+instance () => Castable (Color) (Ptr RawColor) where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/Color/FFI.hsc b/src/OGDF/Color/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/Color/FFI.hsc
@@ -0,0 +1,19 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.Color.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.Color.RawType
+import OGDF.Color.RawType
+import STD.CppString.RawType
+
+foreign import ccall interruptible "OGDFColor.h Color_delete"
+               c_color_delete :: Ptr RawColor -> IO ()
+
+foreign import ccall interruptible "OGDFColor.h Color_newColor"
+               c_color_newcolor :: Ptr RawCppString -> IO (Ptr RawColor)
+
+foreign import ccall interruptible
+               "OGDFColor.h Color_color_fromString" c_color_color_fromstring ::
+               Ptr RawColor -> Ptr RawCppString -> IO CBool
diff --git a/src/OGDF/Color/Implementation.hs b/src/OGDF/Color/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/Color/Implementation.hs
@@ -0,0 +1,41 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.Color.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.Color.RawType
+import OGDF.Color.FFI
+import OGDF.Color.Interface
+import OGDF.Color.Cast
+import OGDF.Color.RawType
+import OGDF.Color.Cast
+import OGDF.Color.Interface
+import STD.CppString.RawType
+import STD.CppString.Cast
+import STD.CppString.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
+
+instance () => IColor (Color) where
+
+instance () => IDeletable (Color) where
+        delete = xform0 c_color_delete
+
+newColor :: (ICppString c0, FPtr c0) => c0 -> IO Color
+newColor = xform0 c_color_newcolor
+
+color_fromString ::
+                   (ICppString c0, FPtr c0) => Color -> c0 -> IO CBool
+color_fromString = xform1 c_color_color_fromstring
diff --git a/src/OGDF/Color/Interface.hs b/src/OGDF/Color/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/Color/Interface.hs
@@ -0,0 +1,26 @@
+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
+  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
+  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
+  TypeSynonymInstances #-}
+module OGDF.Color.Interface where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.Color.RawType
+import STD.Deletable.Interface
+
+class (IDeletable a) => IColor a where
+
+upcastColor :: forall a . (FPtr a, IColor a) => a -> Color
+upcastColor h
+  = let fh = get_fptr h
+        fh2 :: Ptr RawColor = castPtr fh
+      in cast_fptr_to_obj fh2
+
+downcastColor :: forall a . (FPtr a, IColor a) => Color -> a
+downcastColor h
+  = let fh = get_fptr h
+        fh2 = castPtr fh
+      in cast_fptr_to_obj fh2
diff --git a/src/OGDF/Color/RawType.hs b/src/OGDF/Color/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/Color/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.Color.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawColor
+
+newtype Color = Color (Ptr RawColor)
+                  deriving (Eq, Ord, Show)
+
+instance () => FPtr (Color) where
+        type Raw Color = RawColor
+        get_fptr (Color ptr) = ptr
+        cast_fptr_to_obj = Color
diff --git a/src/OGDF/DPoint.hs b/src/OGDF/DPoint.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/DPoint.hs
@@ -0,0 +1,6 @@
+module OGDF.DPoint
+       (DPoint(..), IDPoint, upcastDPoint, downcastDPoint, newDPoint)
+       where
+import OGDF.DPoint.RawType
+import OGDF.DPoint.Interface
+import OGDF.DPoint.Implementation
diff --git a/src/OGDF/DPoint/Cast.hs b/src/OGDF/DPoint/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/DPoint/Cast.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.DPoint.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.DPoint.RawType
+import OGDF.DPoint.Interface
+
+instance (IDPoint a, FPtr a) => Castable (a) (Ptr RawDPoint) where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
+
+instance () => Castable (DPoint) (Ptr RawDPoint) where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/DPoint/FFI.hsc b/src/OGDF/DPoint/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/DPoint/FFI.hsc
@@ -0,0 +1,26 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.DPoint.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.DPoint.RawType
+import OGDF.DPoint.RawType
+
+foreign import ccall interruptible "OGDFDPoint.h DPoint_delete"
+               c_dpoint_delete :: Ptr RawDPoint -> IO ()
+
+foreign import ccall interruptible "OGDFDPoint.h DPoint_newDPoint"
+               c_dpoint_newdpoint :: CDouble -> CDouble -> IO (Ptr RawDPoint)
+
+foreign import ccall interruptible "DPoint_m_x_get"
+               c_dpoint_m_x_get :: Ptr RawDPoint -> IO CDouble
+
+foreign import ccall interruptible "DPoint_m_x_set"
+               c_dpoint_m_x_set :: Ptr RawDPoint -> CDouble -> IO ()
+
+foreign import ccall interruptible "DPoint_m_y_get"
+               c_dpoint_m_y_get :: Ptr RawDPoint -> IO CDouble
+
+foreign import ccall interruptible "DPoint_m_y_set"
+               c_dpoint_m_y_set :: Ptr RawDPoint -> CDouble -> IO ()
diff --git a/src/OGDF/DPoint/Implementation.hs b/src/OGDF/DPoint/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/DPoint/Implementation.hs
@@ -0,0 +1,46 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.DPoint.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.DPoint.RawType
+import OGDF.DPoint.FFI
+import OGDF.DPoint.Interface
+import OGDF.DPoint.Cast
+import OGDF.DPoint.RawType
+import OGDF.DPoint.Cast
+import OGDF.DPoint.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
+
+instance () => IDPoint (DPoint) where
+
+instance () => IDeletable (DPoint) where
+        delete = xform0 c_dpoint_delete
+
+newDPoint :: () => CDouble -> CDouble -> IO DPoint
+newDPoint = xform1 c_dpoint_newdpoint
+
+dPoint_m_x_get :: () => DPoint -> IO CDouble
+dPoint_m_x_get = xform0 c_dpoint_m_x_get
+
+dPoint_m_x_set :: () => DPoint -> CDouble -> IO ()
+dPoint_m_x_set = xform1 c_dpoint_m_x_set
+
+dPoint_m_y_get :: () => DPoint -> IO CDouble
+dPoint_m_y_get = xform0 c_dpoint_m_y_get
+
+dPoint_m_y_set :: () => DPoint -> CDouble -> IO ()
+dPoint_m_y_set = xform1 c_dpoint_m_y_set
diff --git a/src/OGDF/DPoint/Interface.hs b/src/OGDF/DPoint/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/DPoint/Interface.hs
@@ -0,0 +1,26 @@
+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
+  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
+  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
+  TypeSynonymInstances #-}
+module OGDF.DPoint.Interface where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.DPoint.RawType
+import STD.Deletable.Interface
+
+class (IDeletable a) => IDPoint a where
+
+upcastDPoint :: forall a . (FPtr a, IDPoint a) => a -> DPoint
+upcastDPoint h
+  = let fh = get_fptr h
+        fh2 :: Ptr RawDPoint = castPtr fh
+      in cast_fptr_to_obj fh2
+
+downcastDPoint :: forall a . (FPtr a, IDPoint a) => DPoint -> a
+downcastDPoint h
+  = let fh = get_fptr h
+        fh2 = castPtr fh
+      in cast_fptr_to_obj fh2
diff --git a/src/OGDF/DPoint/RawType.hs b/src/OGDF/DPoint/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/DPoint/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.DPoint.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawDPoint
+
+newtype DPoint = DPoint (Ptr RawDPoint)
+                   deriving (Eq, Ord, Show)
+
+instance () => FPtr (DPoint) where
+        type Raw DPoint = RawDPoint
+        get_fptr (DPoint ptr) = ptr
+        cast_fptr_to_obj = DPoint
diff --git a/src/OGDF/DRect.hs b/src/OGDF/DRect.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/DRect.hs
@@ -0,0 +1,7 @@
+module OGDF.DRect
+       (DRect(..), IDRect, upcastDRect, downcastDRect, dRect_height,
+        dRect_width)
+       where
+import OGDF.DRect.RawType
+import OGDF.DRect.Interface
+import OGDF.DRect.Implementation
diff --git a/src/OGDF/DRect/Cast.hs b/src/OGDF/DRect/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/DRect/Cast.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.DRect.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.DRect.RawType
+import OGDF.DRect.Interface
+
+instance (IDRect a, FPtr a) => Castable (a) (Ptr RawDRect) where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
+
+instance () => Castable (DRect) (Ptr RawDRect) where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/DRect/FFI.hsc b/src/OGDF/DRect/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/DRect/FFI.hsc
@@ -0,0 +1,17 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.DRect.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.DRect.RawType
+import OGDF.DRect.RawType
+
+foreign import ccall interruptible "OGDFDRect.h DRect_delete"
+               c_drect_delete :: Ptr RawDRect -> IO ()
+
+foreign import ccall interruptible "OGDFDRect.h DRect_dRect_height"
+               c_drect_drect_height :: Ptr RawDRect -> IO CDouble
+
+foreign import ccall interruptible "OGDFDRect.h DRect_dRect_width"
+               c_drect_drect_width :: Ptr RawDRect -> IO CDouble
diff --git a/src/OGDF/DRect/Implementation.hs b/src/OGDF/DRect/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/DRect/Implementation.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.DRect.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.DRect.RawType
+import OGDF.DRect.FFI
+import OGDF.DRect.Interface
+import OGDF.DRect.Cast
+import OGDF.DRect.RawType
+import OGDF.DRect.Cast
+import OGDF.DRect.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
+
+instance () => IDRect (DRect) where
+
+instance () => IDeletable (DRect) where
+        delete = xform0 c_drect_delete
+
+dRect_height :: () => DRect -> IO CDouble
+dRect_height = xform0 c_drect_drect_height
+
+dRect_width :: () => DRect -> IO CDouble
+dRect_width = xform0 c_drect_drect_width
diff --git a/src/OGDF/DRect/Interface.hs b/src/OGDF/DRect/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/DRect/Interface.hs
@@ -0,0 +1,26 @@
+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
+  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
+  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
+  TypeSynonymInstances #-}
+module OGDF.DRect.Interface where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.DRect.RawType
+import STD.Deletable.Interface
+
+class (IDeletable a) => IDRect a where
+
+upcastDRect :: forall a . (FPtr a, IDRect a) => a -> DRect
+upcastDRect h
+  = let fh = get_fptr h
+        fh2 :: Ptr RawDRect = castPtr fh
+      in cast_fptr_to_obj fh2
+
+downcastDRect :: forall a . (FPtr a, IDRect a) => DRect -> a
+downcastDRect h
+  = let fh = get_fptr h
+        fh2 = castPtr fh
+      in cast_fptr_to_obj fh2
diff --git a/src/OGDF/DRect/RawType.hs b/src/OGDF/DRect/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/DRect/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.DRect.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawDRect
+
+newtype DRect = DRect (Ptr RawDRect)
+                  deriving (Eq, Ord, Show)
+
+instance () => FPtr (DRect) where
+        type Raw DRect = RawDRect
+        get_fptr (DRect ptr) = ptr
+        cast_fptr_to_obj = DRect
diff --git a/src/OGDF/EdgeElement.hs b/src/OGDF/EdgeElement.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/EdgeElement.hs
@@ -0,0 +1,8 @@
+module OGDF.EdgeElement
+       (EdgeElement(..), IEdgeElement, upcastEdgeElement,
+        downcastEdgeElement, edgeElement_index, edgeElement_source,
+        edgeElement_target, edgeElement_succ, edgeElement_pred)
+       where
+import OGDF.EdgeElement.RawType
+import OGDF.EdgeElement.Interface
+import OGDF.EdgeElement.Implementation
diff --git a/src/OGDF/EdgeElement/Cast.hs b/src/OGDF/EdgeElement/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/EdgeElement/Cast.hs
@@ -0,0 +1,19 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.EdgeElement.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.EdgeElement.RawType
+import OGDF.EdgeElement.Interface
+
+instance (IEdgeElement a, FPtr a) =>
+         Castable (a) (Ptr RawEdgeElement)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
+
+instance () => Castable (EdgeElement) (Ptr RawEdgeElement) where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/EdgeElement/FFI.hsc b/src/OGDF/EdgeElement/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/EdgeElement/FFI.hsc
@@ -0,0 +1,37 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.EdgeElement.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.EdgeElement.RawType
+import OGDF.EdgeElement.RawType
+import OGDF.NodeElement.RawType
+
+foreign import ccall interruptible
+               "OGDFEdgeElement.h EdgeElement_delete" c_edgeelement_delete ::
+               Ptr RawEdgeElement -> IO ()
+
+foreign import ccall interruptible
+               "OGDFEdgeElement.h EdgeElement_edgeElement_index"
+               c_edgeelement_edgeelement_index :: Ptr RawEdgeElement -> IO CInt
+
+foreign import ccall interruptible
+               "OGDFEdgeElement.h EdgeElement_edgeElement_source"
+               c_edgeelement_edgeelement_source ::
+               Ptr RawEdgeElement -> IO (Ptr RawNodeElement)
+
+foreign import ccall interruptible
+               "OGDFEdgeElement.h EdgeElement_edgeElement_target"
+               c_edgeelement_edgeelement_target ::
+               Ptr RawEdgeElement -> IO (Ptr RawNodeElement)
+
+foreign import ccall interruptible
+               "OGDFEdgeElement.h EdgeElement_edgeElement_succ"
+               c_edgeelement_edgeelement_succ ::
+               Ptr RawEdgeElement -> IO (Ptr RawEdgeElement)
+
+foreign import ccall interruptible
+               "OGDFEdgeElement.h EdgeElement_edgeElement_pred"
+               c_edgeelement_edgeelement_pred ::
+               Ptr RawEdgeElement -> IO (Ptr RawEdgeElement)
diff --git a/src/OGDF/EdgeElement/Implementation.hs b/src/OGDF/EdgeElement/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/EdgeElement/Implementation.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.EdgeElement.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.EdgeElement.RawType
+import OGDF.EdgeElement.FFI
+import OGDF.EdgeElement.Interface
+import OGDF.EdgeElement.Cast
+import OGDF.EdgeElement.RawType
+import OGDF.EdgeElement.Cast
+import OGDF.EdgeElement.Interface
+import OGDF.NodeElement.RawType
+import OGDF.NodeElement.Cast
+import OGDF.NodeElement.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
+
+instance () => IEdgeElement (EdgeElement) where
+
+instance () => IDeletable (EdgeElement) where
+        delete = xform0 c_edgeelement_delete
+
+edgeElement_index :: () => EdgeElement -> IO CInt
+edgeElement_index = xform0 c_edgeelement_edgeelement_index
+
+edgeElement_source :: () => EdgeElement -> IO NodeElement
+edgeElement_source = xform0 c_edgeelement_edgeelement_source
+
+edgeElement_target :: () => EdgeElement -> IO NodeElement
+edgeElement_target = xform0 c_edgeelement_edgeelement_target
+
+edgeElement_succ :: () => EdgeElement -> IO EdgeElement
+edgeElement_succ = xform0 c_edgeelement_edgeelement_succ
+
+edgeElement_pred :: () => EdgeElement -> IO EdgeElement
+edgeElement_pred = xform0 c_edgeelement_edgeelement_pred
diff --git a/src/OGDF/EdgeElement/Interface.hs b/src/OGDF/EdgeElement/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/EdgeElement/Interface.hs
@@ -0,0 +1,28 @@
+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
+  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
+  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
+  TypeSynonymInstances #-}
+module OGDF.EdgeElement.Interface where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.EdgeElement.RawType
+import STD.Deletable.Interface
+
+class (IDeletable a) => IEdgeElement a where
+
+upcastEdgeElement ::
+                  forall a . (FPtr a, IEdgeElement a) => a -> EdgeElement
+upcastEdgeElement h
+  = let fh = get_fptr h
+        fh2 :: Ptr RawEdgeElement = castPtr fh
+      in cast_fptr_to_obj fh2
+
+downcastEdgeElement ::
+                    forall a . (FPtr a, IEdgeElement a) => EdgeElement -> a
+downcastEdgeElement h
+  = let fh = get_fptr h
+        fh2 = castPtr fh
+      in cast_fptr_to_obj fh2
diff --git a/src/OGDF/EdgeElement/RawType.hs b/src/OGDF/EdgeElement/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/EdgeElement/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.EdgeElement.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawEdgeElement
+
+newtype EdgeElement = EdgeElement (Ptr RawEdgeElement)
+                        deriving (Eq, Ord, Show)
+
+instance () => FPtr (EdgeElement) where
+        type Raw EdgeElement = RawEdgeElement
+        get_fptr (EdgeElement ptr) = ptr
+        cast_fptr_to_obj = EdgeElement
diff --git a/src/OGDF/FMMMLayout.hs b/src/OGDF/FMMMLayout.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/FMMMLayout.hs
@@ -0,0 +1,8 @@
+module OGDF.FMMMLayout
+       (FMMMLayout(..), IFMMMLayout, upcastFMMMLayout, downcastFMMMLayout,
+        newFMMMLayout, fMMMLayout_useHighLevelOptions,
+        fMMMLayout_unitEdgeLength, fMMMLayout_newInitialPlacement)
+       where
+import OGDF.FMMMLayout.RawType
+import OGDF.FMMMLayout.Interface
+import OGDF.FMMMLayout.Implementation
diff --git a/src/OGDF/FMMMLayout/Cast.hs b/src/OGDF/FMMMLayout/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/FMMMLayout/Cast.hs
@@ -0,0 +1,19 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.FMMMLayout.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.FMMMLayout.RawType
+import OGDF.FMMMLayout.Interface
+
+instance (IFMMMLayout a, FPtr a) =>
+         Castable (a) (Ptr RawFMMMLayout)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
+
+instance () => Castable (FMMMLayout) (Ptr RawFMMMLayout) where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/FMMMLayout/FFI.hsc b/src/OGDF/FMMMLayout/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/FMMMLayout/FFI.hsc
@@ -0,0 +1,36 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.FMMMLayout.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.FMMMLayout.RawType
+import OGDF.FMMMLayout.RawType
+import OGDF.GraphAttributes.RawType
+
+foreign import ccall interruptible
+               "OGDFFMMMLayout.h FMMMLayout_delete" c_fmmmlayout_delete ::
+               Ptr RawFMMMLayout -> IO ()
+
+foreign import ccall interruptible
+               "OGDFFMMMLayout.h FMMMLayout_call" c_fmmmlayout_call ::
+               Ptr RawFMMMLayout -> Ptr RawGraphAttributes -> IO ()
+
+foreign import ccall interruptible
+               "OGDFFMMMLayout.h FMMMLayout_newFMMMLayout"
+               c_fmmmlayout_newfmmmlayout :: IO (Ptr RawFMMMLayout)
+
+foreign import ccall interruptible
+               "OGDFFMMMLayout.h FMMMLayout_fMMMLayout_useHighLevelOptions"
+               c_fmmmlayout_fmmmlayout_usehighleveloptions ::
+               Ptr RawFMMMLayout -> CBool -> IO ()
+
+foreign import ccall interruptible
+               "OGDFFMMMLayout.h FMMMLayout_fMMMLayout_unitEdgeLength"
+               c_fmmmlayout_fmmmlayout_unitedgelength ::
+               Ptr RawFMMMLayout -> CDouble -> IO ()
+
+foreign import ccall interruptible
+               "OGDFFMMMLayout.h FMMMLayout_fMMMLayout_newInitialPlacement"
+               c_fmmmlayout_fmmmlayout_newinitialplacement ::
+               Ptr RawFMMMLayout -> CBool -> IO ()
diff --git a/src/OGDF/FMMMLayout/Implementation.hs b/src/OGDF/FMMMLayout/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/FMMMLayout/Implementation.hs
@@ -0,0 +1,57 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.FMMMLayout.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.FMMMLayout.RawType
+import OGDF.FMMMLayout.FFI
+import OGDF.FMMMLayout.Interface
+import OGDF.FMMMLayout.Cast
+import OGDF.FMMMLayout.RawType
+import OGDF.FMMMLayout.Cast
+import OGDF.FMMMLayout.Interface
+import OGDF.GraphAttributes.RawType
+import OGDF.GraphAttributes.Cast
+import OGDF.GraphAttributes.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
+import OGDF.LayoutModule.RawType
+import OGDF.LayoutModule.Cast
+import OGDF.LayoutModule.Interface
+
+instance () => IFMMMLayout (FMMMLayout) where
+
+instance () => IDeletable (FMMMLayout) where
+        delete = xform0 c_fmmmlayout_delete
+
+instance () => ILayoutModule (FMMMLayout) where
+        call = xform1 c_fmmmlayout_call
+
+newFMMMLayout :: () => IO FMMMLayout
+newFMMMLayout = xformnull c_fmmmlayout_newfmmmlayout
+
+fMMMLayout_useHighLevelOptions ::
+                                 () => FMMMLayout -> CBool -> IO ()
+fMMMLayout_useHighLevelOptions
+  = xform1 c_fmmmlayout_fmmmlayout_usehighleveloptions
+
+fMMMLayout_unitEdgeLength :: () => FMMMLayout -> CDouble -> IO ()
+fMMMLayout_unitEdgeLength
+  = xform1 c_fmmmlayout_fmmmlayout_unitedgelength
+
+fMMMLayout_newInitialPlacement ::
+                                 () => FMMMLayout -> CBool -> IO ()
+fMMMLayout_newInitialPlacement
+  = xform1 c_fmmmlayout_fmmmlayout_newinitialplacement
diff --git a/src/OGDF/FMMMLayout/Interface.hs b/src/OGDF/FMMMLayout/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/FMMMLayout/Interface.hs
@@ -0,0 +1,29 @@
+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
+  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
+  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
+  TypeSynonymInstances #-}
+module OGDF.FMMMLayout.Interface where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.FMMMLayout.RawType
+import STD.Deletable.Interface
+import OGDF.LayoutModule.Interface
+
+class (IDeletable a, ILayoutModule a) => IFMMMLayout a where
+
+upcastFMMMLayout ::
+                 forall a . (FPtr a, IFMMMLayout a) => a -> FMMMLayout
+upcastFMMMLayout h
+  = let fh = get_fptr h
+        fh2 :: Ptr RawFMMMLayout = castPtr fh
+      in cast_fptr_to_obj fh2
+
+downcastFMMMLayout ::
+                   forall a . (FPtr a, IFMMMLayout a) => FMMMLayout -> a
+downcastFMMMLayout h
+  = let fh = get_fptr h
+        fh2 = castPtr fh
+      in cast_fptr_to_obj fh2
diff --git a/src/OGDF/FMMMLayout/RawType.hs b/src/OGDF/FMMMLayout/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/FMMMLayout/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.FMMMLayout.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawFMMMLayout
+
+newtype FMMMLayout = FMMMLayout (Ptr RawFMMMLayout)
+                       deriving (Eq, Ord, Show)
+
+instance () => FPtr (FMMMLayout) where
+        type Raw FMMMLayout = RawFMMMLayout
+        get_fptr (FMMMLayout ptr) = ptr
+        cast_fptr_to_obj = FMMMLayout
diff --git a/src/OGDF/FastSimpleHierarchyLayout.hs b/src/OGDF/FastSimpleHierarchyLayout.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/FastSimpleHierarchyLayout.hs
@@ -0,0 +1,13 @@
+module OGDF.FastSimpleHierarchyLayout
+       (FastSimpleHierarchyLayout(..), IFastSimpleHierarchyLayout,
+        upcastFastSimpleHierarchyLayout, downcastFastSimpleHierarchyLayout,
+        newFastSimpleHierarchyLayout,
+        fastSimpleHierarchyLayout_layerDistance,
+        fastSimpleHierarchyLayout_nodeDistance,
+        fastSimpleHierarchyLayout_downward,
+        fastSimpleHierarchyLayout_leftToRight,
+        fastSimpleHierarchyLayout_balanced)
+       where
+import OGDF.FastSimpleHierarchyLayout.RawType
+import OGDF.FastSimpleHierarchyLayout.Interface
+import OGDF.FastSimpleHierarchyLayout.Implementation
diff --git a/src/OGDF/FastSimpleHierarchyLayout/Cast.hs b/src/OGDF/FastSimpleHierarchyLayout/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/FastSimpleHierarchyLayout/Cast.hs
@@ -0,0 +1,22 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.FastSimpleHierarchyLayout.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.FastSimpleHierarchyLayout.RawType
+import OGDF.FastSimpleHierarchyLayout.Interface
+
+instance (IFastSimpleHierarchyLayout a, FPtr a) =>
+         Castable (a) (Ptr RawFastSimpleHierarchyLayout)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
+
+instance () =>
+         Castable (FastSimpleHierarchyLayout)
+           (Ptr RawFastSimpleHierarchyLayout)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/FastSimpleHierarchyLayout/FFI.hsc b/src/OGDF/FastSimpleHierarchyLayout/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/FastSimpleHierarchyLayout/FFI.hsc
@@ -0,0 +1,43 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.FastSimpleHierarchyLayout.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.FastSimpleHierarchyLayout.RawType
+import OGDF.FastSimpleHierarchyLayout.RawType
+
+foreign import ccall interruptible
+               "OGDFFastSimpleHierarchyLayout.h FastSimpleHierarchyLayout_delete"
+               c_fastsimplehierarchylayout_delete ::
+               Ptr RawFastSimpleHierarchyLayout -> IO ()
+
+foreign import ccall interruptible
+               "OGDFFastSimpleHierarchyLayout.h FastSimpleHierarchyLayout_newFastSimpleHierarchyLayout"
+               c_fastsimplehierarchylayout_newfastsimplehierarchylayout ::
+               IO (Ptr RawFastSimpleHierarchyLayout)
+
+foreign import ccall interruptible
+               "OGDFFastSimpleHierarchyLayout.h FastSimpleHierarchyLayout_fastSimpleHierarchyLayout_layerDistance"
+               c_fastsimplehierarchylayout_fastsimplehierarchylayout_layerdistance
+               :: Ptr RawFastSimpleHierarchyLayout -> CDouble -> IO ()
+
+foreign import ccall interruptible
+               "OGDFFastSimpleHierarchyLayout.h FastSimpleHierarchyLayout_fastSimpleHierarchyLayout_nodeDistance"
+               c_fastsimplehierarchylayout_fastsimplehierarchylayout_nodedistance
+               :: Ptr RawFastSimpleHierarchyLayout -> CDouble -> IO ()
+
+foreign import ccall interruptible
+               "OGDFFastSimpleHierarchyLayout.h FastSimpleHierarchyLayout_fastSimpleHierarchyLayout_downward"
+               c_fastsimplehierarchylayout_fastsimplehierarchylayout_downward ::
+               Ptr RawFastSimpleHierarchyLayout -> CBool -> IO ()
+
+foreign import ccall interruptible
+               "OGDFFastSimpleHierarchyLayout.h FastSimpleHierarchyLayout_fastSimpleHierarchyLayout_leftToRight"
+               c_fastsimplehierarchylayout_fastsimplehierarchylayout_lefttoright
+               :: Ptr RawFastSimpleHierarchyLayout -> CBool -> IO ()
+
+foreign import ccall interruptible
+               "OGDFFastSimpleHierarchyLayout.h FastSimpleHierarchyLayout_fastSimpleHierarchyLayout_balanced"
+               c_fastsimplehierarchylayout_fastsimplehierarchylayout_balanced ::
+               Ptr RawFastSimpleHierarchyLayout -> CBool -> IO ()
diff --git a/src/OGDF/FastSimpleHierarchyLayout/Implementation.hs b/src/OGDF/FastSimpleHierarchyLayout/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/FastSimpleHierarchyLayout/Implementation.hs
@@ -0,0 +1,74 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.FastSimpleHierarchyLayout.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.FastSimpleHierarchyLayout.RawType
+import OGDF.FastSimpleHierarchyLayout.FFI
+import OGDF.FastSimpleHierarchyLayout.Interface
+import OGDF.FastSimpleHierarchyLayout.Cast
+import OGDF.FastSimpleHierarchyLayout.RawType
+import OGDF.FastSimpleHierarchyLayout.Cast
+import OGDF.FastSimpleHierarchyLayout.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
+import OGDF.HierarchyLayoutModule.RawType
+import OGDF.HierarchyLayoutModule.Cast
+import OGDF.HierarchyLayoutModule.Interface
+
+instance () =>
+         IFastSimpleHierarchyLayout (FastSimpleHierarchyLayout)
+         where
+
+instance () => IDeletable (FastSimpleHierarchyLayout) where
+        delete = xform0 c_fastsimplehierarchylayout_delete
+
+instance () => IHierarchyLayoutModule (FastSimpleHierarchyLayout)
+         where
+
+newFastSimpleHierarchyLayout :: () => IO FastSimpleHierarchyLayout
+newFastSimpleHierarchyLayout
+  = xformnull
+      c_fastsimplehierarchylayout_newfastsimplehierarchylayout
+
+fastSimpleHierarchyLayout_layerDistance ::
+                                          () => FastSimpleHierarchyLayout -> CDouble -> IO ()
+fastSimpleHierarchyLayout_layerDistance
+  = xform1
+      c_fastsimplehierarchylayout_fastsimplehierarchylayout_layerdistance
+
+fastSimpleHierarchyLayout_nodeDistance ::
+                                         () => FastSimpleHierarchyLayout -> CDouble -> IO ()
+fastSimpleHierarchyLayout_nodeDistance
+  = xform1
+      c_fastsimplehierarchylayout_fastsimplehierarchylayout_nodedistance
+
+fastSimpleHierarchyLayout_downward ::
+                                     () => FastSimpleHierarchyLayout -> CBool -> IO ()
+fastSimpleHierarchyLayout_downward
+  = xform1
+      c_fastsimplehierarchylayout_fastsimplehierarchylayout_downward
+
+fastSimpleHierarchyLayout_leftToRight ::
+                                        () => FastSimpleHierarchyLayout -> CBool -> IO ()
+fastSimpleHierarchyLayout_leftToRight
+  = xform1
+      c_fastsimplehierarchylayout_fastsimplehierarchylayout_lefttoright
+
+fastSimpleHierarchyLayout_balanced ::
+                                     () => FastSimpleHierarchyLayout -> CBool -> IO ()
+fastSimpleHierarchyLayout_balanced
+  = xform1
+      c_fastsimplehierarchylayout_fastsimplehierarchylayout_balanced
diff --git a/src/OGDF/FastSimpleHierarchyLayout/Interface.hs b/src/OGDF/FastSimpleHierarchyLayout/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/FastSimpleHierarchyLayout/Interface.hs
@@ -0,0 +1,32 @@
+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
+  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
+  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
+  TypeSynonymInstances #-}
+module OGDF.FastSimpleHierarchyLayout.Interface where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.FastSimpleHierarchyLayout.RawType
+import STD.Deletable.Interface
+import OGDF.HierarchyLayoutModule.Interface
+
+class (IDeletable a, IHierarchyLayoutModule a) =>
+      IFastSimpleHierarchyLayout a where
+
+upcastFastSimpleHierarchyLayout ::
+                                forall a . (FPtr a, IFastSimpleHierarchyLayout a) =>
+                                  a -> FastSimpleHierarchyLayout
+upcastFastSimpleHierarchyLayout h
+  = let fh = get_fptr h
+        fh2 :: Ptr RawFastSimpleHierarchyLayout = castPtr fh
+      in cast_fptr_to_obj fh2
+
+downcastFastSimpleHierarchyLayout ::
+                                  forall a . (FPtr a, IFastSimpleHierarchyLayout a) =>
+                                    FastSimpleHierarchyLayout -> a
+downcastFastSimpleHierarchyLayout h
+  = let fh = get_fptr h
+        fh2 = castPtr fh
+      in cast_fptr_to_obj fh2
diff --git a/src/OGDF/FastSimpleHierarchyLayout/RawType.hs b/src/OGDF/FastSimpleHierarchyLayout/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/FastSimpleHierarchyLayout/RawType.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.FastSimpleHierarchyLayout.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawFastSimpleHierarchyLayout
+
+newtype FastSimpleHierarchyLayout = FastSimpleHierarchyLayout (Ptr
+                                                                 RawFastSimpleHierarchyLayout)
+                                      deriving (Eq, Ord, Show)
+
+instance () => FPtr (FastSimpleHierarchyLayout) where
+        type Raw FastSimpleHierarchyLayout = RawFastSimpleHierarchyLayout
+        get_fptr (FastSimpleHierarchyLayout ptr) = ptr
+        cast_fptr_to_obj = FastSimpleHierarchyLayout
diff --git a/src/OGDF/Graph.hs b/src/OGDF/Graph.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/Graph.hs
@@ -0,0 +1,8 @@
+module OGDF.Graph
+       (Graph(..), IGraph, upcastGraph, downcastGraph, newGraph,
+        graph_newNode, newNode1, graph_newEdge, graph_firstNode,
+        graph_lastNode, graph_firstEdge, graph_lastEdge)
+       where
+import OGDF.Graph.RawType
+import OGDF.Graph.Interface
+import OGDF.Graph.Implementation
diff --git a/src/OGDF/Graph/Cast.hs b/src/OGDF/Graph/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/Graph/Cast.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.Graph.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.Graph.RawType
+import OGDF.Graph.Interface
+
+instance (IGraph a, FPtr a) => Castable (a) (Ptr RawGraph) where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
+
+instance () => Castable (Graph) (Ptr RawGraph) where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/Graph/FFI.hsc b/src/OGDF/Graph/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/Graph/FFI.hsc
@@ -0,0 +1,44 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.Graph.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.Graph.RawType
+import OGDF.Graph.RawType
+import OGDF.NodeElement.RawType
+import OGDF.EdgeElement.RawType
+
+foreign import ccall interruptible "OGDFGraph.h Graph_delete"
+               c_graph_delete :: Ptr RawGraph -> IO ()
+
+foreign import ccall interruptible "OGDFGraph.h Graph_newGraph"
+               c_graph_newgraph :: IO (Ptr RawGraph)
+
+foreign import ccall interruptible
+               "OGDFGraph.h Graph_graph_newNode" c_graph_graph_newnode ::
+               Ptr RawGraph -> IO (Ptr RawNodeElement)
+
+foreign import ccall interruptible "OGDFGraph.h Graph_newNode1"
+               c_graph_newnode1 :: Ptr RawGraph -> CInt -> IO (Ptr RawNodeElement)
+
+foreign import ccall interruptible
+               "OGDFGraph.h Graph_graph_newEdge" c_graph_graph_newedge ::
+               Ptr RawGraph ->
+                 Ptr RawNodeElement -> Ptr RawNodeElement -> IO (Ptr RawEdgeElement)
+
+foreign import ccall interruptible
+               "OGDFGraph.h Graph_graph_firstNode" c_graph_graph_firstnode ::
+               Ptr RawGraph -> IO (Ptr RawNodeElement)
+
+foreign import ccall interruptible
+               "OGDFGraph.h Graph_graph_lastNode" c_graph_graph_lastnode ::
+               Ptr RawGraph -> IO (Ptr RawNodeElement)
+
+foreign import ccall interruptible
+               "OGDFGraph.h Graph_graph_firstEdge" c_graph_graph_firstedge ::
+               Ptr RawGraph -> IO (Ptr RawEdgeElement)
+
+foreign import ccall interruptible
+               "OGDFGraph.h Graph_graph_lastEdge" c_graph_graph_lastedge ::
+               Ptr RawGraph -> IO (Ptr RawEdgeElement)
diff --git a/src/OGDF/Graph/Implementation.hs b/src/OGDF/Graph/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/Graph/Implementation.hs
@@ -0,0 +1,63 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.Graph.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.Graph.RawType
+import OGDF.Graph.FFI
+import OGDF.Graph.Interface
+import OGDF.Graph.Cast
+import OGDF.Graph.RawType
+import OGDF.Graph.Cast
+import OGDF.Graph.Interface
+import OGDF.NodeElement.RawType
+import OGDF.NodeElement.Cast
+import OGDF.NodeElement.Interface
+import OGDF.EdgeElement.RawType
+import OGDF.EdgeElement.Cast
+import OGDF.EdgeElement.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
+
+instance () => IGraph (Graph) where
+
+instance () => IDeletable (Graph) where
+        delete = xform0 c_graph_delete
+
+newGraph :: () => IO Graph
+newGraph = xformnull c_graph_newgraph
+
+graph_newNode :: () => Graph -> IO NodeElement
+graph_newNode = xform0 c_graph_graph_newnode
+
+newNode1 :: () => Graph -> CInt -> IO NodeElement
+newNode1 = xform1 c_graph_newnode1
+
+graph_newEdge ::
+                (INodeElement c1, FPtr c1, INodeElement c0, FPtr c0) =>
+                Graph -> c0 -> c1 -> IO EdgeElement
+graph_newEdge = xform2 c_graph_graph_newedge
+
+graph_firstNode :: () => Graph -> IO NodeElement
+graph_firstNode = xform0 c_graph_graph_firstnode
+
+graph_lastNode :: () => Graph -> IO NodeElement
+graph_lastNode = xform0 c_graph_graph_lastnode
+
+graph_firstEdge :: () => Graph -> IO EdgeElement
+graph_firstEdge = xform0 c_graph_graph_firstedge
+
+graph_lastEdge :: () => Graph -> IO EdgeElement
+graph_lastEdge = xform0 c_graph_graph_lastedge
diff --git a/src/OGDF/Graph/Interface.hs b/src/OGDF/Graph/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/Graph/Interface.hs
@@ -0,0 +1,26 @@
+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
+  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
+  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
+  TypeSynonymInstances #-}
+module OGDF.Graph.Interface where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.Graph.RawType
+import STD.Deletable.Interface
+
+class (IDeletable a) => IGraph a where
+
+upcastGraph :: forall a . (FPtr a, IGraph a) => a -> Graph
+upcastGraph h
+  = let fh = get_fptr h
+        fh2 :: Ptr RawGraph = castPtr fh
+      in cast_fptr_to_obj fh2
+
+downcastGraph :: forall a . (FPtr a, IGraph a) => Graph -> a
+downcastGraph h
+  = let fh = get_fptr h
+        fh2 = castPtr fh
+      in cast_fptr_to_obj fh2
diff --git a/src/OGDF/Graph/RawType.hs b/src/OGDF/Graph/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/Graph/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.Graph.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawGraph
+
+newtype Graph = Graph (Ptr RawGraph)
+                  deriving (Eq, Ord, Show)
+
+instance () => FPtr (Graph) where
+        type Raw Graph = RawGraph
+        get_fptr (Graph ptr) = ptr
+        cast_fptr_to_obj = Graph
diff --git a/src/OGDF/GraphAttributes.hs b/src/OGDF/GraphAttributes.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/GraphAttributes.hs
@@ -0,0 +1,12 @@
+module OGDF.GraphAttributes
+       (GraphAttributes(..), IGraphAttributes(..), upcastGraphAttributes,
+        downcastGraphAttributes, newGraphAttributes,
+        graphAttributes_fillColor, graphAttributes_fillBgColor,
+        graphAttributes_x, graphAttributes_y, graphAttributes_width,
+        graphAttributes_height, graphAttributes_bends,
+        graphAttributes_label, graphAttributeslabelE,
+        graphAttributes_xLabel, graphAttributes_yLabel)
+       where
+import OGDF.GraphAttributes.RawType
+import OGDF.GraphAttributes.Interface
+import OGDF.GraphAttributes.Implementation
diff --git a/src/OGDF/GraphAttributes/Cast.hs b/src/OGDF/GraphAttributes/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/GraphAttributes/Cast.hs
@@ -0,0 +1,20 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.GraphAttributes.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.GraphAttributes.RawType
+import OGDF.GraphAttributes.Interface
+
+instance (IGraphAttributes a, FPtr a) =>
+         Castable (a) (Ptr RawGraphAttributes)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
+
+instance () => Castable (GraphAttributes) (Ptr RawGraphAttributes)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/GraphAttributes/FFI.hsc b/src/OGDF/GraphAttributes/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/GraphAttributes/FFI.hsc
@@ -0,0 +1,88 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.GraphAttributes.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.GraphAttributes.RawType
+import OGDF.GraphAttributes.RawType
+import OGDF.Color.RawType
+import OGDF.List.Template
+import OGDF.DPoint.RawType
+import STD.CppString.RawType
+import OGDF.DRect.RawType
+import OGDF.Graph.RawType
+import OGDF.NodeElement.RawType
+import OGDF.EdgeElement.RawType
+
+foreign import ccall interruptible
+               "OGDFGraphAttributes.h GraphAttributes_delete"
+               c_graphattributes_delete :: Ptr RawGraphAttributes -> IO ()
+
+foreign import ccall interruptible
+               "OGDFGraphAttributes.h GraphAttributes_newGraphAttributes"
+               c_graphattributes_newgraphattributes ::
+               Ptr RawGraph -> CLong -> IO (Ptr RawGraphAttributes)
+
+foreign import ccall interruptible
+               "OGDFGraphAttributes.h GraphAttributes_graphAttributes_fillColor"
+               c_graphattributes_graphattributes_fillcolor ::
+               Ptr RawGraphAttributes -> Ptr RawNodeElement -> IO (Ptr RawColor)
+
+foreign import ccall interruptible
+               "OGDFGraphAttributes.h GraphAttributes_graphAttributes_fillBgColor"
+               c_graphattributes_graphattributes_fillbgcolor ::
+               Ptr RawGraphAttributes -> Ptr RawNodeElement -> IO (Ptr RawColor)
+
+foreign import ccall interruptible
+               "OGDFGraphAttributes.h GraphAttributes_graphAttributes_x"
+               c_graphattributes_graphattributes_x ::
+               Ptr RawGraphAttributes -> Ptr RawNodeElement -> IO (Ptr CDouble)
+
+foreign import ccall interruptible
+               "OGDFGraphAttributes.h GraphAttributes_graphAttributes_y"
+               c_graphattributes_graphattributes_y ::
+               Ptr RawGraphAttributes -> Ptr RawNodeElement -> IO (Ptr CDouble)
+
+foreign import ccall interruptible
+               "OGDFGraphAttributes.h GraphAttributes_graphAttributes_width"
+               c_graphattributes_graphattributes_width ::
+               Ptr RawGraphAttributes -> Ptr RawNodeElement -> IO (Ptr CDouble)
+
+foreign import ccall interruptible
+               "OGDFGraphAttributes.h GraphAttributes_graphAttributes_height"
+               c_graphattributes_graphattributes_height ::
+               Ptr RawGraphAttributes -> Ptr RawNodeElement -> IO (Ptr CDouble)
+
+foreign import ccall interruptible
+               "OGDFGraphAttributes.h GraphAttributes_graphAttributes_bends"
+               c_graphattributes_graphattributes_bends ::
+               Ptr RawGraphAttributes ->
+                 Ptr RawEdgeElement -> IO (Ptr (RawList DPoint))
+
+foreign import ccall interruptible
+               "OGDFGraphAttributes.h GraphAttributes_graphAttributes_label"
+               c_graphattributes_graphattributes_label ::
+               Ptr RawGraphAttributes ->
+                 Ptr RawNodeElement -> IO (Ptr RawCppString)
+
+foreign import ccall interruptible
+               "OGDFGraphAttributes.h GraphAttributes_graphAttributeslabelE"
+               c_graphattributes_graphattributeslabele ::
+               Ptr RawGraphAttributes ->
+                 Ptr RawEdgeElement -> IO (Ptr RawCppString)
+
+foreign import ccall interruptible
+               "OGDFGraphAttributes.h GraphAttributes_graphAttributes_xLabel"
+               c_graphattributes_graphattributes_xlabel ::
+               Ptr RawGraphAttributes -> Ptr RawNodeElement -> IO (Ptr CDouble)
+
+foreign import ccall interruptible
+               "OGDFGraphAttributes.h GraphAttributes_graphAttributes_yLabel"
+               c_graphattributes_graphattributes_ylabel ::
+               Ptr RawGraphAttributes -> Ptr RawNodeElement -> IO (Ptr CDouble)
+
+foreign import ccall interruptible
+               "OGDFGraphAttributes.h GraphAttributes_boundingBox"
+               c_graphattributes_boundingbox ::
+               Ptr RawGraphAttributes -> IO (Ptr RawDRect)
diff --git a/src/OGDF/GraphAttributes/Implementation.hs b/src/OGDF/GraphAttributes/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/GraphAttributes/Implementation.hs
@@ -0,0 +1,118 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.GraphAttributes.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.GraphAttributes.RawType
+import OGDF.GraphAttributes.FFI
+import OGDF.GraphAttributes.Interface
+import OGDF.GraphAttributes.Cast
+import OGDF.GraphAttributes.RawType
+import OGDF.GraphAttributes.Cast
+import OGDF.GraphAttributes.Interface
+import OGDF.Color.RawType
+import OGDF.Color.Cast
+import OGDF.Color.Interface
+import OGDF.List.Template
+import OGDF.DPoint.RawType
+import OGDF.DPoint.Cast
+import OGDF.DPoint.Interface
+import STD.CppString.RawType
+import STD.CppString.Cast
+import STD.CppString.Interface
+import OGDF.DRect.RawType
+import OGDF.DRect.Cast
+import OGDF.DRect.Interface
+import OGDF.Graph.RawType
+import OGDF.Graph.Cast
+import OGDF.Graph.Interface
+import OGDF.NodeElement.RawType
+import OGDF.NodeElement.Cast
+import OGDF.NodeElement.Interface
+import OGDF.EdgeElement.RawType
+import OGDF.EdgeElement.Cast
+import OGDF.EdgeElement.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
+
+instance () => IGraphAttributes (GraphAttributes) where
+        boundingBox = xform0 c_graphattributes_boundingbox
+
+instance () => IDeletable (GraphAttributes) where
+        delete = xform0 c_graphattributes_delete
+
+newGraphAttributes ::
+                     (IGraph c0, FPtr c0) => c0 -> CLong -> IO GraphAttributes
+newGraphAttributes = xform1 c_graphattributes_newgraphattributes
+
+graphAttributes_fillColor ::
+                            (INodeElement c0, FPtr c0) => GraphAttributes -> c0 -> IO Color
+graphAttributes_fillColor
+  = xform1 c_graphattributes_graphattributes_fillcolor
+
+graphAttributes_fillBgColor ::
+                              (INodeElement c0, FPtr c0) => GraphAttributes -> c0 -> IO Color
+graphAttributes_fillBgColor
+  = xform1 c_graphattributes_graphattributes_fillbgcolor
+
+graphAttributes_x ::
+                    (INodeElement c0, FPtr c0) =>
+                    GraphAttributes -> c0 -> IO (Ptr CDouble)
+graphAttributes_x = xform1 c_graphattributes_graphattributes_x
+
+graphAttributes_y ::
+                    (INodeElement c0, FPtr c0) =>
+                    GraphAttributes -> c0 -> IO (Ptr CDouble)
+graphAttributes_y = xform1 c_graphattributes_graphattributes_y
+
+graphAttributes_width ::
+                        (INodeElement c0, FPtr c0) =>
+                        GraphAttributes -> c0 -> IO (Ptr CDouble)
+graphAttributes_width
+  = xform1 c_graphattributes_graphattributes_width
+
+graphAttributes_height ::
+                         (INodeElement c0, FPtr c0) =>
+                         GraphAttributes -> c0 -> IO (Ptr CDouble)
+graphAttributes_height
+  = xform1 c_graphattributes_graphattributes_height
+
+graphAttributes_bends ::
+                        (IEdgeElement c0, FPtr c0) =>
+                        GraphAttributes -> c0 -> IO (List DPoint)
+graphAttributes_bends
+  = xform1 c_graphattributes_graphattributes_bends
+
+graphAttributes_label ::
+                        (INodeElement c0, FPtr c0) => GraphAttributes -> c0 -> IO CppString
+graphAttributes_label
+  = xform1 c_graphattributes_graphattributes_label
+
+graphAttributeslabelE ::
+                        (IEdgeElement c0, FPtr c0) => GraphAttributes -> c0 -> IO CppString
+graphAttributeslabelE
+  = xform1 c_graphattributes_graphattributeslabele
+
+graphAttributes_xLabel ::
+                         (INodeElement c0, FPtr c0) =>
+                         GraphAttributes -> c0 -> IO (Ptr CDouble)
+graphAttributes_xLabel
+  = xform1 c_graphattributes_graphattributes_xlabel
+
+graphAttributes_yLabel ::
+                         (INodeElement c0, FPtr c0) =>
+                         GraphAttributes -> c0 -> IO (Ptr CDouble)
+graphAttributes_yLabel
+  = xform1 c_graphattributes_graphattributes_ylabel
diff --git a/src/OGDF/GraphAttributes/Interface.hs b/src/OGDF/GraphAttributes/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/GraphAttributes/Interface.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
+  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
+  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
+  TypeSynonymInstances #-}
+module OGDF.GraphAttributes.Interface where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.GraphAttributes.RawType
+import OGDF.DRect.RawType
+import STD.Deletable.Interface
+
+class (IDeletable a) => IGraphAttributes a where
+        boundingBox :: () => a -> IO DRect
+
+upcastGraphAttributes ::
+                      forall a . (FPtr a, IGraphAttributes a) => a -> GraphAttributes
+upcastGraphAttributes h
+  = let fh = get_fptr h
+        fh2 :: Ptr RawGraphAttributes = castPtr fh
+      in cast_fptr_to_obj fh2
+
+downcastGraphAttributes ::
+                        forall a . (FPtr a, IGraphAttributes a) => GraphAttributes -> a
+downcastGraphAttributes h
+  = let fh = get_fptr h
+        fh2 = castPtr fh
+      in cast_fptr_to_obj fh2
diff --git a/src/OGDF/GraphAttributes/RawType.hs b/src/OGDF/GraphAttributes/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/GraphAttributes/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.GraphAttributes.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawGraphAttributes
+
+newtype GraphAttributes = GraphAttributes (Ptr RawGraphAttributes)
+                            deriving (Eq, Ord, Show)
+
+instance () => FPtr (GraphAttributes) where
+        type Raw GraphAttributes = RawGraphAttributes
+        get_fptr (GraphAttributes ptr) = ptr
+        cast_fptr_to_obj = GraphAttributes
diff --git a/src/OGDF/GraphIO.hs b/src/OGDF/GraphIO.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/GraphIO.hs
@@ -0,0 +1,7 @@
+module OGDF.GraphIO
+       (GraphIO(..), IGraphIO, upcastGraphIO, downcastGraphIO,
+        graphIO_read, graphIO_write, graphIO_drawSVG)
+       where
+import OGDF.GraphIO.RawType
+import OGDF.GraphIO.Interface
+import OGDF.GraphIO.Implementation
diff --git a/src/OGDF/GraphIO/Cast.hs b/src/OGDF/GraphIO/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/GraphIO/Cast.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.GraphIO.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.GraphIO.RawType
+import OGDF.GraphIO.Interface
+
+instance (IGraphIO a, FPtr a) => Castable (a) (Ptr RawGraphIO)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
+
+instance () => Castable (GraphIO) (Ptr RawGraphIO) where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/GraphIO/FFI.hsc b/src/OGDF/GraphIO/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/GraphIO/FFI.hsc
@@ -0,0 +1,27 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.GraphIO.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.GraphIO.RawType
+import OGDF.GraphIO.RawType
+import OGDF.GraphAttributes.RawType
+import OGDF.Graph.RawType
+import STD.CppString.RawType
+
+foreign import ccall interruptible "OGDFGraphIO.h GraphIO_delete"
+               c_graphio_delete :: Ptr RawGraphIO -> IO ()
+
+foreign import ccall interruptible
+               "OGDFGraphIO.h GraphIO_graphIO_read" c_graphio_graphio_read ::
+               Ptr RawGraphAttributes ->
+                 Ptr RawGraph -> Ptr RawCppString -> IO CBool
+
+foreign import ccall interruptible
+               "OGDFGraphIO.h GraphIO_graphIO_write" c_graphio_graphio_write ::
+               Ptr RawGraphAttributes -> Ptr RawCppString -> IO CBool
+
+foreign import ccall interruptible
+               "OGDFGraphIO.h GraphIO_graphIO_drawSVG" c_graphio_graphio_drawsvg
+               :: Ptr RawGraphAttributes -> Ptr RawCppString -> IO CBool
diff --git a/src/OGDF/GraphIO/Implementation.hs b/src/OGDF/GraphIO/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/GraphIO/Implementation.hs
@@ -0,0 +1,56 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.GraphIO.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.GraphIO.RawType
+import OGDF.GraphIO.FFI
+import OGDF.GraphIO.Interface
+import OGDF.GraphIO.Cast
+import OGDF.GraphIO.RawType
+import OGDF.GraphIO.Cast
+import OGDF.GraphIO.Interface
+import OGDF.GraphAttributes.RawType
+import OGDF.GraphAttributes.Cast
+import OGDF.GraphAttributes.Interface
+import OGDF.Graph.RawType
+import OGDF.Graph.Cast
+import OGDF.Graph.Interface
+import STD.CppString.RawType
+import STD.CppString.Cast
+import STD.CppString.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
+
+instance () => IGraphIO (GraphIO) where
+
+instance () => IDeletable (GraphIO) where
+        delete = xform0 c_graphio_delete
+
+graphIO_read ::
+               (ICppString c2, FPtr c2, IGraph c1, FPtr c1, IGraphAttributes c0,
+                FPtr c0) =>
+               c0 -> c1 -> c2 -> IO CBool
+graphIO_read = xform2 c_graphio_graphio_read
+
+graphIO_write ::
+                (ICppString c1, FPtr c1, IGraphAttributes c0, FPtr c0) =>
+                c0 -> c1 -> IO CBool
+graphIO_write = xform1 c_graphio_graphio_write
+
+graphIO_drawSVG ::
+                  (ICppString c1, FPtr c1, IGraphAttributes c0, FPtr c0) =>
+                  c0 -> c1 -> IO CBool
+graphIO_drawSVG = xform1 c_graphio_graphio_drawsvg
diff --git a/src/OGDF/GraphIO/Interface.hs b/src/OGDF/GraphIO/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/GraphIO/Interface.hs
@@ -0,0 +1,26 @@
+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
+  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
+  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
+  TypeSynonymInstances #-}
+module OGDF.GraphIO.Interface where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.GraphIO.RawType
+import STD.Deletable.Interface
+
+class (IDeletable a) => IGraphIO a where
+
+upcastGraphIO :: forall a . (FPtr a, IGraphIO a) => a -> GraphIO
+upcastGraphIO h
+  = let fh = get_fptr h
+        fh2 :: Ptr RawGraphIO = castPtr fh
+      in cast_fptr_to_obj fh2
+
+downcastGraphIO :: forall a . (FPtr a, IGraphIO a) => GraphIO -> a
+downcastGraphIO h
+  = let fh = get_fptr h
+        fh2 = castPtr fh
+      in cast_fptr_to_obj fh2
diff --git a/src/OGDF/GraphIO/RawType.hs b/src/OGDF/GraphIO/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/GraphIO/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.GraphIO.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawGraphIO
+
+newtype GraphIO = GraphIO (Ptr RawGraphIO)
+                    deriving (Eq, Ord, Show)
+
+instance () => FPtr (GraphIO) where
+        type Raw GraphIO = RawGraphIO
+        get_fptr (GraphIO ptr) = ptr
+        cast_fptr_to_obj = GraphIO
diff --git a/src/OGDF/HierarchyLayoutModule.hs b/src/OGDF/HierarchyLayoutModule.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/HierarchyLayoutModule.hs
@@ -0,0 +1,7 @@
+module OGDF.HierarchyLayoutModule
+       (HierarchyLayoutModule(..), IHierarchyLayoutModule,
+        upcastHierarchyLayoutModule, downcastHierarchyLayoutModule)
+       where
+import OGDF.HierarchyLayoutModule.RawType
+import OGDF.HierarchyLayoutModule.Interface
+import OGDF.HierarchyLayoutModule.Implementation
diff --git a/src/OGDF/HierarchyLayoutModule/Cast.hs b/src/OGDF/HierarchyLayoutModule/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/HierarchyLayoutModule/Cast.hs
@@ -0,0 +1,21 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.HierarchyLayoutModule.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.HierarchyLayoutModule.RawType
+import OGDF.HierarchyLayoutModule.Interface
+
+instance (IHierarchyLayoutModule a, FPtr a) =>
+         Castable (a) (Ptr RawHierarchyLayoutModule)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
+
+instance () =>
+         Castable (HierarchyLayoutModule) (Ptr RawHierarchyLayoutModule)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/HierarchyLayoutModule/FFI.hsc b/src/OGDF/HierarchyLayoutModule/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/HierarchyLayoutModule/FFI.hsc
@@ -0,0 +1,13 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.HierarchyLayoutModule.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.HierarchyLayoutModule.RawType
+import OGDF.HierarchyLayoutModule.RawType
+
+foreign import ccall interruptible
+               "OGDFHierarchyLayoutModule.h HierarchyLayoutModule_delete"
+               c_hierarchylayoutmodule_delete ::
+               Ptr RawHierarchyLayoutModule -> IO ()
diff --git a/src/OGDF/HierarchyLayoutModule/Implementation.hs b/src/OGDF/HierarchyLayoutModule/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/HierarchyLayoutModule/Implementation.hs
@@ -0,0 +1,31 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.HierarchyLayoutModule.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.HierarchyLayoutModule.RawType
+import OGDF.HierarchyLayoutModule.FFI
+import OGDF.HierarchyLayoutModule.Interface
+import OGDF.HierarchyLayoutModule.Cast
+import OGDF.HierarchyLayoutModule.RawType
+import OGDF.HierarchyLayoutModule.Cast
+import OGDF.HierarchyLayoutModule.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
+
+instance () => IHierarchyLayoutModule (HierarchyLayoutModule) where
+
+instance () => IDeletable (HierarchyLayoutModule) where
+        delete = xform0 c_hierarchylayoutmodule_delete
diff --git a/src/OGDF/HierarchyLayoutModule/Interface.hs b/src/OGDF/HierarchyLayoutModule/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/HierarchyLayoutModule/Interface.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
+  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
+  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
+  TypeSynonymInstances #-}
+module OGDF.HierarchyLayoutModule.Interface where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.HierarchyLayoutModule.RawType
+import STD.Deletable.Interface
+
+class (IDeletable a) => IHierarchyLayoutModule a where
+
+upcastHierarchyLayoutModule ::
+                            forall a . (FPtr a, IHierarchyLayoutModule a) =>
+                              a -> HierarchyLayoutModule
+upcastHierarchyLayoutModule h
+  = let fh = get_fptr h
+        fh2 :: Ptr RawHierarchyLayoutModule = castPtr fh
+      in cast_fptr_to_obj fh2
+
+downcastHierarchyLayoutModule ::
+                              forall a . (FPtr a, IHierarchyLayoutModule a) =>
+                                HierarchyLayoutModule -> a
+downcastHierarchyLayoutModule h
+  = let fh = get_fptr h
+        fh2 = castPtr fh
+      in cast_fptr_to_obj fh2
diff --git a/src/OGDF/HierarchyLayoutModule/RawType.hs b/src/OGDF/HierarchyLayoutModule/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/HierarchyLayoutModule/RawType.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.HierarchyLayoutModule.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawHierarchyLayoutModule
+
+newtype HierarchyLayoutModule = HierarchyLayoutModule (Ptr
+                                                         RawHierarchyLayoutModule)
+                                  deriving (Eq, Ord, Show)
+
+instance () => FPtr (HierarchyLayoutModule) where
+        type Raw HierarchyLayoutModule = RawHierarchyLayoutModule
+        get_fptr (HierarchyLayoutModule ptr) = ptr
+        cast_fptr_to_obj = HierarchyLayoutModule
diff --git a/src/OGDF/LayerByLayerSweep.hs b/src/OGDF/LayerByLayerSweep.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/LayerByLayerSweep.hs
@@ -0,0 +1,7 @@
+module OGDF.LayerByLayerSweep
+       (LayerByLayerSweep(..), ILayerByLayerSweep,
+        upcastLayerByLayerSweep, downcastLayerByLayerSweep)
+       where
+import OGDF.LayerByLayerSweep.RawType
+import OGDF.LayerByLayerSweep.Interface
+import OGDF.LayerByLayerSweep.Implementation
diff --git a/src/OGDF/LayerByLayerSweep/Cast.hs b/src/OGDF/LayerByLayerSweep/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/LayerByLayerSweep/Cast.hs
@@ -0,0 +1,21 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.LayerByLayerSweep.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.LayerByLayerSweep.RawType
+import OGDF.LayerByLayerSweep.Interface
+
+instance (ILayerByLayerSweep a, FPtr a) =>
+         Castable (a) (Ptr RawLayerByLayerSweep)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
+
+instance () =>
+         Castable (LayerByLayerSweep) (Ptr RawLayerByLayerSweep)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/LayerByLayerSweep/FFI.hsc b/src/OGDF/LayerByLayerSweep/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/LayerByLayerSweep/FFI.hsc
@@ -0,0 +1,12 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.LayerByLayerSweep.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.LayerByLayerSweep.RawType
+import OGDF.LayerByLayerSweep.RawType
+
+foreign import ccall interruptible
+               "OGDFLayerByLayerSweep.h LayerByLayerSweep_delete"
+               c_layerbylayersweep_delete :: Ptr RawLayerByLayerSweep -> IO ()
diff --git a/src/OGDF/LayerByLayerSweep/Implementation.hs b/src/OGDF/LayerByLayerSweep/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/LayerByLayerSweep/Implementation.hs
@@ -0,0 +1,36 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.LayerByLayerSweep.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.LayerByLayerSweep.RawType
+import OGDF.LayerByLayerSweep.FFI
+import OGDF.LayerByLayerSweep.Interface
+import OGDF.LayerByLayerSweep.Cast
+import OGDF.LayerByLayerSweep.RawType
+import OGDF.LayerByLayerSweep.Cast
+import OGDF.LayerByLayerSweep.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
+import OGDF.LayeredCrossMinModule.RawType
+import OGDF.LayeredCrossMinModule.Cast
+import OGDF.LayeredCrossMinModule.Interface
+
+instance () => ILayerByLayerSweep (LayerByLayerSweep) where
+
+instance () => IDeletable (LayerByLayerSweep) where
+        delete = xform0 c_layerbylayersweep_delete
+
+instance () => ILayeredCrossMinModule (LayerByLayerSweep) where
diff --git a/src/OGDF/LayerByLayerSweep/Interface.hs b/src/OGDF/LayerByLayerSweep/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/LayerByLayerSweep/Interface.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
+  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
+  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
+  TypeSynonymInstances #-}
+module OGDF.LayerByLayerSweep.Interface where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.LayerByLayerSweep.RawType
+import STD.Deletable.Interface
+import OGDF.LayeredCrossMinModule.Interface
+
+class (IDeletable a, ILayeredCrossMinModule a) =>
+      ILayerByLayerSweep a where
+
+upcastLayerByLayerSweep ::
+                        forall a . (FPtr a, ILayerByLayerSweep a) => a -> LayerByLayerSweep
+upcastLayerByLayerSweep h
+  = let fh = get_fptr h
+        fh2 :: Ptr RawLayerByLayerSweep = castPtr fh
+      in cast_fptr_to_obj fh2
+
+downcastLayerByLayerSweep ::
+                          forall a . (FPtr a, ILayerByLayerSweep a) => LayerByLayerSweep -> a
+downcastLayerByLayerSweep h
+  = let fh = get_fptr h
+        fh2 = castPtr fh
+      in cast_fptr_to_obj fh2
diff --git a/src/OGDF/LayerByLayerSweep/RawType.hs b/src/OGDF/LayerByLayerSweep/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/LayerByLayerSweep/RawType.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.LayerByLayerSweep.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawLayerByLayerSweep
+
+newtype LayerByLayerSweep = LayerByLayerSweep (Ptr
+                                                 RawLayerByLayerSweep)
+                              deriving (Eq, Ord, Show)
+
+instance () => FPtr (LayerByLayerSweep) where
+        type Raw LayerByLayerSweep = RawLayerByLayerSweep
+        get_fptr (LayerByLayerSweep ptr) = ptr
+        cast_fptr_to_obj = LayerByLayerSweep
diff --git a/src/OGDF/LayeredCrossMinModule.hs b/src/OGDF/LayeredCrossMinModule.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/LayeredCrossMinModule.hs
@@ -0,0 +1,7 @@
+module OGDF.LayeredCrossMinModule
+       (LayeredCrossMinModule(..), ILayeredCrossMinModule,
+        upcastLayeredCrossMinModule, downcastLayeredCrossMinModule)
+       where
+import OGDF.LayeredCrossMinModule.RawType
+import OGDF.LayeredCrossMinModule.Interface
+import OGDF.LayeredCrossMinModule.Implementation
diff --git a/src/OGDF/LayeredCrossMinModule/Cast.hs b/src/OGDF/LayeredCrossMinModule/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/LayeredCrossMinModule/Cast.hs
@@ -0,0 +1,21 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.LayeredCrossMinModule.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.LayeredCrossMinModule.RawType
+import OGDF.LayeredCrossMinModule.Interface
+
+instance (ILayeredCrossMinModule a, FPtr a) =>
+         Castable (a) (Ptr RawLayeredCrossMinModule)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
+
+instance () =>
+         Castable (LayeredCrossMinModule) (Ptr RawLayeredCrossMinModule)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/LayeredCrossMinModule/FFI.hsc b/src/OGDF/LayeredCrossMinModule/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/LayeredCrossMinModule/FFI.hsc
@@ -0,0 +1,13 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.LayeredCrossMinModule.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.LayeredCrossMinModule.RawType
+import OGDF.LayeredCrossMinModule.RawType
+
+foreign import ccall interruptible
+               "OGDFLayeredCrossMinModule.h LayeredCrossMinModule_delete"
+               c_layeredcrossminmodule_delete ::
+               Ptr RawLayeredCrossMinModule -> IO ()
diff --git a/src/OGDF/LayeredCrossMinModule/Implementation.hs b/src/OGDF/LayeredCrossMinModule/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/LayeredCrossMinModule/Implementation.hs
@@ -0,0 +1,31 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.LayeredCrossMinModule.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.LayeredCrossMinModule.RawType
+import OGDF.LayeredCrossMinModule.FFI
+import OGDF.LayeredCrossMinModule.Interface
+import OGDF.LayeredCrossMinModule.Cast
+import OGDF.LayeredCrossMinModule.RawType
+import OGDF.LayeredCrossMinModule.Cast
+import OGDF.LayeredCrossMinModule.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
+
+instance () => ILayeredCrossMinModule (LayeredCrossMinModule) where
+
+instance () => IDeletable (LayeredCrossMinModule) where
+        delete = xform0 c_layeredcrossminmodule_delete
diff --git a/src/OGDF/LayeredCrossMinModule/Interface.hs b/src/OGDF/LayeredCrossMinModule/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/LayeredCrossMinModule/Interface.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
+  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
+  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
+  TypeSynonymInstances #-}
+module OGDF.LayeredCrossMinModule.Interface where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.LayeredCrossMinModule.RawType
+import STD.Deletable.Interface
+
+class (IDeletable a) => ILayeredCrossMinModule a where
+
+upcastLayeredCrossMinModule ::
+                            forall a . (FPtr a, ILayeredCrossMinModule a) =>
+                              a -> LayeredCrossMinModule
+upcastLayeredCrossMinModule h
+  = let fh = get_fptr h
+        fh2 :: Ptr RawLayeredCrossMinModule = castPtr fh
+      in cast_fptr_to_obj fh2
+
+downcastLayeredCrossMinModule ::
+                              forall a . (FPtr a, ILayeredCrossMinModule a) =>
+                                LayeredCrossMinModule -> a
+downcastLayeredCrossMinModule h
+  = let fh = get_fptr h
+        fh2 = castPtr fh
+      in cast_fptr_to_obj fh2
diff --git a/src/OGDF/LayeredCrossMinModule/RawType.hs b/src/OGDF/LayeredCrossMinModule/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/LayeredCrossMinModule/RawType.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.LayeredCrossMinModule.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawLayeredCrossMinModule
+
+newtype LayeredCrossMinModule = LayeredCrossMinModule (Ptr
+                                                         RawLayeredCrossMinModule)
+                                  deriving (Eq, Ord, Show)
+
+instance () => FPtr (LayeredCrossMinModule) where
+        type Raw LayeredCrossMinModule = RawLayeredCrossMinModule
+        get_fptr (LayeredCrossMinModule ptr) = ptr
+        cast_fptr_to_obj = LayeredCrossMinModule
diff --git a/src/OGDF/LayoutModule.hs b/src/OGDF/LayoutModule.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/LayoutModule.hs
@@ -0,0 +1,4 @@
+module OGDF.LayoutModule (ILayoutModule(..)) where
+import OGDF.LayoutModule.RawType
+import OGDF.LayoutModule.Interface
+import OGDF.LayoutModule.Implementation
diff --git a/src/OGDF/LayoutModule/Cast.hs b/src/OGDF/LayoutModule/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/LayoutModule/Cast.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.LayoutModule.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.LayoutModule.RawType
+import OGDF.LayoutModule.Interface
diff --git a/src/OGDF/LayoutModule/FFI.hsc b/src/OGDF/LayoutModule/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/LayoutModule/FFI.hsc
@@ -0,0 +1,9 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.LayoutModule.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.LayoutModule.RawType
+import OGDF.LayoutModule.RawType
+import OGDF.GraphAttributes.RawType
diff --git a/src/OGDF/LayoutModule/Implementation.hs b/src/OGDF/LayoutModule/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/LayoutModule/Implementation.hs
@@ -0,0 +1,29 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.LayoutModule.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.LayoutModule.RawType
+import OGDF.LayoutModule.FFI
+import OGDF.LayoutModule.Interface
+import OGDF.LayoutModule.Cast
+import OGDF.LayoutModule.RawType
+import OGDF.LayoutModule.Cast
+import OGDF.LayoutModule.Interface
+import OGDF.GraphAttributes.RawType
+import OGDF.GraphAttributes.Cast
+import OGDF.GraphAttributes.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
diff --git a/src/OGDF/LayoutModule/Interface.hs b/src/OGDF/LayoutModule/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/LayoutModule/Interface.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
+  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
+  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
+  TypeSynonymInstances #-}
+module OGDF.LayoutModule.Interface where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.LayoutModule.RawType
+import STD.Deletable.Interface
+import OGDF.GraphAttributes.Interface
+
+class (IDeletable a) => ILayoutModule a where
+        call :: (IGraphAttributes c0, FPtr c0) => a -> c0 -> IO ()
diff --git a/src/OGDF/LayoutModule/RawType.hs b/src/OGDF/LayoutModule/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/LayoutModule/RawType.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.LayoutModule.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
diff --git a/src/OGDF/List/TH.hs b/src/OGDF/List/TH.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/List/TH.hs
@@ -0,0 +1,65 @@
+{-# LANGUAGE TemplateHaskell #-}
+module OGDF.List.TH where
+import Data.Char
+import Data.List
+import Data.Monoid
+import Foreign.C.Types
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.List.Template
+import OGDF.ListIterator.Template
+
+t_begin :: Type -> String -> Q Exp
+t_begin typ1 suffix
+  = mkTFunc (typ1, suffix, \ n -> "List_begin" <> n, tyf)
+  where tyf _
+          = let tp1 = pure typ1 in
+              [t| List $( tp1 ) -> IO (ListIterator $( tp1 )) |]
+
+t_end :: Type -> String -> Q Exp
+t_end typ1 suffix
+  = mkTFunc (typ1, suffix, \ n -> "List_end" <> n, tyf)
+  where tyf _
+          = let tp1 = pure typ1 in
+              [t| List $( tp1 ) -> IO (ListIterator $( tp1 )) |]
+
+t_pushBack :: Type -> String -> Q Exp
+t_pushBack typ1 suffix
+  = mkTFunc (typ1, suffix, \ n -> "List_pushBack" <> n, tyf)
+  where tyf _
+          = let tp1 = pure typ1 in
+              [t| List $( tp1 ) -> $( tp1 ) -> IO (ListIterator $( tp1 )) |]
+
+genListInstanceFor ::
+                   IsCPrimitive -> (Q Type, TemplateParamInfo) -> Q [Dec]
+genListInstanceFor isCprim (qtyp1, param1)
+  = do let params = map tpinfoSuffix [param1]
+       let suffix = concatMap (\ x -> "_" ++ tpinfoSuffix x) [param1]
+       callmod_ <- fmap loc_module location
+       let callmod = dot2_ callmod_
+       typ1 <- qtyp1
+       f1 <- mkMember "begin" t_begin typ1 suffix
+       f2 <- mkMember "end" t_end typ1 suffix
+       f3 <- mkMember "pushBack" t_pushBack typ1 suffix
+       addModFinalizer
+         (addForeignSource LangCxx
+            ("\n#include \"MacroPatternMatch.h\"\n\n\n#include \"ogdf/basic/List.h\"\n\n\n#define List_begin(callmod, tp1) \\\nextern \"C\" {\\\nvoid* List_begin_##tp1 ( void* p );}\\\ninline void* List_begin_##tp1 ( void* p ) {\\\nListIterator<tp1>* r=new ListIterator<tp1>((static_cast<ogdf::List<tp1>*>(p))->begin());return static_cast<void*>(r);\\\n}\\\nauto a_##callmod##_List_begin_##tp1=List_begin_##tp1;\n\n\n#define List_end(callmod, tp1) \\\nextern \"C\" {\\\nvoid* List_end_##tp1 ( void* p );}\\\ninline void* List_end_##tp1 ( void* p ) {\\\nListIterator<tp1>* r=new ListIterator<tp1>((static_cast<ogdf::List<tp1>*>(p))->end());return static_cast<void*>(r);\\\n}\\\nauto a_##callmod##_List_end_##tp1=List_end_##tp1;\n\n\n#define List_pushBack(callmod, tp1) \\\nextern \"C\" {\\\nvoid* List_pushBack_##tp1 ( void* p, tp1##_p x );}\\\ninline void* List_pushBack_##tp1 ( void* p, tp1##_p x ) {\\\nListIterator<tp1>* r=new ListIterator<tp1>((static_cast<ogdf::List<tp1>*>(p))->pushBack(*(from_nonconst_to_nonconst<tp1, tp1##_t>(x))));return static_cast<void*>(r);\\\n}\\\nauto a_##callmod##_List_pushBack_##tp1=List_pushBack_##tp1;\n\n\n#define List_begin_s(callmod, tp1) \\\nextern \"C\" {\\\nvoid* List_begin_##tp1 ( void* p );}\\\ninline void* List_begin_##tp1 ( void* p ) {\\\nListIterator<tp1>* r=new ListIterator<tp1>((static_cast<ogdf::List<tp1>*>(p))->begin());return static_cast<void*>(r);\\\n}\\\nauto a_##callmod##_List_begin_##tp1=List_begin_##tp1;\n\n\n#define List_end_s(callmod, tp1) \\\nextern \"C\" {\\\nvoid* List_end_##tp1 ( void* p );}\\\ninline void* List_end_##tp1 ( void* p ) {\\\nListIterator<tp1>* r=new ListIterator<tp1>((static_cast<ogdf::List<tp1>*>(p))->end());return static_cast<void*>(r);\\\n}\\\nauto a_##callmod##_List_end_##tp1=List_end_##tp1;\n\n\n#define List_pushBack_s(callmod, tp1) \\\nextern \"C\" {\\\nvoid* List_pushBack_##tp1 ( void* p, tp1 x );}\\\ninline void* List_pushBack_##tp1 ( void* p, tp1 x ) {\\\nListIterator<tp1>* r=new ListIterator<tp1>((static_cast<ogdf::List<tp1>*>(p))->pushBack(x));return static_cast<void*>(r);\\\n}\\\nauto a_##callmod##_List_pushBack_##tp1=List_pushBack_##tp1;\n\n\n#define List_instance(callmod, tp1) \\\nList_begin(callmod, tp1)\\\nList_end(callmod, tp1)\\\nList_pushBack(callmod, tp1)\n\n\n#define List_instance_s(callmod, tp1) \\\nList_begin_s(callmod, tp1)\\\nList_end_s(callmod, tp1)\\\nList_pushBack_s(callmod, tp1)\n\n"
+               ++
+               let headers = concatMap tpinfoCxxHeaders [param1]
+                   f x = renderCMacro (Include x)
+                 in concatMap f headers
+                 ++
+                 let nss = concatMap tpinfoCxxNamespaces [param1]
+                     f x = renderCStmt (UsingNamespace x)
+                   in concatMap f nss
+                   ++
+                   "List_instance" ++
+                     (case isCprim of
+                          CPrim -> "_s"
+                          NonCPrim -> "")
+                       ++ "(" ++ intercalate ", " (callmod : params) ++ ")\n"))
+       let lst = [f1, f2, f3]
+       pure [mkInstance [] (AppT (con "IList") typ1) lst]
diff --git a/src/OGDF/List/Template.hs b/src/OGDF/List/Template.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/List/Template.hs
@@ -0,0 +1,27 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleInstances,
+  MultiParamTypeClasses, TypeFamilies #-}
+module OGDF.List.Template where
+import Foreign.C.Types
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.ListIterator.Template
+
+data RawList tp1
+
+newtype List tp1 = List (Ptr (RawList tp1))
+
+class () => IList tp1 where
+        begin :: List tp1 -> IO (ListIterator tp1)
+        
+        end :: List tp1 -> IO (ListIterator tp1)
+        
+        pushBack :: List tp1 -> tp1 -> IO (ListIterator tp1)
+
+instance () => FPtr (List tp1) where
+        type Raw (List tp1) = RawList tp1
+        get_fptr (List ptr) = ptr
+        cast_fptr_to_obj = List
+
+instance () => Castable (List tp1) (Ptr (RawList tp1)) where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/ListIterator/TH.hs b/src/OGDF/ListIterator/TH.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/ListIterator/TH.hs
@@ -0,0 +1,73 @@
+{-# LANGUAGE TemplateHaskell #-}
+module OGDF.ListIterator.TH where
+import Data.Char
+import Data.List
+import Data.Monoid
+import Foreign.C.Types
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.ListIterator.Template
+
+t_deRef :: Type -> String -> Q Exp
+t_deRef typ1 suffix
+  = mkTFunc (typ1, suffix, \ n -> "ListIterator_deRef" <> n, tyf)
+  where tyf _
+          = let tp1 = pure typ1 in
+              [t| ListIterator $( tp1 ) -> IO $( tp1 ) |]
+
+t_listIteratorPred :: Type -> String -> Q Exp
+t_listIteratorPred typ1 suffix
+  = mkTFunc
+      (typ1, suffix, \ n -> "ListIterator_listIteratorPred" <> n, tyf)
+  where tyf _
+          = let tp1 = pure typ1 in
+              [t| ListIterator $( tp1 ) -> IO (ListIterator $( tp1 )) |]
+
+t_listIteratorSucc :: Type -> String -> Q Exp
+t_listIteratorSucc typ1 suffix
+  = mkTFunc
+      (typ1, suffix, \ n -> "ListIterator_listIteratorSucc" <> n, tyf)
+  where tyf _
+          = let tp1 = pure typ1 in
+              [t| ListIterator $( tp1 ) -> IO (ListIterator $( tp1 )) |]
+
+t_valid :: Type -> String -> Q Exp
+t_valid typ1 suffix
+  = mkTFunc (typ1, suffix, \ n -> "ListIterator_valid" <> n, tyf)
+  where tyf _
+          = let tp1 = pure typ1 in [t| ListIterator $( tp1 ) -> IO CBool |]
+
+genListIteratorInstanceFor ::
+                           IsCPrimitive -> (Q Type, TemplateParamInfo) -> Q [Dec]
+genListIteratorInstanceFor isCprim (qtyp1, param1)
+  = do let params = map tpinfoSuffix [param1]
+       let suffix = concatMap (\ x -> "_" ++ tpinfoSuffix x) [param1]
+       callmod_ <- fmap loc_module location
+       let callmod = dot2_ callmod_
+       typ1 <- qtyp1
+       f1 <- mkMember "deRef" t_deRef typ1 suffix
+       f2 <- mkMember "listIteratorPred" t_listIteratorPred typ1 suffix
+       f3 <- mkMember "listIteratorSucc" t_listIteratorSucc typ1 suffix
+       f4 <- mkMember "valid" t_valid typ1 suffix
+       addModFinalizer
+         (addForeignSource LangCxx
+            ("\n#include \"MacroPatternMatch.h\"\n\n\n#include \"ogdf/basic/List.h\"\n\n\n#define ListIterator_deRef(callmod, tp1) \\\nextern \"C\" {\\\ntp1##_p ListIterator_deRef_##tp1 ( void* p );}\\\ninline tp1##_p ListIterator_deRef_##tp1 ( void* p ) {\\\nreturn from_nonconst_to_nonconst<tp1##_t, tp1>((tp1*)&((static_cast<ListIterator<tp1>*>(p))->operator*()));\\\n}\\\nauto a_##callmod##_ListIterator_deRef_##tp1=ListIterator_deRef_##tp1;\n\n\n#define ListIterator_listIteratorPred(callmod, tp1) \\\nextern \"C\" {\\\nvoid* ListIterator_listIteratorPred_##tp1 ( void* p );}\\\ninline void* ListIterator_listIteratorPred_##tp1 ( void* p ) {\\\nListIterator<tp1>* r=new ListIterator<tp1>((static_cast<ListIterator<tp1>*>(p))->pred());return static_cast<void*>(r);\\\n}\\\nauto a_##callmod##_ListIterator_listIteratorPred_##tp1=ListIterator_listIteratorPred_##tp1;\n\n\n#define ListIterator_listIteratorSucc(callmod, tp1) \\\nextern \"C\" {\\\nvoid* ListIterator_listIteratorSucc_##tp1 ( void* p );}\\\ninline void* ListIterator_listIteratorSucc_##tp1 ( void* p ) {\\\nListIterator<tp1>* r=new ListIterator<tp1>((static_cast<ListIterator<tp1>*>(p))->succ());return static_cast<void*>(r);\\\n}\\\nauto a_##callmod##_ListIterator_listIteratorSucc_##tp1=ListIterator_listIteratorSucc_##tp1;\n\n\n#define ListIterator_valid(callmod, tp1) \\\nextern \"C\" {\\\nbool ListIterator_valid_##tp1 ( void* p );}\\\ninline bool ListIterator_valid_##tp1 ( void* p ) {\\\nreturn (static_cast<ListIterator<tp1>*>(p))->valid();\\\n}\\\nauto a_##callmod##_ListIterator_valid_##tp1=ListIterator_valid_##tp1;\n\n\n#define ListIterator_deRef_s(callmod, tp1) \\\nextern \"C\" {\\\ntp1 ListIterator_deRef_##tp1 ( void* p );}\\\ninline tp1 ListIterator_deRef_##tp1 ( void* p ) {\\\nreturn (static_cast<ListIterator<tp1>*>(p))->operator*();\\\n}\\\nauto a_##callmod##_ListIterator_deRef_##tp1=ListIterator_deRef_##tp1;\n\n\n#define ListIterator_listIteratorPred_s(callmod, tp1) \\\nextern \"C\" {\\\nvoid* ListIterator_listIteratorPred_##tp1 ( void* p );}\\\ninline void* ListIterator_listIteratorPred_##tp1 ( void* p ) {\\\nListIterator<tp1>* r=new ListIterator<tp1>((static_cast<ListIterator<tp1>*>(p))->pred());return static_cast<void*>(r);\\\n}\\\nauto a_##callmod##_ListIterator_listIteratorPred_##tp1=ListIterator_listIteratorPred_##tp1;\n\n\n#define ListIterator_listIteratorSucc_s(callmod, tp1) \\\nextern \"C\" {\\\nvoid* ListIterator_listIteratorSucc_##tp1 ( void* p );}\\\ninline void* ListIterator_listIteratorSucc_##tp1 ( void* p ) {\\\nListIterator<tp1>* r=new ListIterator<tp1>((static_cast<ListIterator<tp1>*>(p))->succ());return static_cast<void*>(r);\\\n}\\\nauto a_##callmod##_ListIterator_listIteratorSucc_##tp1=ListIterator_listIteratorSucc_##tp1;\n\n\n#define ListIterator_valid_s(callmod, tp1) \\\nextern \"C\" {\\\nbool ListIterator_valid_##tp1 ( void* p );}\\\ninline bool ListIterator_valid_##tp1 ( void* p ) {\\\nreturn (static_cast<ListIterator<tp1>*>(p))->valid();\\\n}\\\nauto a_##callmod##_ListIterator_valid_##tp1=ListIterator_valid_##tp1;\n\n\n#define ListIterator_instance(callmod, tp1) \\\nListIterator_deRef(callmod, tp1)\\\nListIterator_listIteratorPred(callmod, tp1)\\\nListIterator_listIteratorSucc(callmod, tp1)\\\nListIterator_valid(callmod, tp1)\n\n\n#define ListIterator_instance_s(callmod, tp1) \\\nListIterator_deRef_s(callmod, tp1)\\\nListIterator_listIteratorPred_s(callmod, tp1)\\\nListIterator_listIteratorSucc_s(callmod, tp1)\\\nListIterator_valid_s(callmod, tp1)\n\n"
+               ++
+               let headers = concatMap tpinfoCxxHeaders [param1]
+                   f x = renderCMacro (Include x)
+                 in concatMap f headers
+                 ++
+                 let nss = concatMap tpinfoCxxNamespaces [param1]
+                     f x = renderCStmt (UsingNamespace x)
+                   in concatMap f nss
+                   ++
+                   "ListIterator_instance" ++
+                     (case isCprim of
+                          CPrim -> "_s"
+                          NonCPrim -> "")
+                       ++ "(" ++ intercalate ", " (callmod : params) ++ ")\n"))
+       let lst = [f1, f2, f3, f4]
+       pure [mkInstance [] (AppT (con "IListIterator") typ1) lst]
diff --git a/src/OGDF/ListIterator/Template.hs b/src/OGDF/ListIterator/Template.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/ListIterator/Template.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleInstances,
+  MultiParamTypeClasses, TypeFamilies #-}
+module OGDF.ListIterator.Template where
+import Foreign.C.Types
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawListIterator tp1
+
+newtype ListIterator tp1 = ListIterator (Ptr (RawListIterator tp1))
+
+class () => IListIterator tp1 where
+        deRef :: ListIterator tp1 -> IO tp1
+        
+        listIteratorPred :: ListIterator tp1 -> IO (ListIterator tp1)
+        
+        listIteratorSucc :: ListIterator tp1 -> IO (ListIterator tp1)
+        
+        valid :: ListIterator tp1 -> IO CBool
+
+instance () => FPtr (ListIterator tp1) where
+        type Raw (ListIterator tp1) = RawListIterator tp1
+        get_fptr (ListIterator ptr) = ptr
+        cast_fptr_to_obj = ListIterator
+
+instance () =>
+         Castable (ListIterator tp1) (Ptr (RawListIterator tp1))
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/MedianHeuristic.hs b/src/OGDF/MedianHeuristic.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/MedianHeuristic.hs
@@ -0,0 +1,7 @@
+module OGDF.MedianHeuristic
+       (MedianHeuristic(..), IMedianHeuristic, upcastMedianHeuristic,
+        downcastMedianHeuristic, newMedianHeuristic)
+       where
+import OGDF.MedianHeuristic.RawType
+import OGDF.MedianHeuristic.Interface
+import OGDF.MedianHeuristic.Implementation
diff --git a/src/OGDF/MedianHeuristic/Cast.hs b/src/OGDF/MedianHeuristic/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/MedianHeuristic/Cast.hs
@@ -0,0 +1,20 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.MedianHeuristic.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.MedianHeuristic.RawType
+import OGDF.MedianHeuristic.Interface
+
+instance (IMedianHeuristic a, FPtr a) =>
+         Castable (a) (Ptr RawMedianHeuristic)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
+
+instance () => Castable (MedianHeuristic) (Ptr RawMedianHeuristic)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/MedianHeuristic/FFI.hsc b/src/OGDF/MedianHeuristic/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/MedianHeuristic/FFI.hsc
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.MedianHeuristic.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.MedianHeuristic.RawType
+import OGDF.MedianHeuristic.RawType
+
+foreign import ccall interruptible
+               "OGDFMedianHeuristic.h MedianHeuristic_delete"
+               c_medianheuristic_delete :: Ptr RawMedianHeuristic -> IO ()
+
+foreign import ccall interruptible
+               "OGDFMedianHeuristic.h MedianHeuristic_newMedianHeuristic"
+               c_medianheuristic_newmedianheuristic :: IO (Ptr RawMedianHeuristic)
diff --git a/src/OGDF/MedianHeuristic/Implementation.hs b/src/OGDF/MedianHeuristic/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/MedianHeuristic/Implementation.hs
@@ -0,0 +1,44 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.MedianHeuristic.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.MedianHeuristic.RawType
+import OGDF.MedianHeuristic.FFI
+import OGDF.MedianHeuristic.Interface
+import OGDF.MedianHeuristic.Cast
+import OGDF.MedianHeuristic.RawType
+import OGDF.MedianHeuristic.Cast
+import OGDF.MedianHeuristic.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
+import OGDF.LayerByLayerSweep.RawType
+import OGDF.LayerByLayerSweep.Cast
+import OGDF.LayerByLayerSweep.Interface
+import OGDF.LayeredCrossMinModule.RawType
+import OGDF.LayeredCrossMinModule.Cast
+import OGDF.LayeredCrossMinModule.Interface
+
+instance () => IMedianHeuristic (MedianHeuristic) where
+
+instance () => IDeletable (MedianHeuristic) where
+        delete = xform0 c_medianheuristic_delete
+
+instance () => ILayerByLayerSweep (MedianHeuristic) where
+
+instance () => ILayeredCrossMinModule (MedianHeuristic) where
+
+newMedianHeuristic :: () => IO MedianHeuristic
+newMedianHeuristic = xformnull c_medianheuristic_newmedianheuristic
diff --git a/src/OGDF/MedianHeuristic/Interface.hs b/src/OGDF/MedianHeuristic/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/MedianHeuristic/Interface.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
+  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
+  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
+  TypeSynonymInstances #-}
+module OGDF.MedianHeuristic.Interface where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.MedianHeuristic.RawType
+import STD.Deletable.Interface
+import OGDF.LayerByLayerSweep.Interface
+
+class (IDeletable a, ILayerByLayerSweep a) => IMedianHeuristic a
+      where
+
+upcastMedianHeuristic ::
+                      forall a . (FPtr a, IMedianHeuristic a) => a -> MedianHeuristic
+upcastMedianHeuristic h
+  = let fh = get_fptr h
+        fh2 :: Ptr RawMedianHeuristic = castPtr fh
+      in cast_fptr_to_obj fh2
+
+downcastMedianHeuristic ::
+                        forall a . (FPtr a, IMedianHeuristic a) => MedianHeuristic -> a
+downcastMedianHeuristic h
+  = let fh = get_fptr h
+        fh2 = castPtr fh
+      in cast_fptr_to_obj fh2
diff --git a/src/OGDF/MedianHeuristic/RawType.hs b/src/OGDF/MedianHeuristic/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/MedianHeuristic/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.MedianHeuristic.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawMedianHeuristic
+
+newtype MedianHeuristic = MedianHeuristic (Ptr RawMedianHeuristic)
+                            deriving (Eq, Ord, Show)
+
+instance () => FPtr (MedianHeuristic) where
+        type Raw MedianHeuristic = RawMedianHeuristic
+        get_fptr (MedianHeuristic ptr) = ptr
+        cast_fptr_to_obj = MedianHeuristic
diff --git a/src/OGDF/NodeElement.hs b/src/OGDF/NodeElement.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/NodeElement.hs
@@ -0,0 +1,9 @@
+module OGDF.NodeElement
+       (NodeElement(..), INodeElement, upcastNodeElement,
+        downcastNodeElement, nodeElement_index, nodeElement_indeg,
+        nodeElement_outdeg, nodeElement_degree, nodeElement_succ,
+        nodeElement_pred)
+       where
+import OGDF.NodeElement.RawType
+import OGDF.NodeElement.Interface
+import OGDF.NodeElement.Implementation
diff --git a/src/OGDF/NodeElement/Cast.hs b/src/OGDF/NodeElement/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/NodeElement/Cast.hs
@@ -0,0 +1,19 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.NodeElement.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.NodeElement.RawType
+import OGDF.NodeElement.Interface
+
+instance (INodeElement a, FPtr a) =>
+         Castable (a) (Ptr RawNodeElement)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
+
+instance () => Castable (NodeElement) (Ptr RawNodeElement) where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/NodeElement/FFI.hsc b/src/OGDF/NodeElement/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/NodeElement/FFI.hsc
@@ -0,0 +1,38 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.NodeElement.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.NodeElement.RawType
+import OGDF.NodeElement.RawType
+
+foreign import ccall interruptible
+               "OGDFNodeElement.h NodeElement_delete" c_nodeelement_delete ::
+               Ptr RawNodeElement -> IO ()
+
+foreign import ccall interruptible
+               "OGDFNodeElement.h NodeElement_nodeElement_index"
+               c_nodeelement_nodeelement_index :: Ptr RawNodeElement -> IO CInt
+
+foreign import ccall interruptible
+               "OGDFNodeElement.h NodeElement_nodeElement_indeg"
+               c_nodeelement_nodeelement_indeg :: Ptr RawNodeElement -> IO CInt
+
+foreign import ccall interruptible
+               "OGDFNodeElement.h NodeElement_nodeElement_outdeg"
+               c_nodeelement_nodeelement_outdeg :: Ptr RawNodeElement -> IO CInt
+
+foreign import ccall interruptible
+               "OGDFNodeElement.h NodeElement_nodeElement_degree"
+               c_nodeelement_nodeelement_degree :: Ptr RawNodeElement -> IO CInt
+
+foreign import ccall interruptible
+               "OGDFNodeElement.h NodeElement_nodeElement_succ"
+               c_nodeelement_nodeelement_succ ::
+               Ptr RawNodeElement -> IO (Ptr RawNodeElement)
+
+foreign import ccall interruptible
+               "OGDFNodeElement.h NodeElement_nodeElement_pred"
+               c_nodeelement_nodeelement_pred ::
+               Ptr RawNodeElement -> IO (Ptr RawNodeElement)
diff --git a/src/OGDF/NodeElement/Implementation.hs b/src/OGDF/NodeElement/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/NodeElement/Implementation.hs
@@ -0,0 +1,49 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.NodeElement.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.NodeElement.RawType
+import OGDF.NodeElement.FFI
+import OGDF.NodeElement.Interface
+import OGDF.NodeElement.Cast
+import OGDF.NodeElement.RawType
+import OGDF.NodeElement.Cast
+import OGDF.NodeElement.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
+
+instance () => INodeElement (NodeElement) where
+
+instance () => IDeletable (NodeElement) where
+        delete = xform0 c_nodeelement_delete
+
+nodeElement_index :: () => NodeElement -> IO CInt
+nodeElement_index = xform0 c_nodeelement_nodeelement_index
+
+nodeElement_indeg :: () => NodeElement -> IO CInt
+nodeElement_indeg = xform0 c_nodeelement_nodeelement_indeg
+
+nodeElement_outdeg :: () => NodeElement -> IO CInt
+nodeElement_outdeg = xform0 c_nodeelement_nodeelement_outdeg
+
+nodeElement_degree :: () => NodeElement -> IO CInt
+nodeElement_degree = xform0 c_nodeelement_nodeelement_degree
+
+nodeElement_succ :: () => NodeElement -> IO NodeElement
+nodeElement_succ = xform0 c_nodeelement_nodeelement_succ
+
+nodeElement_pred :: () => NodeElement -> IO NodeElement
+nodeElement_pred = xform0 c_nodeelement_nodeelement_pred
diff --git a/src/OGDF/NodeElement/Interface.hs b/src/OGDF/NodeElement/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/NodeElement/Interface.hs
@@ -0,0 +1,28 @@
+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
+  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
+  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
+  TypeSynonymInstances #-}
+module OGDF.NodeElement.Interface where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.NodeElement.RawType
+import STD.Deletable.Interface
+
+class (IDeletable a) => INodeElement a where
+
+upcastNodeElement ::
+                  forall a . (FPtr a, INodeElement a) => a -> NodeElement
+upcastNodeElement h
+  = let fh = get_fptr h
+        fh2 :: Ptr RawNodeElement = castPtr fh
+      in cast_fptr_to_obj fh2
+
+downcastNodeElement ::
+                    forall a . (FPtr a, INodeElement a) => NodeElement -> a
+downcastNodeElement h
+  = let fh = get_fptr h
+        fh2 = castPtr fh
+      in cast_fptr_to_obj fh2
diff --git a/src/OGDF/NodeElement/RawType.hs b/src/OGDF/NodeElement/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/NodeElement/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.NodeElement.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawNodeElement
+
+newtype NodeElement = NodeElement (Ptr RawNodeElement)
+                        deriving (Eq, Ord, Show)
+
+instance () => FPtr (NodeElement) where
+        type Raw NodeElement = RawNodeElement
+        get_fptr (NodeElement ptr) = ptr
+        cast_fptr_to_obj = NodeElement
diff --git a/src/OGDF/OptimalHierarchyLayout.hs b/src/OGDF/OptimalHierarchyLayout.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/OptimalHierarchyLayout.hs
@@ -0,0 +1,10 @@
+module OGDF.OptimalHierarchyLayout
+       (OptimalHierarchyLayout(..), IOptimalHierarchyLayout,
+        upcastOptimalHierarchyLayout, downcastOptimalHierarchyLayout,
+        newOptimalHierarchyLayout, optimalHierarchyLayout_layerDistance,
+        optimalHierarchyLayout_nodeDistance,
+        optimalHierarchyLayout_weightBalancing)
+       where
+import OGDF.OptimalHierarchyLayout.RawType
+import OGDF.OptimalHierarchyLayout.Interface
+import OGDF.OptimalHierarchyLayout.Implementation
diff --git a/src/OGDF/OptimalHierarchyLayout/Cast.hs b/src/OGDF/OptimalHierarchyLayout/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/OptimalHierarchyLayout/Cast.hs
@@ -0,0 +1,21 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.OptimalHierarchyLayout.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.OptimalHierarchyLayout.RawType
+import OGDF.OptimalHierarchyLayout.Interface
+
+instance (IOptimalHierarchyLayout a, FPtr a) =>
+         Castable (a) (Ptr RawOptimalHierarchyLayout)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
+
+instance () =>
+         Castable (OptimalHierarchyLayout) (Ptr RawOptimalHierarchyLayout)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/OptimalHierarchyLayout/FFI.hsc b/src/OGDF/OptimalHierarchyLayout/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/OptimalHierarchyLayout/FFI.hsc
@@ -0,0 +1,33 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.OptimalHierarchyLayout.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.OptimalHierarchyLayout.RawType
+import OGDF.OptimalHierarchyLayout.RawType
+
+foreign import ccall interruptible
+               "OGDFOptimalHierarchyLayout.h OptimalHierarchyLayout_delete"
+               c_optimalhierarchylayout_delete ::
+               Ptr RawOptimalHierarchyLayout -> IO ()
+
+foreign import ccall interruptible
+               "OGDFOptimalHierarchyLayout.h OptimalHierarchyLayout_newOptimalHierarchyLayout"
+               c_optimalhierarchylayout_newoptimalhierarchylayout ::
+               IO (Ptr RawOptimalHierarchyLayout)
+
+foreign import ccall interruptible
+               "OGDFOptimalHierarchyLayout.h OptimalHierarchyLayout_optimalHierarchyLayout_layerDistance"
+               c_optimalhierarchylayout_optimalhierarchylayout_layerdistance ::
+               Ptr RawOptimalHierarchyLayout -> CDouble -> IO ()
+
+foreign import ccall interruptible
+               "OGDFOptimalHierarchyLayout.h OptimalHierarchyLayout_optimalHierarchyLayout_nodeDistance"
+               c_optimalhierarchylayout_optimalhierarchylayout_nodedistance ::
+               Ptr RawOptimalHierarchyLayout -> CDouble -> IO ()
+
+foreign import ccall interruptible
+               "OGDFOptimalHierarchyLayout.h OptimalHierarchyLayout_optimalHierarchyLayout_weightBalancing"
+               c_optimalhierarchylayout_optimalhierarchylayout_weightbalancing ::
+               Ptr RawOptimalHierarchyLayout -> CDouble -> IO ()
diff --git a/src/OGDF/OptimalHierarchyLayout/Implementation.hs b/src/OGDF/OptimalHierarchyLayout/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/OptimalHierarchyLayout/Implementation.hs
@@ -0,0 +1,60 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.OptimalHierarchyLayout.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.OptimalHierarchyLayout.RawType
+import OGDF.OptimalHierarchyLayout.FFI
+import OGDF.OptimalHierarchyLayout.Interface
+import OGDF.OptimalHierarchyLayout.Cast
+import OGDF.OptimalHierarchyLayout.RawType
+import OGDF.OptimalHierarchyLayout.Cast
+import OGDF.OptimalHierarchyLayout.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
+import OGDF.HierarchyLayoutModule.RawType
+import OGDF.HierarchyLayoutModule.Cast
+import OGDF.HierarchyLayoutModule.Interface
+
+instance () => IOptimalHierarchyLayout (OptimalHierarchyLayout)
+         where
+
+instance () => IDeletable (OptimalHierarchyLayout) where
+        delete = xform0 c_optimalhierarchylayout_delete
+
+instance () => IHierarchyLayoutModule (OptimalHierarchyLayout)
+         where
+
+newOptimalHierarchyLayout :: () => IO OptimalHierarchyLayout
+newOptimalHierarchyLayout
+  = xformnull c_optimalhierarchylayout_newoptimalhierarchylayout
+
+optimalHierarchyLayout_layerDistance ::
+                                       () => OptimalHierarchyLayout -> CDouble -> IO ()
+optimalHierarchyLayout_layerDistance
+  = xform1
+      c_optimalhierarchylayout_optimalhierarchylayout_layerdistance
+
+optimalHierarchyLayout_nodeDistance ::
+                                      () => OptimalHierarchyLayout -> CDouble -> IO ()
+optimalHierarchyLayout_nodeDistance
+  = xform1
+      c_optimalhierarchylayout_optimalhierarchylayout_nodedistance
+
+optimalHierarchyLayout_weightBalancing ::
+                                         () => OptimalHierarchyLayout -> CDouble -> IO ()
+optimalHierarchyLayout_weightBalancing
+  = xform1
+      c_optimalhierarchylayout_optimalhierarchylayout_weightbalancing
diff --git a/src/OGDF/OptimalHierarchyLayout/Interface.hs b/src/OGDF/OptimalHierarchyLayout/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/OptimalHierarchyLayout/Interface.hs
@@ -0,0 +1,32 @@
+{-# 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 h
+  = let fh = get_fptr h
+        fh2 :: Ptr RawOptimalHierarchyLayout = castPtr fh
+      in cast_fptr_to_obj fh2
+
+downcastOptimalHierarchyLayout ::
+                               forall a . (FPtr a, IOptimalHierarchyLayout a) =>
+                                 OptimalHierarchyLayout -> a
+downcastOptimalHierarchyLayout h
+  = let fh = get_fptr h
+        fh2 = castPtr fh
+      in cast_fptr_to_obj fh2
diff --git a/src/OGDF/OptimalHierarchyLayout/RawType.hs b/src/OGDF/OptimalHierarchyLayout/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/OptimalHierarchyLayout/RawType.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.OptimalHierarchyLayout.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawOptimalHierarchyLayout
+
+newtype OptimalHierarchyLayout = OptimalHierarchyLayout (Ptr
+                                                           RawOptimalHierarchyLayout)
+                                   deriving (Eq, Ord, Show)
+
+instance () => FPtr (OptimalHierarchyLayout) where
+        type Raw OptimalHierarchyLayout = RawOptimalHierarchyLayout
+        get_fptr (OptimalHierarchyLayout ptr) = ptr
+        cast_fptr_to_obj = OptimalHierarchyLayout
diff --git a/src/OGDF/OptimalRanking.hs b/src/OGDF/OptimalRanking.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/OptimalRanking.hs
@@ -0,0 +1,7 @@
+module OGDF.OptimalRanking
+       (OptimalRanking(..), IOptimalRanking, upcastOptimalRanking,
+        downcastOptimalRanking, newOptimalRanking)
+       where
+import OGDF.OptimalRanking.RawType
+import OGDF.OptimalRanking.Interface
+import OGDF.OptimalRanking.Implementation
diff --git a/src/OGDF/OptimalRanking/Cast.hs b/src/OGDF/OptimalRanking/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/OptimalRanking/Cast.hs
@@ -0,0 +1,20 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.OptimalRanking.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.OptimalRanking.RawType
+import OGDF.OptimalRanking.Interface
+
+instance (IOptimalRanking a, FPtr a) =>
+         Castable (a) (Ptr RawOptimalRanking)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
+
+instance () => Castable (OptimalRanking) (Ptr RawOptimalRanking)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/OptimalRanking/FFI.hsc b/src/OGDF/OptimalRanking/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/OptimalRanking/FFI.hsc
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.OptimalRanking.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.OptimalRanking.RawType
+import OGDF.OptimalRanking.RawType
+
+foreign import ccall interruptible
+               "OGDFOptimalRanking.h OptimalRanking_delete"
+               c_optimalranking_delete :: Ptr RawOptimalRanking -> IO ()
+
+foreign import ccall interruptible
+               "OGDFOptimalRanking.h OptimalRanking_newOptimalRanking"
+               c_optimalranking_newoptimalranking :: IO (Ptr RawOptimalRanking)
diff --git a/src/OGDF/OptimalRanking/Implementation.hs b/src/OGDF/OptimalRanking/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/OptimalRanking/Implementation.hs
@@ -0,0 +1,39 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.OptimalRanking.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.OptimalRanking.RawType
+import OGDF.OptimalRanking.FFI
+import OGDF.OptimalRanking.Interface
+import OGDF.OptimalRanking.Cast
+import OGDF.OptimalRanking.RawType
+import OGDF.OptimalRanking.Cast
+import OGDF.OptimalRanking.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
+import OGDF.RankingModule.RawType
+import OGDF.RankingModule.Cast
+import OGDF.RankingModule.Interface
+
+instance () => IOptimalRanking (OptimalRanking) where
+
+instance () => IDeletable (OptimalRanking) where
+        delete = xform0 c_optimalranking_delete
+
+instance () => IRankingModule (OptimalRanking) where
+
+newOptimalRanking :: () => IO OptimalRanking
+newOptimalRanking = xformnull c_optimalranking_newoptimalranking
diff --git a/src/OGDF/OptimalRanking/Interface.hs b/src/OGDF/OptimalRanking/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/OptimalRanking/Interface.hs
@@ -0,0 +1,29 @@
+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
+  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
+  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
+  TypeSynonymInstances #-}
+module OGDF.OptimalRanking.Interface where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.OptimalRanking.RawType
+import STD.Deletable.Interface
+import OGDF.RankingModule.Interface
+
+class (IDeletable a, IRankingModule a) => IOptimalRanking a where
+
+upcastOptimalRanking ::
+                     forall a . (FPtr a, IOptimalRanking a) => a -> OptimalRanking
+upcastOptimalRanking h
+  = let fh = get_fptr h
+        fh2 :: Ptr RawOptimalRanking = castPtr fh
+      in cast_fptr_to_obj fh2
+
+downcastOptimalRanking ::
+                       forall a . (FPtr a, IOptimalRanking a) => OptimalRanking -> a
+downcastOptimalRanking h
+  = let fh = get_fptr h
+        fh2 = castPtr fh
+      in cast_fptr_to_obj fh2
diff --git a/src/OGDF/OptimalRanking/RawType.hs b/src/OGDF/OptimalRanking/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/OptimalRanking/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.OptimalRanking.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawOptimalRanking
+
+newtype OptimalRanking = OptimalRanking (Ptr RawOptimalRanking)
+                           deriving (Eq, Ord, Show)
+
+instance () => FPtr (OptimalRanking) where
+        type Raw OptimalRanking = RawOptimalRanking
+        get_fptr (OptimalRanking ptr) = ptr
+        cast_fptr_to_obj = OptimalRanking
diff --git a/src/OGDF/Ordinary.hs b/src/OGDF/Ordinary.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/Ordinary.hs
@@ -0,0 +1,8 @@
+{-# LANGUAGE FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.Ordinary () where
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.List.Template
+import OGDF.ListIterator.Template
diff --git a/src/OGDF/RankingModule.hs b/src/OGDF/RankingModule.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/RankingModule.hs
@@ -0,0 +1,7 @@
+module OGDF.RankingModule
+       (RankingModule(..), IRankingModule, upcastRankingModule,
+        downcastRankingModule)
+       where
+import OGDF.RankingModule.RawType
+import OGDF.RankingModule.Interface
+import OGDF.RankingModule.Implementation
diff --git a/src/OGDF/RankingModule/Cast.hs b/src/OGDF/RankingModule/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/RankingModule/Cast.hs
@@ -0,0 +1,20 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.RankingModule.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.RankingModule.RawType
+import OGDF.RankingModule.Interface
+
+instance (IRankingModule a, FPtr a) =>
+         Castable (a) (Ptr RawRankingModule)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
+
+instance () => Castable (RankingModule) (Ptr RawRankingModule)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/RankingModule/FFI.hsc b/src/OGDF/RankingModule/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/RankingModule/FFI.hsc
@@ -0,0 +1,12 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.RankingModule.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.RankingModule.RawType
+import OGDF.RankingModule.RawType
+
+foreign import ccall interruptible
+               "OGDFRankingModule.h RankingModule_delete" c_rankingmodule_delete
+               :: Ptr RawRankingModule -> IO ()
diff --git a/src/OGDF/RankingModule/Implementation.hs b/src/OGDF/RankingModule/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/RankingModule/Implementation.hs
@@ -0,0 +1,31 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.RankingModule.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.RankingModule.RawType
+import OGDF.RankingModule.FFI
+import OGDF.RankingModule.Interface
+import OGDF.RankingModule.Cast
+import OGDF.RankingModule.RawType
+import OGDF.RankingModule.Cast
+import OGDF.RankingModule.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
+
+instance () => IRankingModule (RankingModule) where
+
+instance () => IDeletable (RankingModule) where
+        delete = xform0 c_rankingmodule_delete
diff --git a/src/OGDF/RankingModule/Interface.hs b/src/OGDF/RankingModule/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/RankingModule/Interface.hs
@@ -0,0 +1,28 @@
+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
+  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
+  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
+  TypeSynonymInstances #-}
+module OGDF.RankingModule.Interface where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.RankingModule.RawType
+import STD.Deletable.Interface
+
+class (IDeletable a) => IRankingModule a where
+
+upcastRankingModule ::
+                    forall a . (FPtr a, IRankingModule a) => a -> RankingModule
+upcastRankingModule h
+  = let fh = get_fptr h
+        fh2 :: Ptr RawRankingModule = castPtr fh
+      in cast_fptr_to_obj fh2
+
+downcastRankingModule ::
+                      forall a . (FPtr a, IRankingModule a) => RankingModule -> a
+downcastRankingModule h
+  = let fh = get_fptr h
+        fh2 = castPtr fh
+      in cast_fptr_to_obj fh2
diff --git a/src/OGDF/RankingModule/RawType.hs b/src/OGDF/RankingModule/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/RankingModule/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.RankingModule.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawRankingModule
+
+newtype RankingModule = RankingModule (Ptr RawRankingModule)
+                          deriving (Eq, Ord, Show)
+
+instance () => FPtr (RankingModule) where
+        type Raw RankingModule = RawRankingModule
+        get_fptr (RankingModule ptr) = ptr
+        cast_fptr_to_obj = RankingModule
diff --git a/src/OGDF/SugiyamaLayout.hs b/src/OGDF/SugiyamaLayout.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/SugiyamaLayout.hs
@@ -0,0 +1,9 @@
+module OGDF.SugiyamaLayout
+       (SugiyamaLayout(..), ISugiyamaLayout, upcastSugiyamaLayout,
+        downcastSugiyamaLayout, newSugiyamaLayout,
+        sugiyamaLayout_pageRatio, sugiyamaLayout_setCrossMin,
+        sugiyamaLayout_setLayout, sugiyamaLayout_setRanking)
+       where
+import OGDF.SugiyamaLayout.RawType
+import OGDF.SugiyamaLayout.Interface
+import OGDF.SugiyamaLayout.Implementation
diff --git a/src/OGDF/SugiyamaLayout/Cast.hs b/src/OGDF/SugiyamaLayout/Cast.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/SugiyamaLayout/Cast.hs
@@ -0,0 +1,20 @@
+{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
+  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
+  #-}
+module OGDF.SugiyamaLayout.Cast where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import System.IO.Unsafe
+import OGDF.SugiyamaLayout.RawType
+import OGDF.SugiyamaLayout.Interface
+
+instance (ISugiyamaLayout a, FPtr a) =>
+         Castable (a) (Ptr RawSugiyamaLayout)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
+
+instance () => Castable (SugiyamaLayout) (Ptr RawSugiyamaLayout)
+         where
+        cast x f = f (castPtr (get_fptr x))
+        uncast x f = f (cast_fptr_to_obj (castPtr x))
diff --git a/src/OGDF/SugiyamaLayout/FFI.hsc b/src/OGDF/SugiyamaLayout/FFI.hsc
new file mode 100644
--- /dev/null
+++ b/src/OGDF/SugiyamaLayout/FFI.hsc
@@ -0,0 +1,44 @@
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
+module OGDF.SugiyamaLayout.FFI where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import OGDF.SugiyamaLayout.RawType
+import OGDF.SugiyamaLayout.RawType
+import OGDF.GraphAttributes.RawType
+import OGDF.LayeredCrossMinModule.RawType
+import OGDF.HierarchyLayoutModule.RawType
+import OGDF.RankingModule.RawType
+
+foreign import ccall interruptible
+               "OGDFSugiyamaLayout.h SugiyamaLayout_delete"
+               c_sugiyamalayout_delete :: Ptr RawSugiyamaLayout -> IO ()
+
+foreign import ccall interruptible
+               "OGDFSugiyamaLayout.h SugiyamaLayout_call" c_sugiyamalayout_call ::
+               Ptr RawSugiyamaLayout -> Ptr RawGraphAttributes -> IO ()
+
+foreign import ccall interruptible
+               "OGDFSugiyamaLayout.h SugiyamaLayout_newSugiyamaLayout"
+               c_sugiyamalayout_newsugiyamalayout :: IO (Ptr RawSugiyamaLayout)
+
+foreign import ccall interruptible
+               "OGDFSugiyamaLayout.h SugiyamaLayout_sugiyamaLayout_pageRatio"
+               c_sugiyamalayout_sugiyamalayout_pageratio ::
+               Ptr RawSugiyamaLayout -> CDouble -> IO ()
+
+foreign import ccall interruptible
+               "OGDFSugiyamaLayout.h SugiyamaLayout_sugiyamaLayout_setCrossMin"
+               c_sugiyamalayout_sugiyamalayout_setcrossmin ::
+               Ptr RawSugiyamaLayout -> Ptr RawLayeredCrossMinModule -> IO ()
+
+foreign import ccall interruptible
+               "OGDFSugiyamaLayout.h SugiyamaLayout_sugiyamaLayout_setLayout"
+               c_sugiyamalayout_sugiyamalayout_setlayout ::
+               Ptr RawSugiyamaLayout -> Ptr RawHierarchyLayoutModule -> IO ()
+
+foreign import ccall interruptible
+               "OGDFSugiyamaLayout.h SugiyamaLayout_sugiyamaLayout_setRanking"
+               c_sugiyamalayout_sugiyamalayout_setranking ::
+               Ptr RawSugiyamaLayout -> Ptr RawRankingModule -> IO ()
diff --git a/src/OGDF/SugiyamaLayout/Implementation.hs b/src/OGDF/SugiyamaLayout/Implementation.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/SugiyamaLayout/Implementation.hs
@@ -0,0 +1,74 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, IncoherentInstances,
+  MultiParamTypeClasses, OverlappingInstances, TemplateHaskell,
+  TypeFamilies, TypeSynonymInstances #-}
+module OGDF.SugiyamaLayout.Implementation where
+import Data.Monoid
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import System.IO.Unsafe
+import FFICXX.Runtime.Cast
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
+import OGDF.SugiyamaLayout.RawType
+import OGDF.SugiyamaLayout.FFI
+import OGDF.SugiyamaLayout.Interface
+import OGDF.SugiyamaLayout.Cast
+import OGDF.SugiyamaLayout.RawType
+import OGDF.SugiyamaLayout.Cast
+import OGDF.SugiyamaLayout.Interface
+import OGDF.GraphAttributes.RawType
+import OGDF.GraphAttributes.Cast
+import OGDF.GraphAttributes.Interface
+import OGDF.LayeredCrossMinModule.RawType
+import OGDF.LayeredCrossMinModule.Cast
+import OGDF.LayeredCrossMinModule.Interface
+import OGDF.HierarchyLayoutModule.RawType
+import OGDF.HierarchyLayoutModule.Cast
+import OGDF.HierarchyLayoutModule.Interface
+import OGDF.RankingModule.RawType
+import OGDF.RankingModule.Cast
+import OGDF.RankingModule.Interface
+import STD.Deletable.RawType
+import STD.Deletable.Cast
+import STD.Deletable.Interface
+import OGDF.LayoutModule.RawType
+import OGDF.LayoutModule.Cast
+import OGDF.LayoutModule.Interface
+
+instance () => ISugiyamaLayout (SugiyamaLayout) where
+
+instance () => IDeletable (SugiyamaLayout) where
+        delete = xform0 c_sugiyamalayout_delete
+
+instance () => ILayoutModule (SugiyamaLayout) where
+        call = xform1 c_sugiyamalayout_call
+
+newSugiyamaLayout :: () => IO SugiyamaLayout
+newSugiyamaLayout = xformnull c_sugiyamalayout_newsugiyamalayout
+
+sugiyamaLayout_pageRatio ::
+                           () => SugiyamaLayout -> CDouble -> IO ()
+sugiyamaLayout_pageRatio
+  = xform1 c_sugiyamalayout_sugiyamalayout_pageratio
+
+sugiyamaLayout_setCrossMin ::
+                             (ILayeredCrossMinModule c0, FPtr c0) =>
+                             SugiyamaLayout -> c0 -> IO ()
+sugiyamaLayout_setCrossMin
+  = xform1 c_sugiyamalayout_sugiyamalayout_setcrossmin
+
+sugiyamaLayout_setLayout ::
+                           (IHierarchyLayoutModule c0, FPtr c0) =>
+                           SugiyamaLayout -> c0 -> IO ()
+sugiyamaLayout_setLayout
+  = xform1 c_sugiyamalayout_sugiyamalayout_setlayout
+
+sugiyamaLayout_setRanking ::
+                            (IRankingModule c0, FPtr c0) => SugiyamaLayout -> c0 -> IO ()
+sugiyamaLayout_setRanking
+  = xform1 c_sugiyamalayout_sugiyamalayout_setranking
diff --git a/src/OGDF/SugiyamaLayout/Interface.hs b/src/OGDF/SugiyamaLayout/Interface.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/SugiyamaLayout/Interface.hs
@@ -0,0 +1,29 @@
+{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
+  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
+  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
+  TypeSynonymInstances #-}
+module OGDF.SugiyamaLayout.Interface where
+import Data.Word
+import Data.Int
+import Foreign.C
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+import OGDF.SugiyamaLayout.RawType
+import STD.Deletable.Interface
+import OGDF.LayoutModule.Interface
+
+class (IDeletable a, ILayoutModule a) => ISugiyamaLayout a where
+
+upcastSugiyamaLayout ::
+                     forall a . (FPtr a, ISugiyamaLayout a) => a -> SugiyamaLayout
+upcastSugiyamaLayout h
+  = let fh = get_fptr h
+        fh2 :: Ptr RawSugiyamaLayout = castPtr fh
+      in cast_fptr_to_obj fh2
+
+downcastSugiyamaLayout ::
+                       forall a . (FPtr a, ISugiyamaLayout a) => SugiyamaLayout -> a
+downcastSugiyamaLayout h
+  = let fh = get_fptr h
+        fh2 = castPtr fh
+      in cast_fptr_to_obj fh2
diff --git a/src/OGDF/SugiyamaLayout/RawType.hs b/src/OGDF/SugiyamaLayout/RawType.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/SugiyamaLayout/RawType.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE ForeignFunctionInterface, TypeFamilies,
+  MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances,
+  EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
+module OGDF.SugiyamaLayout.RawType where
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
+
+data RawSugiyamaLayout
+
+newtype SugiyamaLayout = SugiyamaLayout (Ptr RawSugiyamaLayout)
+                           deriving (Eq, Ord, Show)
+
+instance () => FPtr (SugiyamaLayout) where
+        type Raw SugiyamaLayout = RawSugiyamaLayout
+        get_fptr (SugiyamaLayout ptr) = ptr
+        cast_fptr_to_obj = SugiyamaLayout
diff --git a/src/OGDF/TH.hs b/src/OGDF/TH.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/TH.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE FlexibleContexts, FlexibleInstances,
+  ForeignFunctionInterface, InterruptibleFFI, TemplateHaskell #-}
+module OGDF.TH () where
+import Data.Char
+import Data.List
+import Data.Monoid
+import Foreign.C.Types
+import Foreign.Ptr
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import FFICXX.Runtime.CodeGen.Cxx
+import FFICXX.Runtime.TH
diff --git a/src/OGDF/Template.hs b/src/OGDF/Template.hs
new file mode 100644
--- /dev/null
+++ b/src/OGDF/Template.hs
@@ -0,0 +1,7 @@
+{-# LANGUAGE EmptyDataDecls, FlexibleInstances,
+  ForeignFunctionInterface, InterruptibleFFI, MultiParamTypeClasses,
+  TypeFamilies #-}
+module OGDF.Template () where
+import Foreign.C.Types
+import Foreign.Ptr
+import FFICXX.Runtime.Cast
