Class PortType<T>
Generic port type to simplify port creation.
Inherited Members
Namespace: Mechatronics.SystemGraph
Syntax
[Serializable]
public class PortType<T> : IPortType
Type Parameters
| Name | Description |
|---|---|
| T | Data type underlying the port. |
Constructors
PortType()
Creates the port and sets the exposed type.
Declaration
public PortType()
PortType(T)
Creates a port with default value.
Declaration
public PortType(T value)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | Default value for the data. |
Fields
Data
The data field
Declaration
[SerializeField]
protected T Data
Field Value
| Type | Description |
|---|---|
| T |
Properties
Read
Read filtered data from the port.
Declaration
public virtual T Read { get; }
Property Value
| Type | Description |
|---|---|
| T | The read. |
ReadRaw
Read unfiltered data from the port.
Declaration
public T ReadRaw { get; }
Property Value
| Type | Description |
|---|---|
| T | The read raw. |
Write
Write to the port and propagate to change event handlers and port filters.
Declaration
public T Write { set; }
Property Value
| Type | Description |
|---|---|
| T | The write. |
WriteRaw
Write without port filters of change events.
Declaration
public T WriteRaw { set; }
Property Value
| Type | Description |
|---|---|
| T | The write raw. |
Methods
CopyFrom(PortType<T>)
Copies from.
Declaration
protected virtual void CopyFrom(PortType<T> port)
Parameters
| Type | Name | Description |
|---|---|---|
| PortType<T> | port | The port. |
CreateFieldBox()
Creates the field box.
Declaration
public override IFieldBox CreateFieldBox()
Returns
| Type | Description |
|---|---|
| IFieldBox | IFieldBox. |
Overrides
Propagate(Double)
Propagate all signals
Declaration
public override void Propagate(double tickDelta = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Double | tickDelta | tick |
Overrides
Ref()
Get a reference to the underlying data. Propagates change events.
Declaration
public ref T Ref()
Returns
| Type | Description |
|---|---|
| T | Reference value as T. |
SetOnChangeClockRisingEdge(Boolean)
Set the ports to callback on new data
Declaration
public override void SetOnChangeClockRisingEdge(bool actAsClock = true)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | actAsClock | if set to |
Overrides
Synchronize()
Synchronizes this instance.
Declaration
public override void Synchronize()
Overrides
ToString()
Converts the port data into a string.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| String | The string if the port is connected. Otherwise, returns null. |
Overrides
TryGetValue()
Try to get the value on this port.
Declaration
public override object TryGetValue()
Returns
| Type | Description |
|---|---|
| Object | Value on the port if it exists |
Overrides
TrySetValue(Object)
Try to set a value on this port if it is allowed
Declaration
public override bool TrySetValue(object val)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | val | Value to set. |
Returns
| Type | Description |
|---|---|
| Boolean | True on success. |