#include <sxConnection.h>
Classes | |
class | PrivateData |
Public Member Functions | |
sxConnection (const QString &cap=QString(), sxPort *p1=0, sxPort *p2=0) | |
Construct connection object with. | |
QString | ConnectionId () const |
This connection id. | |
bool | IsFloating () const |
return true of not connecting port | |
bool | IsConnected () const |
Check whether this connection has terminal(port)/not. | |
sxPort * | OtherPort (sxPort *theP) const |
Get the pointer to the other port. | |
sxOutPort * | Source () const |
Source port. | |
sxInPort * | Destination () const |
Destination port. | |
void | SetPort (sxPort *p) |
Assign port to this connection. | |
bool | Connect () |
Make connection. | |
bool | Connect (sxPort *p1, sxPort *p2) |
Make connection for port p1 and p2. | |
void | Disconnect () |
Remove connection. | |
void | RemovePorts () |
Set source and destionation to NULL. | |
bool | Save (QDomElement &consNode) |
Save the connection to xml file. | |
bool | Load (const QDomElement &conNode, const QList< sxPort * > &portList) |
Load connection information from xml structure. | |
Protected Member Functions | |
void | SetConnectionId (quintptr id) |
Set connection identifier. | |
virtual bool | SaveGui (QDomElement &conNode) |
virtual bool | LoadGui (const QDomElement &conNode) |
Construct connection object with.
Default parameters are null string and ports. If valid port address is given as the parameter, both port will be connected. Port parameter must be in and out port.
cap | caption of the connection | |
p1 | source/destination port | |
p2 | source/destination port |
References Connect(), SetConnectionId(), and SetPort().
Make connection for port p1 and p2.
If succeeded, destination's channel count will be set to source's channel count.
p1 | first port, could be in/out | |
p2 | second port, could be in/out but must not have same type with p1 |
References sxPort::AddConnection(), sxPort::IsConnectable(), and SetPort().
bool sxConnection::Connect | ( | ) |
Make connection.
This assumed that both port already assigned.
References IsFloating().
Referenced by Load(), and sxConnection().
sxInPort * sxConnection::Destination | ( | ) | const |
Destination port.
Referenced by sxOutPort::Clear(), sxOutPort::Close(), sxComponent::DownstreamComponents(), sxUiView::mousePressEvent(), sxOutPort::Open(), and sxOutPort::Write().
void sxConnection::Disconnect | ( | ) |
Remove connection.
Link to destionation and source is removed, link from each port also removed.
Referenced by Load().
bool sxConnection::IsConnected | ( | ) | const |
Check whether this connection has terminal(port)/not.
bool sxConnection::Load | ( | const QDomElement & | conNode, | |
const QList< sxPort * > & | portList | |||
) |
Load connection information from xml structure.
conNode | connection element (tag name = connection) | |
portList | list of ports for whole design file |
References Connect(), Disconnect(), sxPort::findPort(), and sxCaptionItem::SetCaption().
Referenced by sxNetwork::Load().
Get the pointer to the other port.
theP | one side port |
Referenced by sxOutPort::~sxOutPort().
void sxConnection::RemovePorts | ( | ) |
Set source and destionation to NULL.
Memory is not deleted.
Referenced by sxOutPort::~sxOutPort().
bool sxConnection::Save | ( | QDomElement & | consNode | ) |
Save the connection to xml file.
This function will generete Xml structure:
<connection id="idididid"> <caption>text</caption> <source id="ididid"> <destination id="ididid"> <gui> ... </gui> </connection>
consNode | - parent of '<connection>' node, e.g. '<connections>' |
References sxCaptionItem::Caption(), ConnectionId(), and IsFloating().
Referenced by sxNetwork::Save().
void sxConnection::SetConnectionId | ( | quintptr | id | ) | [protected] |
Set connection identifier.
This identifier is used to identify which connection connected to which port insided design file. The id will be assigned automatically (the address of this) when saving to design file.
id | 32-bit/64-bit unsigned integer, depend on platform |
Referenced by sxConnection().
void sxConnection::SetPort | ( | sxPort * | p | ) |
Assign port to this connection.
If given port is an input port, it will be assigned to source, otherwise it will be assigned to destination.
p | port to be assigned |
References sxPort::IsInput(), and sxPort::IsOutput().
Referenced by Connect(), and sxConnection().
sxOutPort * sxConnection::Source | ( | ) | const |