public void generate(ClassNode root, PeerGenSettings peerGenSettings)
            throws java.io.IOException {
        this.peerGenSettings = peerGenSettings;

        String fullFileName = peerGenSettings.getProject().getCPPOutputDir() + File.separatorChar;
        if (root.getPackageName().equals("") == true) {
            fullFileName = root.getCPPClassName() + "Mapping.h";
        } else {
            fullFileName = root.getPackageName().replace('.', File.separatorChar) + File.separatorChar + root.getCPPClassName() + "Mapping.h";
        }

        FormattedFileWriter writer = new FormattedFileWriter(fullFileName, true);
        Iterator it = root.getNamespaceElements();
        String def = "__";
        while (it.hasNext() == true) {
            def += (String) it.next() + "_";
        }
        def += root.getCPPClassName() + "Mapping_H";
        writer.outputLine("#ifndef " + def);
        writer.outputLine("#define " + def);
        writer.newLine(2);

        writer.outputLine("#include <jni.h>");
        writer.outputLine("#include \"" + root.getClassName() + "Peer.h\"");
        writer.newLine(1);

        generateMethods(root, writer);

        writer.newLine(2);
        writer.outputLine("#endif");
        writer.flush();
        writer.close();
    }