public class PortInfo
extends java.lang.Object
Red (eal) |
Yellow (zgang) |
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
_eol
The value of the line.separator property.
|
Constructor and Description |
---|
PortInfo(IOPort port,
Ports ports,
NamedObj component,
PortDirector director)
Create a PortInfo instance.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
generateOffset(java.lang.String offset,
int channel,
boolean isWrite)
Generate the expression that represents the offset in the generated
code.
|
int |
getBufferSize()
Return the buffer size of the port, which is the maximum of
the bufferSizes of all channels the port.
|
int |
getBufferSize(int channelNumber)
Get the buffer size of channel of the port.
|
GenericCodeGenerator |
getCodeGenerator()
Return the code generator of the director.
|
java.lang.Object |
getReadOffset(int channelNumber)
Get the read offset of a channel of the port.
|
java.lang.Object |
getWriteOffset(int channelNumber)
Get the write offset of a channel of the port.
|
java.lang.String |
initializeOffsets()
Initialize the offsets.
|
void |
setBufferSize(int channelNumber,
int bufferSize)
Set the buffer size of channel of the port.
|
void |
setReadOffset(int channelNumber,
java.lang.Object readOffset)
Set the read offset of a channel of the port.
|
void |
setWriteOffset(int channelNumber,
java.lang.Object writeOffset)
Set the write offset of a channel of the port.
|
java.lang.String |
updateConnectedPortsOffset(int rate)
Update the offsets of the buffers associated with the ports connected
with the given port in its downstream.
|
java.lang.String |
updateOffset(int rate)
Update the read offset.
|
protected static final java.lang.String _eol
public PortInfo(IOPort port, Ports ports, NamedObj component, PortDirector director)
port
- The port for which we are doing
extra bookkeeping to generate code.ports
- The ports the portscomponent
- The component for which we are doing
extra bookkeeping to generate code.director
- The director associated with the ports.public GenericCodeGenerator getCodeGenerator()
public int getBufferSize(int channelNumber) throws IllegalActionException
channelNumber
- The number of the channel that is being set.IllegalActionException
- If thrown while getting
the channel or rate.setBufferSize(int, int)
public int getBufferSize() throws IllegalActionException
IllegalActionException
- If the
getBufferSize(int)
method throws it.setBufferSize(int, int)
public java.lang.String generateOffset(java.lang.String offset, int channel, boolean isWrite) throws IllegalActionException
offset
- The specified offset from the user.channel
- The referenced port channel.isWrite
- Whether to generate the write or read offset.IllegalActionException
- If there is problems getting the port
buffer size or the offset in the channel and offset map.public java.lang.Object getReadOffset(int channelNumber) throws IllegalActionException
channelNumber
- The number of the channel.IllegalActionException
- If thrown while getting the channel.setReadOffset(int, Object)
public java.lang.Object getWriteOffset(int channelNumber) throws IllegalActionException
channelNumber
- The number of the channel.IllegalActionException
- If thrown while getting the channel.setWriteOffset(int, Object)
public java.lang.String initializeOffsets() throws IllegalActionException
IllegalActionException
- Thrown if offsets can't be initialized.public void setBufferSize(int channelNumber, int bufferSize)
channelNumber
- The number of the channel that is being set.bufferSize
- The size of the buffer.getBufferSize(int)
public void setReadOffset(int channelNumber, java.lang.Object readOffset)
channelNumber
- The number of the channel that is being set.readOffset
- The offset.getReadOffset(int)
public void setWriteOffset(int channelNumber, java.lang.Object writeOffset)
channelNumber
- The number of the channel that is being set.writeOffset
- The offset.getWriteOffset(int)
public java.lang.String updateConnectedPortsOffset(int rate) throws IllegalActionException
rate
- The rate, which must be greater than or equal to 0.IllegalActionException
- If thrown while reading or writing
offsets, or getting the buffer size, or if the rate is less than 0.public java.lang.String updateOffset(int rate) throws IllegalActionException
rate
- The rate of the channels.IllegalActionException
- If thrown while getting a token,
adapter, read offset or buffer size.