view codegear/InputDataGear.cs @ 2:839e355f92ed

update DataGear.cs
author riono <e165729@ie.u-ryukyu.ac.jp>
date Sun, 21 Jun 2020 15:43:48 +0900
parents 740b80680d75
children e6f5b7d14dd1
line wrap: on
line source

using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using Christie_net.datagear.dg;

namespace Christie_net.codegear {
    public class InputDataGear {
        public ConcurrentDictionary<string, DataGear<Type>> inputValue = new ConcurrentDictionary<string, DataGear<Type>>();
        public CodeGearManager cgm;
        public CodeGear cg;
        private int count = 0;

        public InputDataGear(CodeGear cg) {
            this.cg = cg;
        }

        private void FinishInput(CodeGearManager cgm, List<Command> commandList) {
            this.cgm = cgm;
            count = commandList.Count;

            if (count == 0) {
                SubmitCG();
            }

            foreach (Command cm in commandList) {
                cgm.GetDGM(cm.toDgmName).RunCommand(cm);
            }
        }

        public void SetInputs(string key, DataGear<Type> dg) {
            inputValue.AddOrUpdate(key, dg);
        }
    }
}