|
|
Connects a source to one or more sinks.
void
init ( Source * source )
throw ( Exception ) | init |
[private]
Initialize the object.
Parameters:
source | the 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:
sink | the 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:
source | the 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:
source | the source to connect to the sinks. |
sink | a sink to connect to the source. |
Throws: Exception
Connector ( const Connector & connector )
throw ( Exception ) | Connector |
Copy constructor.
Parameters:
connector | the 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:
connector | the 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:
sink | the 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:
bytes | the amount of data to transfer, in bytes. If 0, transfer forever. |
bufSize | the 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. |
sec | the 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. |
usec | the 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