class Connector

Connects a source to one or more sinks. More...

Definition#include <Connector.h>
InheritsReferable [public virtual ], Reporter [public virtual ]
Inherited byMultiThreadedConnector
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Protected Methods

Protected Members

Private Methods


Detailed Description

Connects a source to one or more sinks.

void  init ( Source * source )
throw ( Exception )

init

[private]

Initialize the object.

Parameters:
sourcethe source to read from.

Throws: Exception

void  strip ( void )
throw ( Exception )

strip

[private]

De-initialize the object.

Throws: Exception

Ref<Source> source

source

[protected]

Ref<Sink> * sinks

sinks

[protected]

unsigned int numSinks

numSinks

[protected]

inline  Connector ( void )
throw ( Exception )

Connector

[protected]

Default constructor. Always throws an Exception.

Throws: Exception

bool  detach ( Sink * sink )
throw ( Exception )

detach

[protected virtual]

Detach an already attached Sink from the Source of this Connector.

Parameters:
sinkthe Sink to detach.

Returns: true if the detachment was successful, false otherwise.

Throws: Exception

inline  Connector ( Source * source )
throw ( Exception )

Connector

Constructor based on a Source.

Parameters:
sourcethe source to connect to the sinks.

Throws: Exception

inline  Connector ( Source * source, Sink * sink )
throw ( Exception )

Connector

Constructor based on a Source and a Sink.

Parameters:
sourcethe source to connect to the sinks.
sinka sink to connect to the source.

Throws: Exception

 Connector ( const Connector & connector )
throw ( Exception )

Connector

Copy constructor.

Parameters:
connectorthe object to copy.

Throws: Exception

inline  ~Connector ( void )
throw ( Exception )

~Connector

[virtual]

Destructor.

Throws: Exception

Connector &  operator= ( const Connector & connector )
throw ( Exception )

operator=

[virtual]

Assignment operator.

Parameters:
connectorthe object to assign to this one.

Returns: a reference to this object.

Throws: Exception

inline unsigned int  getNumSinks ( void )
throw ()

getNumSinks

[const virtual]

Get the number of Sinks in the Connector.

Returns: the number of Sinks in the Connector.

Throws: Exception

void  attach ( Sink * sink )
throw ( Exception )

attach

[virtual]

Attach a Sink to the Source of this Connector.

Parameters:
sinkthe Sink to attach.

Throws: Exception

bool  open ( void )
throw ( Exception )

open

[virtual]

Open the connector. Opens the Source and the Sinks if necessary.

Returns: true if opening was successful, false otherwise.

Throws: Exception

unsigned int  transfer ( unsigned long bytes, unsigned int bufSize, unsigned int sec, unsigned int usec )
throw ( Exception )

transfer

[virtual]

Transfer a given amount of data from the Source to all the Sinks attached. If an attached Sink closes or encounteres an error during the process, it is detached and the function carries on with the rest of the Sinks. If no Sinks remain, or an error is encountered with the Source, the function returns prematurely.

Parameters:
bytesthe amount of data to transfer, in bytes. If 0, transfer forever.
bufSizethe size of the buffer to use for transfering. This amount of data is read from the Source and written to each Sink on each turn.
secthe number of seconds to wait for the Source to have data available in each turn, and the number of seconds to wait for the Sinks to accept data.
usecthe number of micro seconds to wait for the Source to have data available in each turn, and the number of micro seconds to wait for the Sinks to accept data.

Returns: the number of bytes read from the Source.

Throws: Exception

void  close ( void )
throw ( Exception )

close

[virtual]

Close the Connector. The Source and all Sinks are closed.

Throws: Exception