using System; using System.Reflection; using System.Linq; namespace Aurora.Executors { public abstract class BaseExecutor { protected BaseExecutor() { } public Type ExecutorType { get; protected set; } public static BaseExecutor CreateExecutor() { BaseExecutor executor = null; if (typeof(T) == typeof(HostExecutor)) { executor = new HostExecutor(); executor.ExecutorType = typeof(HostExecutor); } else if (typeof(T) == typeof(ClientExecutor)) { executor = new ClientExecutor(); executor.ExecutorType = typeof(ClientExecutor); } else { throw new InvalidOperationException("Cannot create an executor of type: " + nameof(T)); } return executor; } public abstract void Initialize(); public abstract void Run(); public abstract void Close(); public abstract void GetMembers(); public abstract void GetQueue(); public abstract void AddToQueue(); public abstract void RemoveFromQueue(); } public enum ExecutorType { Server, Client } }