sxConnection Class Reference

Connection interface. More...

#include <sxConnection.h>

Inheritance diagram for sxConnection:

sxCaptionItem sxObject sxUiConnection

List of all members.

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.
sxPortOtherPort (sxPort *theP) const
 Get the pointer to the other port.
sxOutPortSource () const
 Source port.
sxInPortDestination () 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)


Detailed Description

Connection interface.

Constructor & Destructor Documentation

sxConnection::sxConnection ( const QString &  cap = QString(),
sxPort p1 = 0,
sxPort p2 = 0 
)

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.

Parameters:
cap caption of the connection
p1 source/destination port
p2 source/destination port
See also:
Connect()

References Connect(), SetConnectionId(), and SetPort().


Member Function Documentation

bool sxConnection::Connect ( sxPort p1,
sxPort p2 
)

Make connection for port p1 and p2.

If succeeded, destination's channel count will be set to source's channel count.

Parameters:
p1 first port, could be in/out
p2 second port, could be in/out but must not have same type with p1
See also:
Connect(), SetPort(), sxPort::SetChannelCount()

References sxPort::AddConnection(), sxPort::IsConnectable(), and SetPort().

bool sxConnection::Connect (  ) 

Make connection.

This assumed that both port already assigned.

Returns:
true if port successfully connected.
See also:
Connect(sxPort *, sxPort *)

References IsFloating().

Referenced by Load(), and sxConnection().

sxInPort * sxConnection::Destination (  )  const

void sxConnection::Disconnect (  ) 

Remove connection.

Link to destionation and source is removed, link from each port also removed.

See also:
RemovePorts(), sxPort::RemoveConnection(sxConnection *)

Referenced by Load().

bool sxConnection::IsConnected (  )  const

Check whether this connection has terminal(port)/not.

Returns:
True only when both source and destination is valid

bool sxConnection::Load ( const QDomElement &  conNode,
const QList< sxPort * > &  portList 
)

Load connection information from xml structure.

Parameters:
conNode connection element (tag name = connection)
portList list of ports for whole design file
Returns:
true if succeeded
See also:
Connect(), Connect(sxPort *, sxPort *)

References Connect(), Disconnect(), sxPort::findPort(), and sxCaptionItem::SetCaption().

Referenced by sxNetwork::Load().

sxPort * sxConnection::OtherPort ( sxPort theP  )  const

Get the pointer to the other port.

Parameters:
theP one side port
Returns:
address to the other side of port.

Referenced by sxOutPort::~sxOutPort().

void sxConnection::RemovePorts (  ) 

Set source and destionation to NULL.

Memory is not deleted.

See also:
Disconnect()

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>
Parameters:
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.

Parameters:
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.

Parameters:
p port to be assigned

References sxPort::IsInput(), and sxPort::IsOutput().

Referenced by Connect(), and sxConnection().

sxOutPort * sxConnection::Source (  )  const

Source port.

See also:
Destination

Referenced by sxUiView::mousePressEvent().


The documentation for this class was generated from the following files:

Generated on Wed Dec 17 19:30:47 2008 for xBCI API by  doxygen 1.5.7.1