sxPort Class Reference

Connection port (terminal). More...

#include <sxPort.h>

Inheritance diagram for sxPort:

sxCaptionItem sxObject sxInPort sxOutPort sxUiInPort sxUiOutPort

List of all members.

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 sxPacketRead ()
 read data
virtual sxConnectionMakeConnection (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 sxConnectionConnection (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
sxComponentComponent () 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 sxPortfindPort (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.


Detailed Description

Connection port (terminal).

Member Enumeration Documentation

Enumerator:
Input  input port
Output  output port


Constructor & Destructor Documentation

sxPort::sxPort ( const QString &  nm,
sxComponent comp,
Direction  dir 
) [protected]

Construct port with given name and parent component.

Parameters:
nm name of the port
comp parent component
typ port type (input/output)


Member Function Documentation

sxPort * sxPort::findPort ( const QList< sxPort * > &  portList,
const QString &  sid 
) [static]

Search port with given identifier.

Parameters:
portList list of ports
sid port identifier to be search
Returns:
pointer to sxPort if found, otherwise 0

References PortId().

Referenced by sxConnection::Load(), and sxComponent::Load().

bool sxPort::IsConnected (  )  const

Get connection info.

Returns:
true if connected.

References Connection().

bool sxPort::IsInput (  )  const

Check if this port is input port.

Returns:
true for sxInPort

References Input.

Referenced by sxComponent::AddPort(), sxOutPort::IsConnectable(), Save(), and sxConnection::SetPort().

bool sxPort::IsOutput (  )  const

Check if this port is output port.

Returns:
true for sxOutPort

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).

Parameters:
portNode port element
See also:
Save()

References sxCaptionItem::SetCaption(), and SetPortId().

Referenced by sxNetwork::Load().

sxConnection * sxPort::MakeConnection ( sxPort with,
const QString &  name 
) [virtual]

Create new connection with given port.

Parameters:
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>
Parameters:
portsNode parent node of 'port', e.g. <ports>
See also:
Load()

References sxCaptionItem::Caption(), IsInput(), IsOutput(), and PortId().

Referenced by sxNetwork::Save().

void sxPort::SetComponent ( sxComponent comp  ) 

Set owner/parent component.

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

Parameters:
id identifier (usually address of this)
See also:
SetPortId(const QString&)

void sxPort::SetPortId ( const QString &  pid  )  [protected]

Port identifier for save/loading.

Parameters:
pid string representation of the port id.
See also:
SetPortId(quintptr)

Referenced by Load(), sxInPort::sxInPort(), sxOutPort::sxOutPort(), and UpdatePortId().

void sxPort::UpdatePortId (  ) 

Recreate port identifier by assigned this pointer address.

See also:
SetPortId(quintptr)

References sxCaptionItem::Caption(), and SetPortId().


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