view codegear/InputDataGear.cs @ 8:e6f5b7d14dd1

update DataGears
author riono <e165729@ie.u-ryukyu.ac.jp>
date Mon, 12 Oct 2020 00:49:32 +0900
parents 839e355f92ed
children ce6906edcbf4
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 CodeGear cg;
    public CodeGearManager cgm;
    private int count;
    public ConcurrentDictionary<string, DataGear<Type>> inputValue = new ConcurrentDictionary<string, DataGear<Type>>();

    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);
    }
}
}