OrbazTrueBlockEnumerator Class Reference
 
 
 
OrbazTrueBlockEnumerator Class Reference

#include <IParticleChannelTrueFalseIterator.h>

Inheritance diagram for OrbazTrueBlockEnumerator:
BitArrayCallback MaxHeapOperators

Public Member Functions

  OrbazTrueBlockEnumerator (OrbazTrueBlock *&trueBlocks)
virtual void  proc (int n)
int  NumBlocksSet (void)
OrbazTrueBlockEnumerator operator= (const OrbazTrueBlockEnumerator &rhs)

Constructor & Destructor Documentation

OrbazTrueBlockEnumerator ( OrbazTrueBlock *&  trueBlocks ) [inline]
                : m_trueBlocks(trueBlocks)
                , m_blockIndex(-1)
        {
        }

Member Function Documentation

virtual void proc ( int  n ) [inline, virtual]
Remarks:
This method is called for each "1" in the BitArray.
Parameters:
int n

This is the zero based index into the BitArray of the element which is "1".

Implements BitArrayCallback.

        {
                int curMajorIndex = n & kMajorIndexMask;
                if (m_blockIndex  >= 0)
                {
                        if (m_trueBlocks[m_blockIndex].GetMajorIndex() != curMajorIndex)
                        {
                                m_trueBlocks[++m_blockIndex].SetMajorIndex(curMajorIndex);
                        }
                }
                else
                {
                        m_blockIndex = 0;
                        m_trueBlocks[0].SetMajorIndex(curMajorIndex);
                }
                m_trueBlocks[m_blockIndex].AddBlockIndex(n);
        }
int NumBlocksSet ( void  ) [inline]
{ return m_blockIndex+1; }
OrbazTrueBlockEnumerator& operator= ( const OrbazTrueBlockEnumerator rhs ) [inline]
        {
                if (this != &rhs)
                {
                        m_trueBlocks = rhs.m_trueBlocks;
                        m_blockIndex = rhs.m_blockIndex;
                }
                return *this;
        }