<?xml version="1.0" encoding="UTF-8"?>
<diagram author="Yentl Van Tendeloo" name="Logging">
    <description>
        For testing: append all input to a log until finished
    </description>

    <inport name="inp"/>
    <outport name="outp"/>

    <class name="Logging" default="true">
        <constructor>
            <parameter name="log"/>
            <body>
                self.log = log
            </body>
        </constructor>

        <scxml initial="init">
            <state id="init">
                <transition event="input" port="inp" target=".">
                    <parameter name="value"/>
                    <script>
                        print("Logging " + str(value))
                        self.log.append(value)
                    </script>
                </transition>

                <transition after="0.1" target="."/>

                <transition event="terminate" port="inp" target="../finished">
                    <script>
                        print("Got terminate")
                    </script>
                </transition>
            </state>

            <state id="finished"/>
        </scxml>
    </class>
</diagram>
