override fun translate()

in code/4diac-integration/src/main/kotlin/org/fbme/ide/integration/fordiac/translator/cpp/composite/CompositeFBTypeHeaderTranslator.kt [14:57]


    override fun translate(): String {
        sb.appendLine(this.constructIncludeGuardStart())
            .appendLine(this.constructHeaderIncludes())
            .appendLine(this.constructFBClassHeader())
            .appendLine(this.constructFBDeclaration(indent = "  "))
            .appendLine("private:")
            .appendLine(this.constructFBInterfaceDeclaration(indent = "  "))
            .appendLine(this.constructFBInterfaceSpecDeclaration(indent = "  "))

        addFBNetwork()

        sb.appendLine(this.constructAccessors(fb.inputParameters, functionName = "getDI", indent = "  "))
            .appendLine(this.constructAccessors(fb.outputParameters, functionName = "getDO", indent = "  "))
            .appendLine(this.constructAccessors(fb.sockets + fb.plugs, indent = "  "))
            .append("  FORTE_FB_DATA_ARRAY(")
            .append(fb.outputEvents.size)
            .append(", ")
            .append(fb.inputParameters.size)
            .append(", ")
            .append(fb.outputParameters.size)
            .append(", ")
            .append(fb.sockets.size + fb.plugs.size)
            .appendLine(");")
            .appendLine("public:")
            .append("  ")
            .append(this.constructFBClassName())
            .appendLine("(const CStringDictionary::TStringId pa_nInstanceNameId, CResource *pa_poSrcRes) :")
            .append("      ")
            .append(baseClass)
            .appendLine(
                "(pa_poSrcRes, &scm_stFBInterfaceSpec, pa_nInstanceNameId, &scm_stFBNData, m_anFBConnData, m_anFBVarsData) {"
            )
            .appendLine("  };")
            .append("  virtual ~")
            .append(this.constructFBClassName())
            .appendLine("() = default;")
            .appendLine("};")
            .appendLine(this.constructIncludeGuardEnd())

        val res = sb.toString()
        sb.clear()

        return res
    }