t16_TransformObufStrmBufFmt.cpp File Reference

#include <string>
#include <vector>
#include <deque>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <functional>
#include <iterator>
#include <rpa/algorithms/transform.h>
#include <rpa/containers/row_iterator.h>
#include <rpa/istream_iterator_delimiter.h>
#include <complex>

Typedefs

typedef std::deque< rpa::thread_creaThrPoolT
typedef rpa::thread_tree<
ThrPoolT::iterator > 
ThrTreeT

Functions

template<class DataType>
static void PrepareStreams (size_t aCnt, const char *aDelim, std::istream &aStrm, std::vector< DataType > &aVecStr)
template<class DataType>
void DispDiff (const std::vector< DataType > &aSeq, const std::vector< DataType > &aPar)
 Displays the differences between two vectors.
template<class DataType>
void CmpStrmsSize (size_t aCnt, const char *aDelim, std::istream &aSeq, std::istream &aPar)
template<class DataType>
void CmpStrmsStep (size_t aCnt, const char *aDelim, std::istream &aSeq, std::istream &aPar)
 CmpStrmsSize.
template<class DataType>
void CmpStrmsJump (rpa::thr_nb_t aNbThr, size_t aCnt, const char *aDelim, std::istream &aSeq, std::istream &aPar)
 CmpStrmsStep.
static void TestIntg (std::ostream &aOStreamPattern, ThrTreeT &myThrTree)
 CmpStrmsJump.
static void TestDble (std::ostream &aOStreamPattern, ThrTreeT &myThrTree)
static void TestBool (std::ostream &aOStreamPattern, ThrTreeT &myThrTree)
static void TestCplx (std::ostream &aOStreamPattern, ThrTreeT &myThrTree)
int main (int aArgC, const char **aArgV)

Variables

static const rpa::thr_nb_t myNbThr = 4
 This is the maximum number of threads.

Typedef Documentation

typedef std::deque< rpa::thread_crea > ThrPoolT

The threads are stored in a double-ended queue, which is initialized with the right size. No other init is necessary.

typedef rpa::thread_tree< ThrPoolT::iterator > ThrTreeT

The unique threads tree that will be used in this test program. This program concentrates on formatting problems, not on performance or synchronization.


Function Documentation

template<class DataType>
void CmpStrmsJump ( rpa::thr_nb_t  aNbThr,
size_t  aCnt,
const char *  aDelim,
std::istream &  aSeq,
std::istream &  aPar 
)

CmpStrmsStep.

Receives two streams : Their contents must be identical except the interleaving due to interleave scheduling. Because the threads are 'fake', it is possible to predict what the order output order must be. The interleaving order, the alternance of elements, must be strictly respected with 'sequential' threads, because these threads process the interval range one after the other, in a predictible order. The delimiter is used to split the streams unambiguously.

Deserialize the content of streams into vectors, before comparing.

In the vector calculated with the standard sequential algorithm, we progress one element after the other. In the vector calculated with the interleaved scheduling, we increment of the number of threads.

template<class DataType>
void CmpStrmsSize ( size_t  aCnt,
const char *  aDelim,
std::istream &  aSeq,
std::istream &  aPar 
)

Receives two streams : Their contents must be identical : We use the static scheduling, with 'fake', i.e. sequential threads, so the vectors must be strictly identical.

template<class DataType>
void CmpStrmsStep ( size_t  aCnt,
const char *  aDelim,
std::istream &  aSeq,
std::istream &  aPar 
)

CmpStrmsSize.

Receives two streams : Their contents must be identical : We use the static scheduling, with 'fake', i.e. sequential threads, so the vectors must be strictly identical.

template<class DataType>
void DispDiff ( const std::vector< DataType > &  aSeq,
const std::vector< DataType > &  aPar 
)

Displays the differences between two vectors.

Displays the vectors line by line.

int main ( int  aArgC,
const char **  aArgV 
)

template<class DataType>
static void PrepareStreams ( size_t  aCnt,
const char *  aDelim,
std::istream &  aStrm,
std::vector< DataType > &  aVecStr 
) [static]

Transforms a stream into a vector of string, given a delimiter. The number of results is checked.

Just for speed-up, avoiding memory reallocations.

static void TestBool ( std::ostream &  aOStreamPattern,
ThrTreeT myThrTree 
) [static]

The output stream given as input parameter is used as a pattern whose formatting flags and locale must be used for these tests. All the flags are applied to our outputs, to check that the parallel and sequential resulrs are the same, whatever the formatting flags are.

We choose a delimiter which is compatible with the deserialization of integers. The delimiter must not be read by the istream, it must stay there to be read and checked.

Copies all formatting flags and locale information.

Copies all formatting flags and locale information.

The parallel algorithm executes a logical NOT and all the input booleans.

static void TestCplx ( std::ostream &  aOStreamPattern,
ThrTreeT myThrTree 
) [static]

The output stream given as input parameter is used as a pattern whose formatting flags and locale must be used for these tests. All the flags are applied to our outputs, to check that the parallel and sequential resulrs are the same, whatever the formatting flags are.

We choose a delimiter which is compatible with the deserialization of integers. The delimiter must not be read by the istream, it must stay there to be read and checked. In other words, white spaces should not be eaten, if the delimiter contains at least one of them.

Copies all formatting flags and locale information.

Copies all formatting flags and locale information.

static void TestDble ( std::ostream &  aOStreamPattern,
ThrTreeT myThrTree 
) [static]

The output stream given as input parameter is used as a pattern whose formatting flags and locale must be used for these tests. All the flags are applied to our outputs, to check that the parallel and sequential resulrs are the same, whatever the formatting flags are.

The results of the execution of the sequential and parallel algorithms are written into two distinct stringstreams, which are later compared.

We choose a delimiter which is compatible with the deserialization of integers. The delimiter must not be read by the istream, it must stay there to be read and checked.

Copies all formatting flags and locale information.

Copies all formatting flags and locale information.

static void TestIntg ( std::ostream &  aOStreamPattern,
ThrTreeT myThrTree 
) [static]

CmpStrmsJump.

The output stream given as input parameter is used as a pattern whose formatting flags and locale must be used for these tests. All the flags are applied to our outputs, to check that the parallel and sequential resulrs are the same, whatever the formatting flags are.

Notes that octal conversion formatting do not work with negative integer numbers. Hence they are all positive.

We choose a delimiter which is compatible with the deserialization of integers. The delimiter must not be read by the istream, it must stay there to be read and checked.

Copies all formatting flags and locale information.

Uses the plain standard algorithm, for later comparison.

This is the output stream type.

Copies all formatting flags and locale information.


Variable Documentation

const rpa::thr_nb_t myNbThr = 4 [static]

This is the maximum number of threads.

A class which works like a std::istream_iterator, plus a delimiter, just like a std::ostream_iterator.


Generated on Tue Sep 25 10:20:31 2007 for rpa by  doxygen 1.4.7