#include <processorport.h>
Collaboration diagram for Geddei::ProcessorPort:
Public Member Functions | |
void | connect (MultiProcessor &input) const |
void | connect (const ProcessorPort &input) const |
void | disconnect () const |
void | operator-- (int) const |
void | operator>>= (MultiProcessor &input) const |
void | operator>>= (const ProcessorPort &input) const |
ProcessorPort & | setSize (const uint bufferSize) |
void | share () const |
void | split () const |
Friends | |
class | Processor |
This is a convenience class meant primarily as an adjunct to the Processor class to allow subscripting (['s and ]'s) to be used to manage connections.
See the operators and methods for more information about general use.
void Geddei::ProcessorPort::connect | ( | const ProcessorPort & | input | ) | const |
Assert that this port represents an output port, and create a connection between it and input (asserted as an input port).
Example, given P and Q are Processor subclass objects, P with two output ports and Q with two input ports:
P[0].connect(Q[0]); P[1].connect(Q[1]);
input | ProcessorPort object which, it is asserted describes an input port. |
void Geddei::ProcessorPort::disconnect | ( | ) | const |
void Geddei::ProcessorPort::operator-- | ( | int | ) | const [inline] |
Shorthand operator for disconnecting. Does the same as the disconnect() method.
Example, given P and Q are Processor subclass objects:
P[0].connect(Q[0]);
// Do some processing...
P[0]--;
void Geddei::ProcessorPort::operator>>= | ( | MultiProcessor & | input | ) | const [inline] |
Shorthand operator for connecting to a multiprocessor. Does the same as the connect() method. This will share the stream and connect each to the MultiProcessor's inputs. The MultiProcessor must already know its multiplicity.
This port must not already be connected, split or shared.
Example, given P is a Processor subclass object, Q is a MultiProcessor:
P[0] >>= Q;
// Do some processing...
P[0].disconnect();
input | MultiProcessor object. |
void Geddei::ProcessorPort::operator>>= | ( | const ProcessorPort & | input | ) | const [inline] |
Shorthand operator for connecting. Does the same as the connect() method.
Example, given P and Q are Processor subclass objects:
P[0] >>= Q[0];
// Do some processing...
P[0].disconnect();
input | ProcessorPort object which, it is asserted describes an input port. |
ProcessorPort & Geddei::ProcessorPort::setSize | ( | const uint | bufferSize | ) |
Set a minimum size for the buffer (in elements).
This method rarely needs to be used. It is generally considered the job of the Processor subclass to determine how much buffer space if needed, however this method may be used in some extreme cases to tweak buffer usage in the case that a particular amount of high-speed memory is available.
Ignore this otherwise.
bufferSize | The minimum number of elements to be used for this connection's buffer. |
void Geddei::ProcessorPort::share | ( | ) | const |
Share the output of a Processor object.
See Processor::share() for more details.
Example, given P, Q, R are Processor subclass objects:
// Share the first output port of P P[0].share(); // Connect the first output port of P to the first input port of Q P[0].connect(Q[0]); // Connect the same output to the second port of Q P[0].connect(Q[1]); // Connect the same output to the first port of R P[0].connect(R[0]);
void Geddei::ProcessorPort::split | ( | ) | const |
Split the output of a Processor object.
See Processor::split() for more details.
Example, given P, Q are Processor subclass objects:
// Share the first output port of P P[0].split(); // Connect the first output port of P to the first input port of Q P[0].connect(Q[0]); // Connect the same output to the second port of Q P[0].connect(Q[1]); // Connect the same output to the first input of some remote Processor P.connect(0, someRemoteHost, someRemoteKey, someProcessorsName, 0);