private static CharSequence generateFieldOrderStateMember(final FieldPrecedenceModel fieldPrecedenceModel)
    {
        if (null == fieldPrecedenceModel)
        {
            return "\n";
        }

        final StringBuilder sb = new StringBuilder();

        sb.append(INDENT).append("CodecState m_codecState = ")
            .append(qualifiedStateCase(fieldPrecedenceModel.notWrappedState()))
            .append(";\n\n");

        sb.append(INDENT).append("CodecState codecState() const\n")
            .append(INDENT).append("{\n")
            .append(INDENT).append(INDENT).append("return m_codecState;\n")
            .append(INDENT).append("}\n\n");

        sb.append(INDENT).append("CodecState *codecStatePtr()\n")
            .append(INDENT).append("{\n")
            .append(INDENT).append(INDENT).append("return &m_codecState;\n")
            .append(INDENT).append("}\n\n");

        sb.append(INDENT).append("void codecState(CodecState newState)\n")
            .append(INDENT).append("{\n")
            .append(INDENT).append(INDENT).append("m_codecState = newState;\n")
            .append(INDENT).append("}\n\n");

        return sb;
    }
\n");
        sb.append("     * The states in which a encoder/decoder/codec can live.\n");
        sb.append("     *\n");
        sb.append("     * <p>The state machine diagram below, encoded in the dot language, describes\n");
        sb.append("     * the valid state transitions according to the order in which fields may be\n");
        sb.append("     * accessed safely. Tools such as PlantUML and Graphviz can render it.\n");
        sb.append("     *\n");
        sb.append("     * <pre>{@code\n");
        fieldPrecedenceModel.generateGraph(sb, "     *   ");
        sb.append("     * }</pre>\n");
        sb.append("
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp/CppGenerator.java