UnionNumberStream Class Reference

Unions multiple number streams from 1 . More...

#include <LbmExecStreamTestBase.h>

Inheritance diagram for UnionNumberStream:

NumberStream List of all members.

Public Member Functions

 UnionNumberStream ()
virtual ~UnionNumberStream ()
void addChild (SharedNumberStream pStream)
NumberStreamclone ()
uint getMaxRowCount (uint maxRid)
bool hasNext ()
uint getNext ()

Static Public Attributes

static const uint BIG_NUMBER = 0xffffffff

Private Member Functions

bool findNext ()

Private Attributes

std::vector< SharedNumberStreamchildren
VectorOfUint currentValues
uint prev
uint next

Detailed Description

Unions multiple number streams from 1 .

.. BIG_NUMBER-1

Definition at line 157 of file LbmExecStreamTestBase.h.


Constructor & Destructor Documentation

UnionNumberStream::UnionNumberStream (  )  [inline]

Definition at line 186 of file LbmExecStreamTestBase.h.

References NumberStream::BIG_NUMBER, next, and prev.

Referenced by clone().

00187     {
00188         prev = 0;
00189         next = BIG_NUMBER;
00190     }

virtual UnionNumberStream::~UnionNumberStream (  )  [inline, virtual]

Definition at line 192 of file LbmExecStreamTestBase.h.

00193     {}


Member Function Documentation

bool UnionNumberStream::findNext (  )  [inline, private]

Definition at line 163 of file LbmExecStreamTestBase.h.

References NumberStream::BIG_NUMBER, children, currentValues, hasNext(), next, and prev.

Referenced by getNext(), and hasNext().

00164     {
00165         if (next != BIG_NUMBER) {
00166             return true;
00167         }
00168         // scan to values greater than prev
00169         for (uint i = 0; i < children.size(); i++) {
00170             if (currentValues[i] <= prev) {
00171                 if (children[i]->hasNext()) {
00172                     currentValues[i] = children[i]->getNext();
00173                 }
00174             }
00175         }
00176         // search for lowest value greater than prev
00177         for (uint i = 0; i < children.size(); i++) {
00178             if (currentValues[i] > prev && currentValues[i] < next) {
00179                 next = currentValues[i];
00180             }
00181         }
00182         return next != BIG_NUMBER;
00183     }

void UnionNumberStream::addChild ( SharedNumberStream  pStream  )  [inline]

Definition at line 195 of file LbmExecStreamTestBase.h.

References children, and currentValues.

Referenced by clone(), and LbmUnionExecStreamTest::testUnion().

00196     {
00197         children.push_back(pStream);
00198         currentValues.push_back(0);
00199     }

NumberStream* UnionNumberStream::clone (  )  [inline, virtual]

Implements NumberStream.

Definition at line 201 of file LbmExecStreamTestBase.h.

References addChild(), children, and UnionNumberStream().

00202     {
00203         UnionNumberStream *pStream = new UnionNumberStream();
00204         for (uint i = 0; i < children.size(); i++) {
00205             SharedNumberStream pChild(children[i]->clone());
00206             pStream->addChild(pChild);
00207         }
00208         return pStream;
00209     }

uint UnionNumberStream::getMaxRowCount ( uint  maxRid  )  [inline, virtual]

Implements NumberStream.

Definition at line 211 of file LbmExecStreamTestBase.h.

References children.

00212     {
00213         uint total = 0;
00214         for (uint i = 0; i < children.size(); i++) {
00215             total += children[i]->getMaxRowCount(maxRid);
00216         }
00217         return total;
00218     }

bool UnionNumberStream::hasNext (  )  [inline, virtual]

Implements NumberStream.

Definition at line 220 of file LbmExecStreamTestBase.h.

References findNext().

Referenced by findNext(), and getNext().

00221     {
00222         return findNext();
00223     }

uint UnionNumberStream::getNext (  )  [inline, virtual]

Implements NumberStream.

Definition at line 225 of file LbmExecStreamTestBase.h.

References NumberStream::BIG_NUMBER, findNext(), hasNext(), next, and prev.

00226     {
00227         bool hasNext = findNext();
00228         assert(hasNext);
00229         prev = next;
00230         next = BIG_NUMBER;
00231         return prev;
00232     }


Member Data Documentation

std::vector<SharedNumberStream> UnionNumberStream::children [private]

Definition at line 159 of file LbmExecStreamTestBase.h.

Referenced by addChild(), clone(), findNext(), and getMaxRowCount().

VectorOfUint UnionNumberStream::currentValues [private]

Definition at line 160 of file LbmExecStreamTestBase.h.

Referenced by addChild(), and findNext().

uint UnionNumberStream::prev [private]

Definition at line 161 of file LbmExecStreamTestBase.h.

Referenced by findNext(), getNext(), and UnionNumberStream().

uint UnionNumberStream::next [private]

Definition at line 161 of file LbmExecStreamTestBase.h.

Referenced by findNext(), getNext(), and UnionNumberStream().

const uint NumberStream::BIG_NUMBER = 0xffffffff [static, inherited]

Definition at line 98 of file LbmExecStreamTestBase.h.

Referenced by findNext(), getNext(), LbmExecStreamTestBase::initBitmapInput(), and UnionNumberStream().


The documentation for this class was generated from the following file:
Generated on Mon Jun 22 04:00:48 2009 for Fennel by  doxygen 1.5.1