Inheritance diagram for csp::common::ExtMerger< DATA_TYPE >:
The Merger process waits for input on one of its channels, and then sends it out on its output channel as part of an extended input (finishing the extended input once the output has completed). The waiting for input is done fairly (using Alternative::fairSelect()) so starvation will not occur.
If you can alter that part of your application, you may want to consider using Any2OneChannel or BufferedAny2OneChannel. The former has exactly the same effect as multiple One2OneChannel joined together with this process. That is, this:
One2OneChannel<int> c,d,e; Run(InParallel (new Widget(c.writer())) (new Widget(d.writer())) (new ExtMerger<int>(c.reader(),d.reader(),e.writer())) (new OtherWidget(e.reader())) );
Any2OneChannel<int> c(factory); Run(InParallel (new Widget(c.writer())) (new Widget(c.writer())) (new OtherWidget(c.reader())) );
Public Member Functions | |
template<typename ITERATOR> | |
ExtMerger (ITERATOR _begin, ITERATOR _end, const Chanout< DATA_TYPE > &_out) | |
Constructs the process using input channels defined by an iterator range. | |
ExtMerger (const std::vector< AltChanin< DATA_TYPE > > &_in, const Chanout< DATA_TYPE > &_out) | |
Constructs the process using the given std::vector of input channels. | |
ExtMerger (const AltChanin< DATA_TYPE > &_in0, const AltChanin< DATA_TYPE > &_in1, const Chanout< DATA_TYPE > &_out) | |
Constructs the process with two input channels (a constructor for convenience). | |
Protected Member Functions | |
void | run () |
You must implement this function to provide the code for your process. |
csp::common::ExtMerger< DATA_TYPE >::ExtMerger | ( | const AltChanin< DATA_TYPE > & | _in0, | |
const AltChanin< DATA_TYPE > & | _in1, | |||
const Chanout< DATA_TYPE > & | _out | |||
) | [inline] |
Constructs the process with two input channels (a constructor for convenience).
_in0 | One of the input channels | |
_in1 | The other input channel | |
_out | The output channel |
csp::common::ExtMerger< DATA_TYPE >::ExtMerger | ( | const std::vector< AltChanin< DATA_TYPE > > & | _in, | |
const Chanout< DATA_TYPE > & | _out | |||
) | [inline] |
Constructs the process using the given std::vector of input channels.
To use other collection classes, use the other constructor that takes iterators as parameters.
_in | The vector of input channels | |
_out | The output channel |
csp::common::ExtMerger< DATA_TYPE >::ExtMerger | ( | ITERATOR | _begin, | |
ITERATOR | _end, | |||
const Chanout< DATA_TYPE > & | _out | |||
) | [inline] |
Constructs the process using input channels defined by an iterator range.
The iterators should be iterators over a collection of AltChanin<DATA_TYPE>. They will be passed to the constructor of std::vector< AltChanin<DATA_TYPE> > so they must meet the requirements for that; all the values from *_begin up to (but not including) *_end will be added to the list of input channels
_begin | The iterator of the first channel input-end to add | |
_end | The iterator beyond the last channel input-end to add | |
_out | The output channel |
void csp::common::ExtMerger< DATA_TYPE >::run | ( | ) | [inline, protected, virtual] |
You must implement this function to provide the code for your process.
When the run method finishes, the process will terminate.
You should not let an uncaught exception cause the end of this function. If it derives from std::exception, it will be caught (although this behaviour should not be relied upon) but otherwise undefined behaviour will result.
Implements csp::ThreadCSProcess.