using Newtonsoft.Json; using System; namespace PepperDash.Essentials.Core { /// /// Represents a basic routing output port on a device. /// public class RoutingOutputPort : RoutingPort { /// /// The IRoutingOutputs object this port lives on. /// [JsonIgnore] public IRoutingOutputs ParentDevice { get; private set; } /// /// Tracks which destinations are currently using this output port. /// public InUseTracking InUseTracker { get; private set; } /// /// Initializes a new instance of the class. /// /// The unique key for this port. /// The signal type supported by this port. /// The physical connection type of this port. /// An object used to refer to this port in the parent device's ExecuteSwitch method. /// The device this port belongs to. public RoutingOutputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType, object selector, IRoutingOutputs parent) : this(key, type, connType, selector, parent, false) { } /// /// Initializes a new instance of the class, potentially marking it as internal. /// /// The unique key for this port. /// The signal type supported by this port. /// The physical connection type of this port. /// An object used to refer to this port in the parent device's ExecuteSwitch method. /// The device this port belongs to. /// True if this port represents an internal connection within a device (e.g., card to backplane). public RoutingOutputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType, object selector, IRoutingOutputs parent, bool isInternal) : base(key, type, connType, selector, isInternal) { ParentDevice = parent ?? throw new ArgumentNullException(nameof(parent)); InUseTracker = new InUseTracking(); } /// /// Returns a string representation of the output port. /// /// A string in the format "ParentDeviceKey|PortKey|SignalType|ConnectionType". public override string ToString() { return $"{ParentDevice.Key}|{Key}|{Type}|{ConnectionType}"; } } /*public class RoutingOutputPort : RoutingPort { /// /// The IRoutingOutputs object this port lives on /// public IRoutingOutputs ParentDevice { get; private set; } public InUseTracking InUseTracker { get; private set; } /// /// /// An object used to refer to this port in the IRouting device's ExecuteSwitch method. /// May be string, number, whatever /// The IRoutingOutputs object this port lives on public RoutingOutputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType, TSelector selector, IRoutingOutputs parent) : this(key, type, connType, selector, parent, false) { } public RoutingOutputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType, TSelector selector, IRoutingOutputs parent, bool isInternal) : base(key, type, connType, selector, isInternal) { ParentDevice = parent ?? throw new ArgumentNullException(nameof(parent)); InUseTracker = new InUseTracking(); } public override string ToString() { return ParentDevice.Key + ":" + Key; } }*/ }