#include <sxPort.h>
Classes | |
class | PrivateData |
Public Types | |
enum | Direction { Input = 0x01, Output = 0x02 } |
Public Member Functions | |
virtual bool | Open () |
Open port. | |
virtual bool | Close () |
Close Port For input port, drop the data buffer. | |
virtual sxPacket * | Read () |
read data | |
virtual sxConnection * | MakeConnection (sxPort *with, const QString &name) |
Create new connection with given port. | |
virtual void | Clear ()=0 |
virtual void | Write (sxPacket *packet)=0 |
Write packet. | |
virtual void | RemoveConnection (sxConnection *con)=0 |
remove given connection from port, memory not freed | |
virtual void | AddConnection (sxConnection *con)=0 |
add new connection | |
virtual sxConnection * | Connection (unsigned int idx=0) const =0 |
get connection at given index | |
virtual bool | IsConnectable (sxPort *p=0) const =0 |
return true if this port is connectable to p | |
sxComponent * | Component () const |
Get owner/parent of this port. | |
void | SetComponent (sxComponent *comp) |
Set owner/parent component. | |
QString | PortId () const |
Get unique identifier assigned to this port. | |
void | UpdatePortId () |
Recreate port identifier by assigned this pointer address. | |
bool | IsOutput () const |
Check if this port is output port. | |
bool | IsInput () const |
Check if this port is input port. | |
bool | IsConnected () const |
Get connection info. | |
bool | IsOpen () const |
Get port open status. | |
bool | Save (QDomElement &portsNode) |
Save this port to design file. | |
bool | Load (const QDomElement &portNode) |
Load port info from design file (xml). | |
Static Public Member Functions | |
static sxPort * | findPort (const QList< sxPort * > &portList, const QString &sid) |
Search port with given identifier. | |
Protected Member Functions | |
virtual bool | SaveCustom (QDomElement &portNode) |
virtual bool | LoadCustom (const QDomElement &portNode) |
virtual bool | SaveGui (QDomElement &portNode) |
virtual bool | LoadGui (const QDomElement &portNode) |
sxPort (const QString &nm, sxComponent *comp, Direction dir) | |
Construct port with given name and parent component. | |
void | SetPortId (const QString &str) |
Port identifier for save/loading. | |
void | SetPortId (quintptr id) |
Set port id for save/loading. |
enum sxPort::Direction |
sxPort::sxPort | ( | const QString & | nm, | |
sxComponent * | comp, | |||
Direction | dir | |||
) | [protected] |
Construct port with given name and parent component.
nm | name of the port | |
comp | parent component | |
typ | port type (input/output) |
Search port with given identifier.
portList | list of ports | |
sid | port identifier to be search |
References PortId().
Referenced by sxConnection::Load(), and sxComponent::Load().
bool sxPort::IsConnected | ( | ) | const |
bool sxPort::IsInput | ( | ) | const |
Check if this port is input port.
References Input.
Referenced by sxComponent::AddPort(), sxOutPort::IsConnectable(), Save(), and sxConnection::SetPort().
bool sxPort::IsOutput | ( | ) | const |
Check if this port is output port.
References Output.
Referenced by sxComponent::AddPort(), sxInPort::IsConnectable(), Save(), and sxConnection::SetPort().
bool sxPort::Load | ( | const QDomElement & | portNode | ) |
Load port info from design file (xml).
portNode | port element |
References sxCaptionItem::SetCaption(), and SetPortId().
Referenced by sxNetwork::Load().
sxConnection * sxPort::MakeConnection | ( | sxPort * | with, | |
const QString & | name | |||
) | [virtual] |
Create new connection with given port.
with | source/target port | |
name | connection name |
Reimplemented in sxUiInPort, and sxUiOutPort.
References IsConnectable().
bool sxPort::Open | ( | ) | [virtual] |
Open port.
For output port, propagate type and set channel count of connected port.
Reimplemented in sxInPort, and sxOutPort.
Referenced by sxInPort::Open().
bool sxPort::Save | ( | QDomElement & | portsNode | ) |
Save this port to design file.
This method will generate xml structure as bellows:
<port id="ididid"> <caption>caption</caption> <channel-count>nnn</channel-count> <buffer-type>nnn</buffer-type> ... custom data ... </port>
portsNode | parent node of 'port', e.g. <ports> |
References sxCaptionItem::Caption(), IsInput(), IsOutput(), and PortId().
Referenced by sxNetwork::Save().
void sxPort::SetComponent | ( | sxComponent * | comp | ) |
Set owner/parent component.
comp | pointer to sxComponent |
Referenced by sxComponent::AddInputPort(), sxComponent::AddOutputPort(), and sxComponent::Load().
void sxPort::SetPortId | ( | quintptr | id | ) | [protected] |
Set port id for save/loading.
id | identifier (usually address of this) |
void sxPort::SetPortId | ( | const QString & | pid | ) | [protected] |
Port identifier for save/loading.
pid | string representation of the port id. |
Referenced by Load(), sxInPort::sxInPort(), sxOutPort::sxOutPort(), and UpdatePortId().
void sxPort::UpdatePortId | ( | ) |
Recreate port identifier by assigned this pointer address.
References sxCaptionItem::Caption(), and SetPortId().