Spliting streams
Sometimes we wish to process some data in several ways, hence we wish to
split the data stream into several independent channels. We can do
this using the `Split' classes. This can be done on both input, with
DPSplitIC<> and output streams with DPSplitOC<>, Figures
8 and 9 show these respectively. There
are advantages in splitting an input stream as it allows each channel
to process data independently. If one channel runs faster than the
others the data will be read from the input and will be queued for processing
on all the other channels. Data is read from the input only when there
is no other data queue on the requesting channel.
Figure 8:Input split.
|
Figure 9:Output split.
|
Following is an example using the input split class. The input stream
is processed by two independant piplines, and the output is sent to
different files. Figure 10 shows the structure generated
by this code fragment. `DPEventSetC' will be explained later, in
Section Ravl.Core.Data_Processing.Events
DPEventSetC es ;
DPSplitIC<RealT> split;
es += DPIFileC<RealT>("in.dat") » split » DPOffsetScale(2.0,2.0)
» DPRunningAverage(1.0,5) »= DPOFileC<RealT>("out.dat");
es += split » DPOffsetScale(2.0,2.0) »=
DPOFileC<RealT> ("out2.dat");
es.Wait();
Figure 10:
Example of spliting an input.
|
Normal classes:
Normal functions: