Exemplo n.º 1
0
        static void MyUpdateEventCallback(sml.smlUpdateEventId eventID, IntPtr callbackData, IntPtr kernelPtr, smlRunFlags runFlags)
        {
            // Retrieve the original object reference from the GCHandle which is used to pass the value safely to and from C++ (unsafe/unmanaged) code.
            sml.Kernel kernel = (sml.Kernel)((GCHandle)kernelPtr).Target;

            // Retrieve arbitrary data from callback data object (note data here can be null, but the wrapper object callbackData won't be so this call is safe)
            // This field's usage is up to the user and passed in during registation call and passed back here.  Can be used to provide context.
            Object userData = (Object)((GCHandle)callbackData).Target;

            System.Console.Out.WriteLine(eventID + " kernel " + kernel + " run flags " + runFlags + " with user data " + userData);
        }
Exemplo n.º 2
0
        private void UpdateEventCallback(sml.smlUpdateEventId eventID, IntPtr callbackData, IntPtr kernelPtr, smlRunFlags runFlags)
        {
            // check for stop
            if (_stop)
            {
                _stop = false;
                OnLog("Soar: Update: Stopping all agents.");
                _kernel.StopAllAgents();
                return;
            }

            ProcessOutputLink();
            ProcessInputLink();

            // commit input link changes
            _agent.Commit();
        }