TProPCMonitor/LoraGamepad/Util/IPipe.cs

21 lines
510 B
C#

using System.Collections.Generic;
namespace LoraGamepad.Util;
/// <summary>
/// 数据管道基类
/// </summary>
/// <typeparam name="T1">入口数据类型</typeparam>
/// <typeparam name="T2">出口数据类型</typeparam>
public abstract class IPipe<T1, T2> {
public delegate void OutFuncDelegate(T2 data);
public OutFuncDelegate OnOut;
public abstract void Push(T1 data);
public void Push(IEnumerable<T1> data) {
foreach (var x in data) {
Push(x);
}
}
}