コード例 #1
0
        /// <summary>
        /// one-way (drill down) recursion, no wait allowed
        /// </summary>
        /// <param name="iter">Task iterator</param>
        /// <returns>null when yield break or end of method is encountered</returns>
        private IEnumerator <ISubsumptionTask> iterate(IEnumerator <ISubsumptionTask> iter)
        {
            //Debug.WriteLine("TaskDispatcher: iterate()    type: " + iter.GetType());

            if (iter != null && iter.MoveNext())
            {
                ISubsumptionTask task = iter.Current;

                //Debug.WriteLine("...iterating...   task: " + task);

                bool doContinie = task == RobotTask.Continue;

                if (doContinie)
                {
                    //Debug.WriteLine("TaskDispatcher: iterate() - task: " + task + "     Task.Continue - doing nothing");

                    return(iter);
                }

                iter = task.Execute();

                //Debug.WriteLine("TaskDispatcher: iterate() - task: " + task + " - iterating inside inner loop");

                return(iterate(iter));
            }

            //Debug.WriteLine("TaskDispatcher: iterate() finished task");

            return(null);
        }
コード例 #2
0
        /// <summary>
        /// adds a task to the list of active tasks
        /// </summary>
        /// <param name="task"></param>
        public void Dispatch(ISubsumptionTask task)
        {
            Debug.WriteLine("TaskDispatcher: Dispatch: " + tasks.Count + " tasks, adding: " + task.name);

            tasks.Add(task);

            //lock(iStates)
            {
                iStates.Add(new IteratorState() { taskName = task.name, iterator = task.Execute() });
            }
        }
コード例 #3
0
        /// <summary>
        /// adds a task to the list of active tasks
        /// </summary>
        /// <param name="task"></param>
        public void Dispatch(ISubsumptionTask task)
        {
            Debug.WriteLine("TaskDispatcher: Dispatch: " + tasks.Count + " tasks, adding: " + task.name);

            tasks.Add(task);

            //lock(iStates)
            {
                iStates.Add(new IteratorState()
                {
                    taskName = task.name, iterator = task.Execute()
                });
            }
        }