Class IPortType
Base type for all ports. Do not set IPortType as Serializable, otherwise DynamicPorts won't save their derived port [Serializable]
Namespace: Mechatronics.SystemGraph
Syntax
public class IPortType
Constructors
IPortType()
Initialize a port and increment the global ID.
Declaration
public IPortType()
Fields
Batching
Whether to batch change events on ports or not.
Declaration
[HideInInspector]
[NonSerialized]
public bool Batching
Field Value
| Type | Description |
|---|---|
| Boolean |
globalId
Number that increments on creation of a port.
Declaration
[HideInInspector]
[NonSerialized]
public static ulong globalId
Field Value
| Type | Description |
|---|---|
| UInt64 |
SignalBatch
Batch handler for this port.
Declaration
[HideInInspector]
[NonSerialized]
public IPortType.HandlerBatch SignalBatch
Field Value
| Type | Description |
|---|---|
| IPortType.HandlerBatch |
synchronizeAfterLinking
Whether this port needs special propagation before EnableNodes().
Declaration
[HideInInspector]
[NonSerialized]
public bool synchronizeAfterLinking
Field Value
| Type | Description |
|---|---|
| Boolean |
uniqueId
Unique ID for this port, hints the creation order, lower unique ID -> created first.
Declaration
[HideInInspector]
[NonSerialized]
public ulong uniqueId
Field Value
| Type | Description |
|---|---|
| UInt64 |
Properties
ChangeEvent
Callback to register for change events.
Declaration
public PortTypeClock.HandlerRisingEdge ChangeEvent { get; set; }
Property Value
| Type | Description |
|---|---|
| PortTypeClock.HandlerRisingEdge | The change event. |
Clock
Manages the change events on this port.
Declaration
public PortTypeClock Clock { get; set; }
Property Value
| Type | Description |
|---|---|
| PortTypeClock | The clock. |
Connected
This will only be true if the port has an incoming edge. Only access this field after Enable(), otherwise the value will be wrong.
Declaration
public bool Connected { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
|
Driver
Get the owner of this port.
Declaration
public object Driver { get; }
Property Value
| Type | Description |
|---|---|
| Object | The driver. |
Methods
BeginBatch()
Start batching signals to send.
Declaration
public virtual void BeginBatch()
CreateFieldBox()
Creates the field box.
Declaration
public virtual IFieldBox CreateFieldBox()
Returns
| Type | Description |
|---|---|
| IFieldBox | IFieldBox. |
EndBatch()
End a BeginBatch() and send the entire batch to listeners.
Declaration
public virtual void EndBatch()
Propagate(Double)
Propagate all signals
Declaration
public virtual void Propagate(double tickDelta = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Double | tickDelta | tick |
SetAsDriver(Object)
Set the owner of this port.
Declaration
public void SetAsDriver(object actAsDriver = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | actAsDriver | Owner object. |
SetConnected(Boolean)
Set the connection status for this port.
Declaration
public void SetConnected(bool connected)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | connected | Connection status |
SetOnChangeClockRisingEdge(Boolean)
Set the ports to callback on new data
Declaration
public virtual void SetOnChangeClockRisingEdge(bool actAsClock = true)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | actAsClock | if set to |
SetSynchronizeAfterLinking(Boolean)
Sets the synchronize after linking.
Declaration
public void SetSynchronizeAfterLinking(bool sync)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | sync | if set to |
Synchronize()
Synchronizes this instance.
Declaration
public virtual void Synchronize()
TryGetValue()
Try to get the value on this port.
Declaration
public virtual object TryGetValue()
Returns
| Type | Description |
|---|---|
| Object | Value on the port if it exists |
TrySetValue(Object)
Try to set a value on this port if it is allowed
Declaration
public virtual bool TrySetValue(object val)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | val | Value to set. |
Returns
| Type | Description |
|---|---|
| Boolean | True on success. |
TypeNiceName(Type)
Get the pretty name for a generic port type.
Declaration
public static string TypeNiceName(Type t)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | t | Type to get a pretty name for. |
Returns
| Type | Description |
|---|---|
| String | Pretty name for type t. |